Commits

Anonymous committed ea4669f

0.12.1dev: Changed the folding markers in the plugin admin panel to use the same triangles as everywhere else in Trac, therefore making them visible even if the width of the panel beecomes too large.

Closes #9210.

Comments (0)

Files changed (3)

trac/admin/templates/admin_plugins.html

     <script type="text/javascript" src="${chrome.htdocs_location}js/folding.js"></script>
     <script type="text/javascript">
       jQuery(document).ready(function($){
-        $(".foldable").enableFolding(true, true);
-        $("tbody .trac-toggler a").each(function() {
-          $(this).attr("href", "").click(function() {
-            var a = $(this);
-            a.closest("td").toggleClass("collapsed");
-            a.text(a.text() == "+"? "&ndash;": "+");
-            return false;
-          });
-        });
+        $("h3.foldable").enableFolding(true, true);
+        $("p.foldable").enableFolding(true, false);
         $("thead .trac-toggler a").each(function() {
           $(this).attr("href", "").click(function() {
             var td = $(this).closest("table").find("tbody td");
           <thead>
             <tr>
               <th>
+                Component
                 <span class="trac-toggler">
                   [<a title="Show all descriptions" href="${href.admin('general', 'plugin', show=plugin.name)
                                                             + '#trac-plugin-' + plugin.name}">+</a>]
                   [<a title="Hide all descriptions" href="${href.admin('general', 'plugin')
                                                             + '#trac-plugin-' + plugin.name}">&ndash;</a>]
                 </span>
-                Component
               </th>
               <th class="sel">Enabled</th>
             </tr>
             <tr>
               <td py:with="show_doc = show == plugin.name or show == module_name" id="trac-mod-${module_name}"
                   class="trac-module${not show_doc and ' collapsed' or None}">
-                <p class="trac-heading">
-                  <span py:if="module.description" class="trac-toggler">
-                    [<a title="Toggle the module description"
-                        href="${href.admin('general', 'plugin', show=not show_doc and module_name or None)
-                                + '#trac-mod-' + module_name}">${show_doc and '&ndash;' or '+'}</a>]
-                  </span>
-                  <span class="trac-name">${module_name}.*</span>
+                <p class="trac-heading${module.description and ' foldable' or None}">
+                  <py:choose>
+                    <a py:when="module.description" class="trac-name"
+                       href="${href.admin('general', 'plugin', show=not show_doc and module_name or None)                                                     
+                               + '#trac-mod-' + module_name}">${module_name}.*</a>
+                    <span py:otherwise="" class="trac-name">${module_name}.*</span>
+                  </py:choose>
                   <span py:if="module.summary" class="trac-summary"> &mdash; ${module.summary}</span>
                 </p>
                 <div py:if="module.description" xml:space="preserve">${safe_wiki_to_html(context, module.description)}</div>
             <tr py:for="component_name, component in sorted(module.components.iteritems())">
               <td py:with="show_doc = show == plugin.name or show == component.full_name" id="trac-comp-${component.full_name}"
                   class="trac-component${not show_doc and ' collapsed' or None}">
-                <p class="trac-heading">
-                  <span py:if="component.description" class="trac-toggler">
-                    [<a title="Toggle the component description"
-                        href="${href.admin('general', 'plugin', show=not show_doc and component.full_name or None)
-                                + '#trac-comp-' + component.full_name}">${show_doc and '&ndash;' or '+'}</a>]
-                  </span>
-                  <span class="trac-name">${component_name}</span>
+                <p class="trac-heading${component.description and ' foldable' or None}">
+                  <py:choose>
+                    <a py:when="component.description" class="trac-name"
+                       href="${href.admin('general', 'plugin', show=not show_doc and component.full_name or None)                                             
+                               + '#trac-comp-' + component.full_name}">${component_name}</a>
+                    <span py:otherwise="" class="trac-name">${component_name}</span>
+                  </py:choose>
                   <span py:if="component.summary" class="trac-summary"> &mdash; ${component.summary}</span>
                 </p>
                 <div py:if="component.description" xml:space="preserve">${safe_wiki_to_html(context, component.description)}</div>

trac/htdocs/css/admin.css

  padding: 2px .5em;
  text-align: left;
 }
-.plugin > h3 {
-   margin: .5em 0;
-   color: #bb0000
- }
-.plugin .buttons { margin-top: 0; text-align: right }
-.plugin .uninstall { margin-top: -2.6em; padding: 0 }
-.plugin .summary, .plugin .info { color: #999; font-size: 80%;
-  padding-left: 16px;
-}
-.plugin .summary { margin: -.5em 0 .5em }
+.plugin > h3 { margin: .5em 0; padding-left: 16px; color: #bb0000; }
+.plugin > h3 a { margin-left: -16px; }
+.plugin .buttons { margin-top: 0; text-align: right; }
+.plugin .uninstall { margin-top: -2.6em; padding: 0; }
+.plugin .summary, .plugin .info { padding-left: 16px; color: #999; font-size: 80%; }
+.plugin .summary { margin: -.5em 0 .5em; }
 .plugin .info { margin: 1em 0 .5em; }
 .plugin .info dt { float: left; width: 7em; }
 .plugin .info dd { padding: 0; margin: 0; }
-.plugin .listing { width: 100% }
-.plugin .listing td { background: #fff }
-.trac-heading { margin: 0 }
-.trac-name { font-family: monospace }
-.trac-toggler { float: right; color: #000; font-weight: normal }
+.plugin .listing { width: 100%; }
+.plugin .listing td { background: #fff; }
+.plugin .listing .foldable :link,
+.plugin .listing .foldable :visited { margin-left: -16px; }
+.trac-heading { margin: 0; }
+.trac-name { font-family: monospace; }
+.trac-toggler { color: #000; font-weight: normal; }
 .trac-toggler :link, .trac-toggler :visited,
-.trac-toggler :link:hover, .trac-toggler :visited:hover {
-  border: none;
-  padding: 0;
-}
-.trac-module .trac-heading { color: #888 }
-.trac-module > div { margin-left: 1em }
-.trac-component .trac-heading { padding-left: 2em }
-.trac-component > div { margin-left: 3em }
-.trac-summary { color: #888 }
-table.trac-pluglist td { padding-left: 1em }
+.trac-toggler :link:hover, .trac-toggler :visited:hover { border: none; padding: 0; }
+.trac-module .trac-heading { padding-left: 16px; color: #888; }
+.trac-module > div { margin-left: 1em; }
+.trac-component .trac-heading { margin-left: 2em; padding-left: 16px; }
+.trac-component > div { margin-left: 3em; }
+.trac-summary { color: #888; }
+table.trac-pluglist td { padding-left: 1em; }
 
 /* Perm Panel */
 #permlist div { float: left; min-width: 13em; max-width: 33%;

trac/htdocs/js/folding.js

     
     var count = 1;
     return this.each(function() {
-      var t = $(this).text();
-      $(this).text("");
-      var trigger = $(this).append("<a" + (snap? " id='no" + count + "'": "")
-                                   + " href='#no" + count + "'></a>")
-                           .children();
-      trigger.text(t);
+      // Use first child <a> as a trigger, or generate a trigger from the text
+      var trigger = $(this).children("a").eq(0);
+      if (trigger.length == 0) {
+        trigger = $("<a" + (snap? " id='no" + count + "'": "")
+            + " href='#no" + count + "'></a>");
+        trigger.text($(this).text());
+        $(this).text("");
+        $(this).append(trigger);
+      }
       
       trigger.click(function() {
         var div = $(this.parentNode.parentNode).toggleClass("collapsed");