Commits

Anonymous committed 7be2c7d

template review

Comments (0)

Files changed (8)

admin_tools/dashboard/modules.py

 
     def __init__(self, **kwargs):
         super(LinkList, self).__init__(**kwargs)
-        self.title = kwargs.get('title', _('Links'))
+        self.title = kwargs.get('title')
         self.template = kwargs.get('template',
                                    'admin_tools/dashboard/modules/link_list.html')
         self.layout = kwargs.get('layout', 'stacked')

admin_tools/dashboard/templates/admin/app_index.html

     <div id="breadcrumbs"><a href="../">
     {% trans "Home" %}</a> &rsaquo;
     {% for app in app_list %}
-        {% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}
+        {% trans app.name %}
     {% endfor %}
     </div>
     {% endblock %}

admin_tools/dashboard/templates/admin_tools/dashboard/dashboard.txt

 
         # append a model list module
         self.children.append(modules.ModelList(
-            title=self.app_title,
+            title=_(self.app_title),
             models=self.models,
         ))
 

admin_tools/dashboard/templates/admin_tools/dashboard/modules/app_list.html

 {% extends "admin_tools/dashboard/module.html" %}
 {% load i18n %}
 {% block module_content %}
-{% if subindex %}
     <div class="module {% for item in module.css_classes %}{{ item }} {% endfor %}">
-        {% if module.title %}
+    
+    {% if module.title %}
+        {% if subindex %}
             <h3>{{ module.title }}</h3>
-        {% endif %}
-{% else %}
-    <div class="group {% for item in module.css_classes %}{{ item }} {% endfor %}">
-        {% if module.title %}
+        {% else %}
             <h2>{{ module.title }}</h2>
         {% endif %}
-{% endif %}
+    {% endif %}
     
 {% spaceless %}
         {% if module.pre_content %}

admin_tools/dashboard/templates/admin_tools/dashboard/modules/model_list.html

 {% extends "admin_tools/dashboard/module.html" %}
 {% load i18n %}
 {% block module_content %}
-
-{% if subindex %}
     <div class="module {% for item in module.css_classes %}{{ item }} {% endfor %}">
         {% if module.title %}
-            <h3>{{ module.title }}</h3>
+            {% if subindex %}
+                <h3>{{ module.title }}</h3>
+            {% else %}
+                <h2>{{ module.title }}</h2>
+            {% endif %}
         {% endif %}
-{% else %}
-    <div class="module {% for item in module.css_classes %}{{ item }} {% endfor %}">
-        {% if module.title %}
-            <h2>{{ module.title }}</h2>
-        {% endif %}
-{% endif %}
-            
-            {% for child in module.children %}
-                <div class="row">
-                    {% if child.change_url %}<a href="{{ child.change_url }}">{{ child.title }}</a>{% else %}{{ child.title }}{% endif %}
+    
+        {% for child in module.children %}
+            <div class="row">
+                {% if child.change_url %}<a href="{{ child.change_url }}">{{ child.title }}</a>{% else %}{{ child.title }}{% endif %}
 
-                    {% if child.add_url or child.change_url %}
-                        <ul class="actions">
-                            {% if child.add_url %}<li class="add-link"><a href="{{ child.add_url }}">{% trans "Add" %}</a></li>{% endif %}
-                            {% if child.change_url %}<li class="change-link"><a href="{{ child.change_url }}">{% trans "Change" %}</a></li>{% endif %}
-                        </ul>
-                    {% endif %}
-                </div>
-            {% endfor %}
-        </div>
+                {% if child.add_url or child.change_url %}
+                    <ul class="actions">
+                        {% if child.add_url %}<li class="add-link"><a href="{{ child.add_url }}">{% trans "Add" %}</a></li>{% endif %}
+                        {% if child.change_url %}<li class="change-link"><a href="{{ child.change_url }}">{% trans "Change" %}</a></li>{% endif %}
+                    </ul>
+                {% endif %}
+            </div>
+        {% endfor %}
+    </div>
 {% endblock %}

admin_tools/dashboard/utils.py

         
         for key in dashboard_cls:
             admin_site_mod, admin_site_inst = key.rsplit('.', 1)
-            admin_url = reverse('%s:index' % admin_site_inst)
+            admin_site_mod = import_module(admin_site_mod)
+            admin_site = getattr(admin_site_mod, admin_site_inst)
+            admin_url = reverse('%s:index' % admin_site.name)
             if curr_url.startswith(admin_url):
                 mod, inst = dashboard_cls[key].rsplit('.', 1)
                 mod = import_module(mod)
         
         for key in dashboard_cls:
             admin_site_mod, admin_site_inst = key.rsplit('.', 1)
-            admin_url = reverse('%s:index' % admin_site_inst)
+            admin_site_mod = import_module(admin_site_mod)
+            admin_site = getattr(admin_site_mod, admin_site_inst)
+            admin_url = reverse('%s:index' % admin_site.name)
             if curr_url.startswith(admin_url):
                 mod, inst = dashboard_cls[key].rsplit('.', 1)
                 mod = import_module(mod)

admin_tools/utils.py

     
     if type(dashboard_cls) is types.DictType:
         if context:
-            curr_url = context.get('request').META['PATH_INFO']
-        else:
-            curr_url = request.META['PATH_INFO']
+            request = context.get('request')
+        
+        curr_url = request.META['PATH_INFO']
         
         for key in dashboard_cls:
             mod, inst = key.rsplit('.', 1)
-            admin_url = reverse('%s:index' % inst)
+            mod = import_module(mod)
+            admin_site = getattr(mod, inst)
+            admin_url = reverse('%s:index' % admin_site.name)
             if curr_url.startswith(admin_url):
-                mod = import_module(mod)
-                return getattr(mod, inst)
+                return admin_site
     else:
         return admin.site