# HG changeset patch # User durandn # Date 1471351828 -7200 # Node ID 270d165cd0d5484a90e7ec5e8efeb9420284d4ba # Parent b5aa7e6f6a018c94d60e9e1fc69798e67d030d20 Finished work on user page annotation panels + small fixes on header and css diff -r b5aa7e6f6a01 -r 270d165cd0d5 src/iconolab/static/iconolab/css/iconolab.css --- a/src/iconolab/static/iconolab/css/iconolab.css Tue Aug 16 11:01:35 2016 +0200 +++ b/src/iconolab/static/iconolab/css/iconolab.css Tue Aug 16 14:50:28 2016 +0200 @@ -70,6 +70,8 @@ cursor: pointer; } +/* BADGES */ + .badge-error { background-color: #b94a48; } @@ -89,6 +91,30 @@ .notif-badge{ margin-bottom: 5px; } + +/* USER PAGE */ + .show-all-notifications{ cursor: pointer; +} +.annotation-panel{ + min-width: 535px; +} +.annotation-detail{ + vertical-align: middle; + display:inline-block; + margin-right: 15px; + margin-left: 15px; +} +.no-user-annotation{ + margin-left: 15px; +} +.dt-annotation{ + margin-bottom: 10px; +} +.userpage-annotation-btn{ + display:inline-block; + vertical-align: top; + margin-top: 15px; + margin-right: 15px; } \ No newline at end of file diff -r b5aa7e6f6a01 -r 270d165cd0d5 src/iconolab/templates/iconolab/detail_revision.html --- a/src/iconolab/templates/iconolab/detail_revision.html Tue Aug 16 11:01:35 2016 +0200 +++ b/src/iconolab/templates/iconolab/detail_revision.html Tue Aug 16 14:50:28 2016 +0200 @@ -25,7 +25,7 @@ {% endthumbnail %}
- Revoir l'image
+ Voir l'objet de cette annotation
Retour sur l'annotation
diff -r b5aa7e6f6a01 -r 270d165cd0d5 src/iconolab/templates/iconolab/user_home.html --- a/src/iconolab/templates/iconolab/user_home.html Tue Aug 16 11:01:35 2016 +0200 +++ b/src/iconolab/templates/iconolab/user_home.html Tue Aug 16 14:50:28 2016 +0200 @@ -53,58 +53,56 @@

{% if profile_user == request.user %}Mes annotations:{% else %}Annotations de {{profile_user.username}}{% endif %}

-
    + {% if not user_annotations %} - Aucune annotation à afficher +

    Aucune annotation à afficher

    + {% else %} +
      + {% for annotation in user_annotations.all %} + {% include "partials/user_page_annotation_panel.html" with annotation=annotation %} + {% endfor %} +
    {% endif %} - {% for annotation in user_annotations.all %} -
  • -
    -
    {{annotation.current_revision.title}}
    -
    - {% thumbnail annotation.image.media "150x150" crop=False as im %} - - - - - - - - - {% endthumbnail %} -
    -
    -
    -
    Commentaires:
    -
    {{annotation.stats.comments_count}}
    -
    Révisions en attente:
    -
    {{annotation.stats.awaiting_revisions_count}}
    -
    -
    -
    -
  • - {% endfor %} -

{% if profile_user == request.user %}Mes autres contributions:{% else %}Contributions de {{profile_user.username}}{% endif %}

-
- {% if profile_user == request.user %} - Annotations sur lesquelles j'ai commenté: - {% else %} - Annotations sur lesquelles {{profile_user.username}} a commenté: - {% endif %} -
-
{{user_comments_annotations.all}}
-
+
{% if profile_user == request.user %} Annotations sur lesquelles j'ai proposé des révisions {% else %} Annotations sur lesquelles {{profile_user.username}} a proposé des révisions: {% endif %}
-
{{user_revisions_annotations.all}}
+
+ {% if not user_revisions_annotations %} +

Aucune annotation à afficher

+ {% else %} +
    + {% for annotation in user_revisions_annotations.all %} + {% include "partials/user_page_annotation_panel.html" with annotation=annotation %} + {% endfor %} +
+ {% endif %} +
+
+ {% if profile_user == request.user %} + Annotations sur lesquelles j'ai commenté (sans proposer de révision): + {% else %} + Annotations sur lesquelles {{profile_user.username}} a commenté (sans proposer de révision): + {% endif %} +
+
+ {% if not user_comments_annotations %} +

