Commits

David Jean Louis  committed 71df446

better dashboard panel

  • Participants
  • Parent commits 7dbc244

Comments (0)

Files changed (3)

File admin_tools/dashboard/templates/dashboard/dashboard.html

 {% load i18n dashboard_tags %}
 {% if dashboard.title %}
-<h1>{{ dashboard.title }}</h1>
+<h1 class="dashboard-title">{{ dashboard.title }}</h1>
 {% endif %}
 
 <!-- javascript code related to the admin_tools dashboard -->
 <!-- admin_tools dashboard -->
 <!-- todo: refactor the panel and style it -->
 <div id="dashboard-panel">
-    <h3><a href="#">{% trans "Add modules to the dashboard" %}</a></h3>
+    <h3><a href="#">{% trans "Modules" %}</a></h3>
     <ul>
         {% spaceless %}
         {% for module in dashboard %}

File admin_tools/media/admin_tools/css/dashboard.css

     clear: both;
 }
 
+h1.dashboard-title {
+    float: left;
+}
+
 #dashboard-panel {
+    margin: 0 10px 0 0;
     float: right;
-    margin-top: -35px;
+}
+
+#dashboard-panel h3 a {
+    padding: 5px;
+    min-width: 100px;
+    display: block;
+    text-align: center;
+    border: 1px solid #e5e5e5;
+    -moz-border-radius: 6px;
+    -webkit-border-radius: 6px;
 }
 
 #dashboard-panel ul {
     display: none;
     position: absolute;
     top: auto;
-    left: auto;
+    right: 25px;
     margin-top: -1px;
 }
 

File admin_tools/media/admin_tools/js/jquery/jquery.dashboard.js

                 }
             });
         }
+        // if there's no element in the panel, hide it
+        if (!$('#' + options.panel_id).find('li').length) {
+            $('#' + options.panel_id).hide();
+        }
     };
 
     var _set_draggable = function(elt, options) {
             existing.parent().show();
         }
         elt.fadeOut('fast');
+        $('#' + options.panel_id).show();
         if (save_preference) {
             _set_preference('disabled', elt.attr('id'), true);
         }
 
     var _add_element = function(elt, options, save_preference) {
         panel_elt = $('#'+options.panel_id).find('li a[rel='+elt.attr('id')+']');
-        panel_elt.parent().hide();
+        panel_elt.parent().remove();
         elt.removeClass('disabled');
         elt.fadeIn('fast');
         if (save_preference) {
             _set_preference('disabled', elt.attr('id'), false);
         }
+        // if there's no element in the panel, hide it
+        if (!$('#' + options.panel_id).find('li').length) {
+            $('#' + options.panel_id).hide();
+        }
     };
 
     var _get_preference = function(cat, id, defaultval) {