changeset 2656:c05ad337ac22

Added subscribe and add quicklink option in ticket's base.html
author Saurabh Kathpalia <saurabh.kathpalia95@gmail.com>
date Fri, 04 Jul 2014 16:20:40 +0530
parents bc0f43fecbc7
children 080673c3e60a
files MoinMoin/items/ticket.py MoinMoin/templates/ticket/base.html
diffstat 2 files changed, 64 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/items/ticket.py	Thu Jul 03 22:04:50 2014 +0200
+++ b/MoinMoin/items/ticket.py	Fri Jul 04 16:20:40 2014 +0530
@@ -204,4 +204,5 @@
                                    data_rendered=data_rendered,
                                    form=form,
                                    suggested_tags=suggested_tags,
+                                   item=self,
                                   )
--- a/MoinMoin/templates/ticket/base.html	Thu Jul 03 22:04:50 2014 +0200
+++ b/MoinMoin/templates/ticket/base.html	Fri Jul 04 16:20:40 2014 +0530
@@ -39,6 +39,65 @@
     <link media="all" rel="stylesheet" href="{{ url_for('static', filename='css/ticket.css') }}" />
 {% endblock %}
 
+{% set exists = item.fqname and storage.get_item(**item.fqname.query) %}
+{% block local_panel %}
+    {% if user.valid and exists %}
+        <div class="list-group">
+            <div class="list-group-item moin-list-heading">
+                {{ _("User Actions") }}
+                <a class="moin-showhide moin-useractions" href="#" >[+]</a>
+            </div>
+            <div id="user-actions" class="hidden">
+                <a href="{{ url_for('frontend.quicklink_item', item_name=item.fqname) }}" class="list-group-item" rel="nofollow" title="Create or remove a navigation link to this item">
+                    <i class="icon-star-empty icon-fixed-width"> </i>
+                    {%- if user.is_quicklinked_to([item.fqname]) %}
+                        {{ _('Remove Link') }}
+                    {%- else %}
+                        {{ _('Add Link') }}
+                    {%- endif %}
+                </a>
+                <a href="{{ url_for('frontend.subscribe_item', item_name=item.fqname) }}" class="list-group-item" rel="nofollow" title="witch notifications about item changes on or off">
+                    <i class="icon-envelope icon-fixed-width"> </i>
+                    {%- if user.is_subscribed_to(item) %}
+                        {{ _('Unsubscribe') }}
+                    {%- else %}
+                        {{ _('Subscribe') }}
+                    {%- endif %}
+                </a>
+            </div>
+        </div>
+    {% endif %}
+{% endblock %}
+
+{% macro itemviews() %}
+    {% if user.valid and exists %}
+        <ul class="moin-itemviews panel">
+            <li>
+                <a href="{{ url_for('frontend.quicklink_item', item_name=item.fqname) }}" title="Create or remove a navigation link to this item" rel="nofollow">
+                    {% if user.is_quicklinked_to([item.fqname]) %}
+                        {{ _('Remove Link') }}
+                    {%- else %}
+                        {{ _('Add Link') }}
+                    {%- endif %}
+                </a>
+            </li>
+            <li>
+                <a href="{{ url_for('frontend.subscribe_item', item_name=item.fqname) }}" title="Switch notifications about item changes on or off" rel="nofollow">
+                    {%- if user.is_subscribed_to(item) %}
+                        {{ _('Unsubscribe') }}
+                    {%- else %}
+                        {{ _('Subscribe') }}
+                    {%- endif %}
+                </a>
+            </li>
+        </ul>
+    {% endif %}
+{% endmacro %}
+
+{% block header_itemviews %}
+    {{ itemviews() }}
+{% endblock %}
+
 {% block content %}
 <h1>
     {% block title_text %}
@@ -63,3 +122,7 @@
     {{ gen.form.close() }}
 </div>
 {% endblock %}
+
+{% block footer_itemviews %}
+    {{ itemviews() }}
+{% endblock %}