Aucune annotation à afficher

+ {% else %} +
    + {% for annotation in user_comments_annotations.all %} + {% include "partials/user_page_annotation_panel.html" with annotation=annotation %} + {% endfor %} +
+ {% endif %} +
diff -r b5aa7e6f6a01 -r 270d165cd0d5 src/iconolab/templates/partials/header.html --- a/src/iconolab/templates/partials/header.html Tue Aug 16 11:01:35 2016 +0200 +++ b/src/iconolab/templates/partials/header.html Tue Aug 16 14:50:28 2016 +0200 @@ -22,7 +22,7 @@ {% if request.user.is_authenticated %} {% notifications_unread as unread_count %}
  • - {{user.username}}: Mon espace + {{request.user.username}}: Mon espace {{ unread_count }}
  • Se déconnecter
  • diff -r b5aa7e6f6a01 -r 270d165cd0d5 src/iconolab/templates/partials/user_page_annotation_panel.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/iconolab/templates/partials/user_page_annotation_panel.html Tue Aug 16 14:50:28 2016 +0200 @@ -0,0 +1,31 @@ +{% load thumbnail %} +{% load iconolab_tags %} +
  • +
    +
    {{annotation.current_revision.title}}
    + +
    + {% thumbnail annotation.image.media "150x150" crop=False as im %} + + + + + + + + + {% endthumbnail %} +
    +
    +
    +
    Commentaires:
    +
    {{annotation.stats.comments_count}}
    +
    Révisions en attente:
    +
    {{annotation.stats.awaiting_revisions_count}}
    +
    Révisions acceptée:
    +
    {{annotation.stats.accepted_revisions_count}}
    +
    +
    + Voir annotation +
    +
  • \ No newline at end of file diff -r b5aa7e6f6a01 -r 270d165cd0d5 src/iconolab/views/iconolab.py --- a/src/iconolab/views/iconolab.py Tue Aug 16 11:01:35 2016 +0200 +++ b/src/iconolab/views/iconolab.py Tue Aug 16 14:50:28 2016 +0200 @@ -51,7 +51,13 @@ ).distinct() comments_annotations_str_id = IconolabComment.objects.filter(user=profile_user, content_type__app_label="iconolab", content_type__model="annotation").values_list("object_pk", flat=True) comments_annotations_id = [int(str_id) for str_id in comments_annotations_str_id] - context["user_comments_annotations"] = Annotation.objects.filter(id__in=comments_annotations_id).exclude(author=profile_user).distinct() + context["user_comments_annotations"] = Annotation.objects.filter(id__in=comments_annotations_id).exclude(author=profile_user).exclude(annotation_guid__in=context["user_revisions_annotations"].values_list("annotation_guid", flat=True)).prefetch_related( + "current_revision", + "revisions", + "image", + "image__item", + "image__item__collection" + ).distinct() if request.user.is_authenticated() and self.object == request.user: if request.GET.get("clear_notifications", False): Notification.objects.filter(recipient=request.user).mark_all_as_read() @@ -406,7 +412,7 @@ context['tags_data'] = revision.get_tags_json() context['comment'] = revision.creation_comment.first() if request.user.is_authenticated() and annotation.author == request.user: - notified_revision = Notification.objects.filter( + ann_author_notified = Notification.objects.filter( recipient=request.user, action_object_content_type__app_label="iconolab", action_object_content_type__model="annotationrevision", @@ -415,8 +421,21 @@ target_content_type__model="annotation", target_object_id=annotation.id ).unread() - if notified_revision: - notified_revision.first().mark_as_read() + if ann_author_notified: + ann_author_notified.first().mark_as_read() + context["notified_revision"] = True + if request.user.is_authenticated() and revision.author == request.user: + rev_author_notified = Notification.objects.filter( + recipient=request.user, + action_object_content_type__app_label="iconolab", + action_object_content_type__model="annotationrevision", + action_object_object_id=revision.id, + target_content_type__app_label="iconolab", + target_content_type__model="annotation", + target_object_id=annotation.id + ).unread() + if rev_author_notified: + rev_author_notified.first().mark_as_read() context["notified_revision"] = True return render(request, 'iconolab/detail_revision.html', context)