Commits

Stefan Zimmermann  committed d5168b4 Merge

merge

  • Participants
  • Parent commits 9cae251, 522004b

Comments (0)

Files changed (7)

File admin_tools/dashboard/static/admin_tools/js/jquery/jquery.dashboard.js

         var start = 0;
         var stop = 0;
         var last_stop = 0;
-        if (options.columns != sizes.length) {
-            // don't break layout if columns count changed
+        // don't break layout if columns count or elts count changed
+        var elts_count = 0;
+        for (var i in sizes) {
+            elts_count += sizes[i];
+        }
+        if (options.columns != sizes.length || elts_count != elts.length) {
+            // reset sizes so we don't break
             sizes = [];
         }
         for (var i = 0; i < options.columns; i++) {

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

+{% load i18n %}
 {% if not module.is_empty %}
     <div id="module_{{ module.id }}" class="{{ module.render_css_classes }}">
-        {% if module.show_title %}<h2>{{ module.title }}</h2>{% endif %}
+        {% if module.show_title %}<h2>{% trans module.title %}</h2>{% endif %}
         <div class="dashboard-module-content">
             {% spaceless %}
             {% if module.pre_content %}

File admin_tools/dashboard/utils.py

 
 def _get_dashboard_cls(dashboard_cls, context):
     if type(dashboard_cls) is dict:
-        curr_url = context.get('request').META['PATH_INFO']
+        curr_url = context.get('request').path
         for key in dashboard_cls:
             admin_site_mod, admin_site_inst = key.rsplit('.', 1)
             admin_site_mod = import_module(admin_site_mod)

File admin_tools/grappelli/templates/admin_tools/dashboard/module.html

+{% load i18n %}
 {% if not module.is_empty %}
     <div id="module_{{ module.id }}" class="module {{ module.render_css_classes|cut:'dashboard-module' }}">
-        {% if module.show_title %}<h2>{{ module.title }}</h2>{% endif %}
+        {% if module.show_title %}<h2>{% trans module.title %}</h2>{% endif %}
         <div>
 <!-- class="dashboard-module-content"> -->
             {% spaceless %}

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

 var init_dashboard = function(id, columns, preferences, url) {
-    $('#'+id).dashboard({
+    jQuery('#'+id).dashboard({
         'columns': columns,
         'load_preferences_function': function(options) {
             return preferences;
             jQuery.post(url, { data: JSON.stringify(preferences) });
         }
     });
-    $(".group-tabs").tabs();
-    $(".group-accordion").accordion({header: '.group-accordion-header'});
+    jQuery(".group-tabs").tabs();
+    jQuery(".group-accordion").accordion({header: '.group-accordion-header'});
 };

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

         var start = 0;
         var stop = 0;
         var last_stop = 0;
-        if (options.columns != sizes.length) {
-            // don't break layout if columns count changed
+        // don't break layout if columns count or elts count changed
+        var elts_count = 0;
+        for (var i in sizes) {
+            elts_count += sizes[i];
+        }
+        if (options.columns != sizes.length || elts_count != elts.length) {
+            // reset sizes so we don't break
             sizes = [];
         }
         for (var i = 0; i < options.columns; i++) {

File admin_tools/utils.py

     if type(dashboard_cls) is dict:
         if context:
             request = context.get('request')
-        curr_url = request.META['PATH_INFO']
+        curr_url = request.path
         for key in dashboard_cls:
             mod, inst = key.rsplit('.', 1)
             mod = import_module(mod)
         for item in included:
             model, perms = item
             if fnmatch(full_name(model), pattern):
-                result.remove(item)
+                try:
+                    result.remove(item)
+                except ValueError:  # if the item was already removed skip
+                    pass
     return result