diff options
author | Caleb Forbes Davis V <caldavis@gmail.com> | 2011-07-02 06:15:58 -0500 |
---|---|---|
committer | Caleb Forbes Davis V <caldavis@gmail.com> | 2011-07-02 06:15:58 -0500 |
commit | 9c0fe63fadc848b5154c7c1d4b2ff72dd05bc1c6 (patch) | |
tree | e958264fe3d34cfe35e077ea1d0a137c0af3af9d /mediagoblin/templates | |
parent | 0e3400357d55caf9099f4288ce8aef90eff7867c (diff) | |
download | mediagoblin-9c0fe63fadc848b5154c7c1d4b2ff72dd05bc1c6.tar.lz mediagoblin-9c0fe63fadc848b5154c7c1d4b2ff72dd05bc1c6.tar.xz mediagoblin-9c0fe63fadc848b5154c7c1d4b2ff72dd05bc1c6.zip |
adds previous and next links in the sidebar
Feature #401 - previous/next navigation on media pages
* media.html includes a new prev_next.html template containing the links
* prev_next.html calls functions added to the media model to retrieve
the appropriate objects from the database, formatted with urlgen
* a small change to util.py brings ASCENDING into the mix
Diffstat (limited to 'mediagoblin/templates')
-rw-r--r-- | mediagoblin/templates/mediagoblin/user_pages/media.html | 1 | ||||
-rw-r--r-- | mediagoblin/templates/mediagoblin/utils/prev_next.html | 45 |
2 files changed, 46 insertions, 0 deletions
diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html index 3cebe2f9..6159a853 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/media.html +++ b/mediagoblin/templates/mediagoblin/user_pages/media.html @@ -96,6 +96,7 @@ <div class="grid_4 omega media_sidebar"> <p>This is a sidebar! Yay!</p> + {% include "mediagoblin/utils/prev_next.html" %} </div> {% else %} <p>Sorry, no such media found.<p/> diff --git a/mediagoblin/templates/mediagoblin/utils/prev_next.html b/mediagoblin/templates/mediagoblin/utils/prev_next.html new file mode 100644 index 00000000..e054ed23 --- /dev/null +++ b/mediagoblin/templates/mediagoblin/utils/prev_next.html @@ -0,0 +1,45 @@ +{# +# GNU MediaGoblin -- federated, autonomous media hosting +# Copyright (C) 2011 Free Software Foundation, Inc +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +#} + +{# Provide navigation links to neighboring media entries, if possible #} +{% set prev_entry_url = media.url_to_prev(request.urlgen) %} +{% set next_entry_url = media.url_to_next(request.urlgen) %} + +<div> + {# There are no previous entries for the very first media entry #} + {% if prev_entry_url %} + <a href="{{ prev_entry_url }}"> + {# TODO - insert 'Previous' and 'X' image sources #} + Previous + </a> + {% else %} + {# This is the first entry. display greyed-out 'previous' image #} + X + {% endif %} + + {# Likewise, this could be the very last media entry #} + {% if next_entry_url %} + <a href="{{ next_entry_url }}"> + {# TODO - insert 'Next' and 'X' image sources #} + Next + </a> + {% else %} + {# This is the last entry. display greyed-out 'next' image #} + X + {% endif %} +</div> |