Add link to show selected folder below collection title.
authorAlexandre Segura <mex.zktk@gmail.com>
Tue, 02 May 2017 14:03:27 +0200
changeset 486 869bb212631a
parent 485 47080491b330
child 487 a881aa78a3b1
Add link to show selected folder below collection title.
src/iconolab/templates/iconolab/collection_home.html
src/iconolab/views/objects.py
--- a/src/iconolab/templates/iconolab/collection_home.html	Tue May 02 13:50:05 2017 +0200
+++ b/src/iconolab/templates/iconolab/collection_home.html	Tue May 02 14:03:27 2017 +0200
@@ -48,6 +48,14 @@
     <div class="col-md-9">
       <h1>{{ collection.verbose_name }} <small>Fonds Iconolab</small></h1>
 
+      {% if folder_guid %}
+      <p>
+        <a href="{% url 'collection_home' collection_name %}">
+          <i class="fa fa-close"></i> {{ folder_name }}
+        </a>
+      </p>
+      {% endif %}
+
       {% if not folder_guid and contributions_pagination_data.list %}
         <h3>Appels à contribution</h3>
         {% for annotation in contributions_pagination_data.list %}
--- a/src/iconolab/views/objects.py	Tue May 02 13:50:05 2017 +0200
+++ b/src/iconolab/views/objects.py	Tue May 02 14:03:27 2017 +0200
@@ -13,7 +13,7 @@
 from django.contrib.sites.models import Site
 from django.conf import settings
 from notifications.models import Notification
-from iconolab.models import Annotation, AnnotationRevision, Collection, Item, Image, IconolabComment, MetaCategory, MetaCategoryInfo
+from iconolab.models import Annotation, AnnotationRevision, Collection, Folder, Item, Image, IconolabComment, MetaCategory, MetaCategoryInfo
 from iconolab.forms.annotations import AnnotationRevisionForm
 from iconolab.serializers import AnnotationRevisionSerializer
 import logging
@@ -227,6 +227,7 @@
 
         if folder is not None:
             items_list = items_list.filter(folders__folder_guid=folder)
+            context['folder_name'] = Folder.objects.get(folder_guid=folder).name
 
         context['folder_guid'] = folder