changeset 2844:4560747c4506

if item view has no comments or transclusions, hide buttons on basic theme rework templates and JS so buttons are visible per templates and hidden by JS as required
author RogerHaase <haaserd@gmail.com>
date Thu, 23 Oct 2014 09:38:41 -0700
parents 4c961707ae95
children 1006d2d15d70
files MoinMoin/static/js/common.js MoinMoin/templates/itemviews.html MoinMoin/themes/basic/templates/show.html
diffstat 3 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/static/js/common.js	Wed Oct 22 16:01:12 2014 -0700
+++ b/MoinMoin/static/js/common.js	Thu Oct 23 09:38:41 2014 -0700
@@ -62,12 +62,13 @@
     "use strict";
     var pageComments = $('.comment');
     if (pageComments.length > 0) {
-        // There are comments, so show itemview Comments button
-        $('.moin-toggle-comments-button').css('display', '');
         // comments are visible; per user option, hide comments if there is not a <br id="moin-show-comments" />
         if (!document.getElementById('moin-show-comments')) {
             this.toggleComments();
         }
+    } else {
+        // There are no comments, so hide Comments button
+        $('.moin-toggle-comments-button').css('display', 'none');
     }
     $('.moin-toggle-comments-button').click(this.toggleComments);
 };
@@ -142,10 +143,10 @@
             $(wrapper).append(overlayLR);
         }
     });
-    // if an element was wrapped above, then make the Transclusions buttons visible
     wrappers = $('.moin-item-wrapper');
-    if (wrappers.length > 0) {
-        $('.moin-transclusions-button').css('display', '');
+    if (wrappers.length === 0) {
+        // if there are no transclusions, make the Transclusions buttons invisible
+        $('.moin-transclusions-button').css('display', 'none');
     }
     $('.moin-transclusions-button').click(this.toggleTransclusionOverlays);
 };
--- a/MoinMoin/templates/itemviews.html	Wed Oct 22 16:01:12 2014 -0700
+++ b/MoinMoin/templates/itemviews.html	Thu Oct 23 09:38:41 2014 -0700
@@ -66,13 +66,13 @@
             {%- endif %}
 
             {%- if endpoint == 'special.comments' %}
-                <li class="moin-toggle-comments-button" style="display:none;">
+                <li class="moin-toggle-comments-button">
                     <a class="moin-toggle-comments-tooltip" href="#" title="{{ title }}">{{ label }}</a>
                 </li>
             {%- endif %}
 
         {% if endpoint == 'special.transclusions' -%}
-            <li class="moin-transclusions-button" style="display:none;">
+            <li class="moin-transclusions-button">
                 <a class="moin-transclusions-tooltip" href="#" title="{{ title }}">{{ label }}</a>
             </li>
         {%- endif %}
--- a/MoinMoin/themes/basic/templates/show.html	Wed Oct 22 16:01:12 2014 -0700
+++ b/MoinMoin/themes/basic/templates/show.html	Thu Oct 23 09:38:41 2014 -0700
@@ -39,13 +39,13 @@
         <div id="moin-view-options" class="hidden">
             {# TODO: review themes/init.py and config/default.py to improve support #}
             {{ local_panel_main(item_navigation) }} {# Discussion #}
-            <div class="moin-toggle-comments-button list-group-item" style="">
-                <a class="moin-toggle-comments-tooltip" href="#" title="Show comments">
+            <div class="moin-toggle-comments-button list-group-item">
+                <a class="moin-toggle-comments-tooltip" href="#" title="Hide comments">
                     <i class="fa fa-comment-o"></i>
                     Comments
                 </a>
             </div>
-            <div class="moin-transclusions-button list-group-item" style="">
+            <div class="moin-transclusions-button list-group-item">
                 <a class="moin-transclusions-tooltip" href="#" title="Show transclusions">
                     <i class="fa fa-paste"></i>
                     Transclusions