1. Gustavo Picon
  2. django-treebeard


Jaap Roes  committed 048fcb8

Load the js translation bundle in treebeard admin. Small cleanup here and there.

  • Participants
  • Parent commits 95ffea0
  • Branches default

Comments (0)

Files changed (4)

File treebeard/admin.py

View file
  • Ignore whitespace
         new_urls = patterns('',
+            url(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', {
+                'packages': ('treebeard',)}),
         return new_urls + urls

File treebeard/forms.py

View file
  • Ignore whitespace
 "Forms for treebeard."
-from django.forms.models import model_to_dict, ErrorList, BaseModelForm
 from django import forms
+from django.forms.models import BaseModelForm, ErrorList, model_to_dict
+from django.utils.safestring import mark_safe
 from django.utils.translation import ugettext_lazy as _
-from django.utils.safestring import mark_safe
 class MoveNodeForm(forms.ModelForm):

File treebeard/static/treebeard/treebeard-admin.css

View file
  • Ignore whitespace
 #roots li input {
 margin: 0 5px;
-.drag-handler {
+.oder-grabber {
     width: 1.5em;
+    text-align: center;
 .drag-handler span {
 width: 16px;

File treebeard/templatetags/admin_tree.py

View file
  • Ignore whitespace
 from os.path import join
+from django.conf import settings
+from django.contrib.admin.templatetags.admin_list import _boolean_icon, result_headers, \
+    result_hidden_fields
+from django.contrib.admin.util import display_for_field, lookup_field
+from django.contrib.admin.views.main import EMPTY_CHANGELIST_VALUE
+from django.core.exceptions import ObjectDoesNotExist
 from django.db import models
-from django.conf import settings
-from django.contrib.admin.views.main import EMPTY_CHANGELIST_VALUE
 from django.template import Library
-from django.core.exceptions import ObjectDoesNotExist
-from django.contrib.admin.templatetags.admin_list import result_hidden_fields, result_headers, _boolean_icon
-from django.contrib.admin.util import lookup_field, display_for_field
+from django.utils.encoding import force_unicode, smart_unicode
+from django.utils.html import conditional_escape, escape
 from django.utils.safestring import mark_safe
-from django.utils.encoding import smart_unicode, force_unicode
-from django.utils.html import escape, conditional_escape
+from django.utils.translation import ugettext_lazy as _
 register = Library()
             spacer = '<span class="spacer">&nbsp;</span>' * (result.get_depth() - 1) if first else ''
             # This shows a collapse or expand link for nodes with childs
-            collapse = '<a href="#" title="" class="collapse expanded">-</a>' if result.get_children_count() > 0 else '<span class="collapse">&nbsp;</span>'
+            collapse = '<a href="#" class="collapse expanded">-</a>' if result.get_children_count() > 0 else '<span class="collapse">&nbsp;</span>'
             # Add a <td/> before the first col to show the drag handler
             drag_handler = ''
         'text': '+',
         'sortable': True,
         'url': request.path,
-        'tooltip': u'Return to ordered Tree',
+        'tooltip': _(u'Return to ordered tree'),
+        'class_attrib': mark_safe(' class="oder-grabber"')
     return {
         'filtered': not check_empty_dict(request.GET),
     jquery_ui = join(path, 'treebeard', 'jquery-ui-1.8.5.custom.min.js')
-    scripts = [SCRIPT_HTML % js_file, JQUERY_UI % jquery_ui]
+    scripts = [SCRIPT_HTML % 'jsi18n', SCRIPT_HTML % js_file, JQUERY_UI % jquery_ui]
     return ''.join(scripts)