# HG changeset patch # User Alexandre Segura # Date 1495096646 -7200 # Node ID 3d920e27a4656c0db718d3c621161f72e3beed2a # Parent 1bae3da99830d1328272d61c52a0453994273737 Improve bookmarks design. diff -r 1bae3da99830 -r 3d920e27a465 src/iconolab/templates/iconolab/user_bookmarks.html --- a/src/iconolab/templates/iconolab/user_bookmarks.html Wed May 17 17:06:07 2017 +0200 +++ b/src/iconolab/templates/iconolab/user_bookmarks.html Thu May 18 10:37:26 2017 +0200 @@ -4,52 +4,60 @@ {% load humanize %} {% block user_content %} - - - - - - - - - - {% for bookmark in bookmarks %} - - - - - - - + {% if bookmarks_by_category|length == 0 %} +
Aucun favori pour le moment.
+ {% else %} + + {% for bookmarks_category in bookmarks_by_category %} +

{{ bookmarks_category.category.name }}

+
CollectionCatégorie
- {% thumbnail bookmark.image.media "100x100" crop=False as thumbnail %} - - - - {% endthumbnail %} - {{ bookmark.image.item.collection.verbose_name }} - {% if request.user.is_authenticated and profile_user == request.user %} -
- {% csrf_token %} - -
- {% else %} - {{ bookmark.category.name }} - {% endif %} -
{{ bookmark.created|naturaltime }} - {% if request.user.is_authenticated and profile_user == request.user %} -
- {% csrf_token %} - -
- {% endif %} -
+ + + + + + + + + {% for bookmark in bookmarks_category.bookmarks %} + + + + + + + + {% endfor %} + +
CollectionCatégorie
+ {% thumbnail bookmark.image.media "100x100" crop=False as thumbnail %} + + + + {% endthumbnail %} + {{ bookmark.image.item.collection.verbose_name }} + {% if request.user.is_authenticated and profile_user == request.user %} +
+ {% csrf_token %} + +
+ {% else %} + {{ bookmark.category.name }} + {% endif %} +
{{ bookmark.created|naturaltime }} + {% if request.user.is_authenticated and profile_user == request.user %} +
+ {% csrf_token %} + +
+ {% endif %} +
{% endfor %} - - + {% endif %} {% endblock %} {% block footer_js %} diff -r 1bae3da99830 -r 3d920e27a465 src/iconolab/templates/partials/item_images_preview.html --- a/src/iconolab/templates/partials/item_images_preview.html Wed May 17 17:06:07 2017 +0200 +++ b/src/iconolab/templates/partials/item_images_preview.html Thu May 18 10:37:26 2017 +0200 @@ -19,7 +19,12 @@ title="{% if is_bookmarked %}Ajouté à vos favoris{% else %}Ajouter à mes favoris{% endif %}" data-item="{{ item.metadatas.joconde_ref }}" data-image-id="{{ first_image.id }}" - data-image-guid="{{ first_image.image_guid }}"> + data-image-guid="{{ first_image.image_guid }}"> + + + + + {% endif %} diff -r 1bae3da99830 -r 3d920e27a465 src/iconolab/views/userpages.py --- a/src/iconolab/views/userpages.py Wed May 17 17:06:07 2017 +0200 +++ b/src/iconolab/views/userpages.py Thu May 18 10:37:26 2017 +0200 @@ -127,11 +127,21 @@ profile_user = self.object context = self.get_context_data() + bookmark_categories = BookmarkCategory.objects.filter(user=profile_user).all() + + context['bookmark_categories'] = bookmark_categories context['profile_user'] = profile_user - context['bookmarks'] = Bookmark.objects.filter(category__user=profile_user).all() - if (request.user.is_authenticated()): - context['bookmark_categories'] = BookmarkCategory.objects.filter(user=request.user).all() + bookmarks_by_category = [] + for bookmark_category in bookmark_categories: + bookmarks = Bookmark.objects.filter(category__user=profile_user, category=bookmark_category).all() + if bookmarks.count() > 0: + bookmarks_by_category.append({ + 'category': bookmark_category, + 'bookmarks': bookmarks + }) + + context['bookmarks_by_category'] = bookmarks_by_category return render(request, 'iconolab/user_bookmarks.html', context) diff -r 1bae3da99830 -r 3d920e27a465 src_js/iconolab-bundle/src/iconolab.scss --- a/src_js/iconolab-bundle/src/iconolab.scss Wed May 17 17:06:07 2017 +0200 +++ b/src_js/iconolab-bundle/src/iconolab.scss Thu May 18 10:37:26 2017 +0200 @@ -45,16 +45,21 @@ display: block; } .bookmark { - color: #E67E22; + color: #fff; position: absolute; - top: 10px; - right: 10px; + top: 0; + right: 0; &:hover, &:active { - color: darken(#E67E22, 10%); + color: darken(#fff, 20%); } &.active { - color: #3498DB; + color: #F39C12; + } + .fa-stack { + > i:last-child { + color: #000; + } } } }