diff options
author | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-08-18 22:00:55 -0500 |
---|---|---|
committer | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-08-18 22:00:55 -0500 |
commit | b5017dbac8ad9e8afd70d2d2281571e0155c3739 (patch) | |
tree | f7d6104fc96db2d7586f6ede3b35c5dd72812109 /mediagoblin/templates | |
parent | 5b21ecf9db4c1618066142b77aaa750d1333a1d7 (diff) | |
download | mediagoblin-b5017dbac8ad9e8afd70d2d2281571e0155c3739.tar.lz mediagoblin-b5017dbac8ad9e8afd70d2d2281571e0155c3739.tar.xz mediagoblin-b5017dbac8ad9e8afd70d2d2281571e0155c3739.zip |
Switch the grid over to using a... erk... table! :)
Also changes the gridification routine a bit.
Diffstat (limited to 'mediagoblin/templates')
-rw-r--r-- | mediagoblin/templates/mediagoblin/utils/object_gallery.html | 51 |
1 files changed, 17 insertions, 34 deletions
diff --git a/mediagoblin/templates/mediagoblin/utils/object_gallery.html b/mediagoblin/templates/mediagoblin/utils/object_gallery.html index c7286678..b451946d 100644 --- a/mediagoblin/templates/mediagoblin/utils/object_gallery.html +++ b/mediagoblin/templates/mediagoblin/utils/object_gallery.html @@ -18,44 +18,27 @@ {% from "mediagoblin/utils/pagination.html" import render_pagination %} -{% macro media_grid(request, media_list, col_number=5) %} - {% set num_items = media_list.count() %} - {% set col_counter = 0 %} - {% set row_counter = 0 %} - {% set item_counter = 0 %} - - {% set num_rows = num_items // col_number %} - {% if num_items % col_number != 0 %} - {% set num_rows = num_rows + 1 %} - {% endif %} - - <div class="thumb_gallery"> - {% for entry in media_list %} - {% if col_counter == 0 %} - <div class="thumb_row {% if row_counter == 0 %}thumb_row_first{% endif %}{% if num_rows == row_counter + 1 %}thumb_row_last{% endif %}"> - {% endif %} - - <div class="media_thumbnail thumb_entry {% if col_counter == 0 %}thumb_entry_first{% endif %}{% if col_number == col_counter + 1 or num_items == item_counter + 1 %}thumb_entry_last{% endif %}"> +{% macro media_grid(request, media_entries, col_number=5) %} + <table class="thumb_gallery"> + {% for row in gridify_cursor(media_entries, col_number) %} + <tr class="thumb_row + {%- if loop.first %} thumb_row_first + {%- elif loop.last %} thumb_row_last{% endif %}"> + {% for entry in row %} + <td class="media_thumbnail thumb_entry + {%- if loop.first %} thumb_entry_first + {%- elif loop.last %} thumb_entry_last{% endif %}"> <a href="{{ entry.url_for_self(request.urlgen) }}"> - <img src="{{ request.app.public_store.file_url( - entry['media_files']['thumb']) }}" /></a> - </div> - - {% if col_number == col_counter + 1 or num_items == item_counter + 1 %} - </div> - {% set row_counter = row_counter + 1 %} - {% endif %} - - {% set item_counter = item_counter + 1 %} - {% set col_counter = col_counter + 1 %} - {% if col_counter == col_number %} - {% set col_counter = 0 %} - {% endif %} + <img src="{{ request.app.public_store.file_url( + entry['media_files']['thumb']) }}" /> + </a> + </td> + {% endfor %} + </tr> {% endfor %} - </div> + </table> {%- endmacro %} - {# Render a media gallery with pagination. |