# HG changeset patch # User durandn # Date 1481560053 -3600 # Node ID 7204cfdde3be88d81764907e250c93d2d1217c06 # Parent 0a0b82040ee1c49d3a25339c443936537c879e5a Added a readonly view for annotation detail that doesn't display comments and edit links + added a link to that view from the admin interface diff -r 0a0b82040ee1 -r 7204cfdde3be src/iconolab/templates/iconolab/detail_annotation_readonly.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/iconolab/templates/iconolab/detail_annotation_readonly.html Mon Dec 12 17:27:33 2016 +0100 @@ -0,0 +1,99 @@ +{% extends 'iconolab_base.html' %} + +{% load i18n %} +{% load staticfiles %} +{% load thumbnail %} +{% load iconolab_tags %} + +{% block content %} +
+ +
+
+
+ {% thumbnail annotation.image.media "300x300" crop=False as im %} + + + + + + + + + + + {% endthumbnail %} +
+
+

+ Voir l'objet de cette annotation + Voir les annotations sur l'image + +
+
+

Annotation créée par {{ annotation.author.username }}

+

Titre : {{ annotation.current_revision.title }}

+

Description : {{ annotation.current_revision.description }}

+ {% if tags_data != "[]" %} +

Mot-clés :

+ +
+ {% endif %} +
+ {% include "partials/annotation_stats_panel.html" with annotation=annotation label="Statistiques sur cette annotation:" %} +
+ + + +
+
+{% endblock %} + +{% block footer_js %} + +{% endblock %} \ No newline at end of file diff -r 0a0b82040ee1 -r 7204cfdde3be src/iconolab/templates/partials/image_annotations_list.html --- a/src/iconolab/templates/partials/image_annotations_list.html Mon Dec 12 15:02:31 2016 +0100 +++ b/src/iconolab/templates/partials/image_annotations_list.html Mon Dec 12 17:27:33 2016 +0100 @@ -59,8 +59,10 @@ Espace de travail
Suivre le lien
-
Etat courant
+
Permalien vers l'état actuel
Suivre le lien
+
Permalien vers l'état dynamique
+ Suivre le lien
{% endif %} diff -r 0a0b82040ee1 -r 7204cfdde3be src/iconolab/urls.py --- a/src/iconolab/urls.py Mon Dec 12 15:02:31 2016 +0100 +++ b/src/iconolab/urls.py Mon Dec 12 17:27:33 2016 +0100 @@ -38,6 +38,7 @@ url(r'^collections/(?P[a-z0-9\-]+)/images/(?P[^/]+)/annotations/?$', django_views.generic.RedirectView.as_view(pattern_name="image_detail")), url(r'^collections/(?P[a-z0-9\-]+)/images/(?P[^/]+)/annotations/create$', login_required(views.objects.CreateAnnotationView.as_view()), name='annotation_create'), url(r'^collections/(?P[a-z0-9\-]+)/images/(?P[^/]+)/annotations/(?P[^/]+)/detail$', views.objects.ShowAnnotationView.as_view(), name='annotation_detail'), + url(r'^collections/(?P[a-z0-9\-]+)/images/(?P[^/]+)/annotations/(?P[^/]+)/readonly$', views.objects.ReadonlyAnnotationView.as_view(), name='annotation_readonly'), url(r'^collections/(?P[a-z0-9\-]+)/images/(?P[^/]+)/annotations/(?P[^/]+)/edit$', login_required(views.objects.EditAnnotationView.as_view()), name='annotation_edit'), url(r'^collections/(?P[a-z0-9\-]+)/images/(?P[^/]+)/annotations/(?P[^/]+)/revisions/?$', django_views.generic.RedirectView.as_view(pattern_name="annotation_detail")), url(r'^collections/(?P[a-z0-9\-]+)/images/(?P[^/]+)/annotations/(?P[^/]+)/revisions/(?P[^/]+)/detail', views.objects.ShowRevisionView.as_view(), name='revision_detail'), diff -r 0a0b82040ee1 -r 7204cfdde3be src/iconolab/views/objects.py --- a/src/iconolab/views/objects.py Mon Dec 12 15:02:31 2016 +0100 +++ b/src/iconolab/views/objects.py Mon Dec 12 17:27:33 2016 +0100 @@ -401,6 +401,34 @@ annotation.stats.save() return render(request, 'iconolab/detail_annotation.html', context) + +class ReadonlyAnnotationView(View, ContextMixin, IconolabObjectView): + + def get_context_data(self, **kwargs): + context = super(ReadonlyAnnotationView, self).get_context_data(**kwargs) + context['collection_name'] = self.kwargs.get('collection_name', '') + context['image_guid'] = self.kwargs.get('image_guid', '') + context['annotation_guid'] = self.kwargs.get('annotation_guid', '') + return context + + def get(self, request, *args, **kwargs): + success, result = self.check_kwargs(kwargs) + if success: + (collection, image, annotation,) = result + else: + return result(request) + context = self.get_context_data(**kwargs) + context['collection'] = collection + context['image'] = image + context['annotation'] = annotation + context['tags_data'] = annotation.current_revision.get_tags_json() + + image.stats.views_count += 1 + image.stats.save() + annotation.stats.views_count += 1 + annotation.stats.save() + return render(request, 'iconolab/detail_annotation_readonly.html', context) + class EditAnnotationView(View, ContextMixin, IconolabObjectView): def get_context_data(self, **kwargs):