Ticket #5619: 0005-Use-media_entry-in-collection_gallery.patch
File 0005-Use-media_entry-in-collection_gallery.patch, 4.9 KB (added by , 3 years ago) |
---|
-
mediagoblin/static/css/base.css
From 6a32e9123f4cf395682f6def36b389e5ac62ba4f Mon Sep 17 00:00:00 2001 From: Olivier Mehani <shtrom+mediagoblin@ssji.net> Date: Sat, 30 May 2020 23:33:23 +1000 Subject: [PATCH 5/5] Use media_entry in collection_gallery Signed-off-by: Olivier Mehani <shtrom+mediagoblin@ssji.net> --- mediagoblin/static/css/base.css | 15 +++++- .../mediagoblin/utils/collection_gallery.html | 48 +++++-------------- .../mediagoblin/utils/media_grid.html | 7 ++- 3 files changed, 32 insertions(+), 38 deletions(-) diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index 65e33ceb..63df15e5 100644
a b ul#action_to_resolve {list-style:none; margin-left:10px;} 647 647 } 648 648 649 649 .media_thumbnail a.remove { 650 color: #86D4B1; 651 text-decoration: underline; 650 font-size: 0; 651 position: absolute; 652 top: 2px; 653 right: 2px; 654 } 655 .media_thumbnail a.remove:before { 656 content: 'X'; 657 font-size: large; 658 font-weight: bold; 659 color: #f99; 660 } 661 .media_thumbnail a.remove:hover:before { 662 color: #f00; 652 663 } 653 664 654 665 a.thumb_entry_title { -
mediagoblin/templates/mediagoblin/utils/collection_gallery.html
diff --git a/mediagoblin/templates/mediagoblin/utils/collection_gallery.html b/mediagoblin/templates/mediagoblin/utils/collection_gallery.html index 8a3f7a75..4a90878d 100644
a b 17 17 #} 18 18 19 19 {% from "mediagoblin/utils/pagination.html" import render_pagination %} 20 {% from "mediagoblin/utils/media_grid.html" import media_entry %} 20 21 21 22 {% macro media_grid(request, collection_items, col_number=5) %} 22 <div class="thumb_gallery ">23 <div class="thumb_gallery thumb_row"> 23 24 {% for row in collection_items|batch(col_number) %} 24 <div class="row thumb_row25 {%- if loop.first %} thumb_row_first26 {%- elif loop.last %} thumb_row_last{% endif %}">27 25 {% for item in row %} 28 26 {% set obj = item.get_object() %} 29 {% set obj_url = obj.url_for_self(request.urlgen) %} 30 <div class="three columns media_thumbnail thumb_entry 31 {%- if loop.first %} thumb_entry_first 32 {%- elif loop.last %} thumb_entry_last{% endif %}"> 33 <a href="{{ obj_url }}"> 34 {% if obj.icon_url %} 35 <img class="entry_type_icon" src="{{ obj.icon_url }}" /> 36 {% endif %} 37 <img src="{{ obj.thumb_url }}" /> 38 </a> 39 40 {% if obj.title %} 41 <a href="{{ obj_url }}">{{ obj.title }}</a> 42 {% endif %} 43 {% if item.note %} 44 {{ item.note }} 45 {% endif %} 46 {% if request.user and 47 (item.in_collection.actor == request.user.id or 48 request.user.has_privilege('admin')) %} 49 {%- set remove_url=request.urlgen( 50 'mediagoblin.user_pages.collection_item_confirm_remove', 51 user=item.in_collection.get_actor.username, 52 collection=item.in_collection.slug, 53 collection_item=item.id) -%} 54 <a href="{{ remove_url }}" class="remove"> 55 {%- trans %}(remove){% endtrans -%} 56 </a> 57 {% endif %} 58 </div> 27 {% set remove_url = None %} 28 {% if request.user and 29 (item.in_collection.actor == request.user.id or 30 request.user.has_privilege('admin')) %} 31 {%- set remove_url=request.urlgen( 32 'mediagoblin.user_pages.collection_item_confirm_remove', 33 user=item.in_collection.get_actor.username, 34 collection=item.in_collection.slug, 35 collection_item=item.id) -%} 36 {% endif %} 37 {{ media_entry(request, obj, loop, remove_url) }} 59 38 {% endfor %} 60 </div>61 39 {% endfor %} 62 40 </div> 63 41 {%- endmacro %} -
mediagoblin/templates/mediagoblin/utils/media_grid.html
diff --git a/mediagoblin/templates/mediagoblin/utils/media_grid.html b/mediagoblin/templates/mediagoblin/utils/media_grid.html index 1276e104..ec8d66b3 100644
a b 16 16 # along with this program. If not, see <http://www.gnu.org/licenses/>. 17 17 #} 18 18 19 {% macro media_entry(request, entry, loop ) %}19 {% macro media_entry(request, entry, loop, remove_url=None) %} 20 20 {% set entry_url = entry.url_for_self(request.urlgen) %} 21 21 <div class="media_thumbnail thumb_entry 22 22 {%- if loop.first %} thumb_entry_first … … 31 31 {% if entry.icon_url %} 32 32 <img class="entry_type_icon" src="{{ entry.icon_url }}" /> 33 33 {% endif %} 34 {% if remove_url%} 35 <a href="{{ remove_url }}" class="remove"> 36 {%- trans %}(remove){% endtrans -%} 37 </a> 38 {% endif %} 34 39 {% if entry.title %} 35 40 <a class="thumb_entry_title" href="{{ entry_url }}">{{ entry.title }}</a> 36 41 {% endif %}