Current location

narf Source control manager Git

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Mehani <shtrom+mediagoblin@ssji.net>2020-05-30 23:33:23 +1000
committerOlivier Mehani <shtrom+mediagoblin@ssji.net>2020-05-31 00:44:14 +1000
commitc4863bac7d8caa6eea9338daafea5507b5923547 (patch)
tree6f878a51a8cc52f64666422a6b71405aef02513c
parent40e9e289a879365007e854b27275cc4b559085e2 (diff)
Use media_entry in collection_gallery
Signed-off-by: Olivier Mehani <shtrom+mediagoblin@ssji.net>
-rw-r--r--mediagoblin/static/css/base.css15
-rw-r--r--mediagoblin/templates/mediagoblin/utils/collection_gallery.html48
-rw-r--r--mediagoblin/templates/mediagoblin/utils/media_grid.html7
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/mediagoblin/static/css/base.css
+++ b/mediagoblin/static/css/base.css
@@ -647,8 +647,19 @@ ul#action_to_resolve {list-style:none; margin-left:10px;}
}
.media_thumbnail a.remove {
- color: #86D4B1;
- text-decoration: underline;
+ font-size: 0;
+ position: absolute;
+ top: 2px;
+ right: 2px;
+}
+.media_thumbnail a.remove:before {
+ content: 'X';
+ font-size: large;
+ font-weight: bold;
+ color: #f99;
+}
+.media_thumbnail a.remove:hover:before {
+ color: #f00;
}
a.thumb_entry_title {
diff --git a/mediagoblin/templates/mediagoblin/utils/collection_gallery.html b/mediagoblin/templates/mediagoblin/utils/collection_gallery.html
index 8a3f7a75..4a90878d 100644
--- a/mediagoblin/templates/mediagoblin/utils/collection_gallery.html
+++ b/mediagoblin/templates/mediagoblin/utils/collection_gallery.html
@@ -17,47 +17,25 @@
#}
{% from "mediagoblin/utils/pagination.html" import render_pagination %}
+{% from "mediagoblin/utils/media_grid.html" import media_entry %}
{% macro media_grid(request, collection_items, col_number=5) %}
- <div class="thumb_gallery">
+ <div class="thumb_gallery thumb_row">
{% for row in collection_items|batch(col_number) %}
- <div class="row thumb_row
- {%- if loop.first %} thumb_row_first
- {%- elif loop.last %} thumb_row_last{% endif %}">
{% for item in row %}
{% set obj = item.get_object() %}
- {% set obj_url = obj.url_for_self(request.urlgen) %}
- <div class="three columns media_thumbnail thumb_entry
- {%- if loop.first %} thumb_entry_first
- {%- elif loop.last %} thumb_entry_last{% endif %}">
- <a href="{{ obj_url }}">
- {% if obj.icon_url %}
- <img class="entry_type_icon" src="{{ obj.icon_url }}" />
- {% endif %}
- <img src="{{ obj.thumb_url }}" />
- </a>
-
- {% if obj.title %}
- <a href="{{ obj_url }}">{{ obj.title }}</a>
- {% endif %}
- {% if item.note %}
- {{ item.note }}
- {% endif %}
- {% if request.user and
- (item.in_collection.actor == request.user.id or
- request.user.has_privilege('admin')) %}
- {%- set remove_url=request.urlgen(
- 'mediagoblin.user_pages.collection_item_confirm_remove',
- user=item.in_collection.get_actor.username,
- collection=item.in_collection.slug,
- collection_item=item.id) -%}
- <a href="{{ remove_url }}" class="remove">
- {%- trans %}(remove){% endtrans -%}
- </a>
- {% endif %}
- </div>
+ {% set remove_url = None %}
+ {% if request.user and
+ (item.in_collection.actor == request.user.id or
+ request.user.has_privilege('admin')) %}
+ {%- set remove_url=request.urlgen(
+ 'mediagoblin.user_pages.collection_item_confirm_remove',
+ user=item.in_collection.get_actor.username,
+ collection=item.in_collection.slug,
+ collection_item=item.id) -%}
+ {% endif %}
+ {{ media_entry(request, obj, loop, remove_url) }}
{% endfor %}
- </div>
{% endfor %}
</div>
{%- endmacro %}
diff --git a/mediagoblin/templates/mediagoblin/utils/media_grid.html b/mediagoblin/templates/mediagoblin/utils/media_grid.html
index 1276e104..ec8d66b3 100644
--- a/mediagoblin/templates/mediagoblin/utils/media_grid.html
+++ b/mediagoblin/templates/mediagoblin/utils/media_grid.html
@@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
-{% macro media_entry(request, entry, loop) %}
+{% macro media_entry(request, entry, loop, remove_url=None) %}
{% set entry_url = entry.url_for_self(request.urlgen) %}
<div class="media_thumbnail thumb_entry
{%- if loop.first %} thumb_entry_first
@@ -31,6 +31,11 @@
{% if entry.icon_url %}
<img class="entry_type_icon" src="{{ entry.icon_url }}" />
{% endif %}
+ {% if remove_url%}
+ <a href="{{ remove_url }}" class="remove">
+ {%- trans %}(remove){% endtrans -%}
+ </a>
+ {% endif %}
{% if entry.title %}
<a class="thumb_entry_title" href="{{ entry_url }}">{{ entry.title }}</a>
{% endif %}