changeset 2388:7328625c7ef2

User validity now checked before the for loop for rendering user_actions
author sharky93 <rishabhr123@gmail.com>
date Sat, 17 Aug 2013 05:58:10 +0530
parents 9bf41329f031
children d6f71eda64d6
files MoinMoin/themes/basic/templates/show.html
diffstat 1 files changed, 30 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/themes/basic/templates/show.html	Sat Aug 17 05:54:42 2013 +0530
+++ b/MoinMoin/themes/basic/templates/show.html	Sat Aug 17 05:58:10 2013 +0530
@@ -23,36 +23,39 @@
 
 {% block user_actions %}
     {% set user_actions_exist = false %}
-    {%- for endpoint, label, title, check_exists in cfg.item_views if not endpoint in cfg.endpoints_excluded %}
-        {%- if not check_exists or check_exists and exists %}
 
-            {%- if endpoint in user_actions and user.valid %}
-                {% if user_actions_exist == false %}
-                    <div class="list-group-item">User Actions</div>
-                    {% set user_actions_exist = true %}
-                {% endif %}
-                <a class="list-group-item" href="{{ url_for(endpoint, item_name=item_name) }}" title="{{ title }}" rel="nofollow">
-                    <span class="icon-stack">
-                        <i class={{icon[endpoint]}}></i>
-                    </span>
-                    {%- if endpoint == 'frontend.quicklink_item' %}
-                        {%- if user.is_quicklinked_to([item_name]) %}
-                            {{ _('Remove Link') }}
-                        {%- else %}
-                            {{ _('Add Link') }}
-                        {%- endif %}
-                    {% elif endpoint == 'frontend.subscribe_item' %}
-                        {%- if user.is_subscribed_to([item_name]) %}
-                            {{ _('Unsubscribe') }}
-                        {%- else %}
-                            {{ _('Subscribe') }}
-                        {%- endif %}
+    {% if user.valid %}
+        {%- for endpoint, label, title, check_exists in cfg.item_views if not endpoint in cfg.endpoints_excluded %}
+            {%- if not check_exists or check_exists and exists %}
+
+                {%- if endpoint in user_actions %}
+                    {% if user_actions_exist == false %}
+                        <div class="list-group-item">User Actions</div>
+                        {% set user_actions_exist = true %}
                     {% endif %}
-                </a>
+                    <a class="list-group-item" href="{{ url_for(endpoint, item_name=item_name) }}" title="{{ title }}" rel="nofollow">
+                        <span class="icon-stack">
+                            <i class={{icon[endpoint]}}></i>
+                        </span>
+                        {%- if endpoint == 'frontend.quicklink_item' %}
+                            {%- if user.is_quicklinked_to([item_name]) %}
+                                {{ _('Remove Link') }}
+                            {%- else %}
+                                {{ _('Add Link') }}
+                            {%- endif %}
+                        {% elif endpoint == 'frontend.subscribe_item' %}
+                            {%- if user.is_subscribed_to([item_name]) %}
+                                {{ _('Unsubscribe') }}
+                            {%- else %}
+                                {{ _('Subscribe') }}
+                            {%- endif %}
+                        {% endif %}
+                    </a>
+                {%- endif %}
+
             {%- endif %}
-
-        {%- endif %}
-    {% endfor %}
+        {% endfor %}
+    {% endif %}
 {% endblock %}
 
 {% block site_actions %}