Author: mbonetti
Date: Tue May  5 06:17:15 2009
New Revision: 502

Modified:
    branches/electron/pages/admin/__init__.py
    branches/electron/pages/media/pages/css/pages.css
    branches/electron/pages/templates/admin/pages/page/menu.html
    branches/electron/pages/templatetags/pages_tags.py

Log:
dislpay all languages in the tree, and highlite those which have a  
translation

Modified: branches/electron/pages/admin/__init__.py
==============================================================================
--- branches/electron/pages/admin/__init__.py   (original)
+++ branches/electron/pages/admin/__init__.py   Tue May  5 06:17:15 2009
@@ -356,7 +356,7 @@
          context = {
              'name': _("page"),
              'pages': Page.objects.root().order_by("tree_id"),
-            'opts': self.model._meta,
+            'opts': self.model._meta
          }
          context.update(extra_context or {})
          change_list = self.changelist_view(request, context)

Modified: branches/electron/pages/media/pages/css/pages.css
==============================================================================
--- branches/electron/pages/media/pages/css/pages.css   (original)
+++ branches/electron/pages/media/pages/css/pages.css   Tue May  5 06:17:15  
2009
@@ -281,6 +281,9 @@
      text-transform: uppercase;
      background: none;
  }
+.change-list .language-cell .translated {
+    text-decoration: underline;
+}
  .change-list .language-cell .changelink:hover {
      background: url(../images/icons/edit.gif) right 0.2em no-repeat;
  }

Modified: branches/electron/pages/templates/admin/pages/page/menu.html
==============================================================================
--- branches/electron/pages/templates/admin/pages/page/menu.html        
(original)
+++ branches/electron/pages/templates/admin/pages/page/menu.html        Tue May 
 5  
06:17:15 2009
@@ -32,7 +32,11 @@
          </th>
          <td class="language-cell">
              <ul class="popup">
-                {% for lang in page.get_languages %}<li class="{% if not  
forloop.last %}last{% endif %}"><a href="{{ url }}{{ page.id  
}}/?language={{ lang }}" class="changelink">{{ lang }}<span class="help">{%  
trans "edit the page in this language" %}</span></a></li>{% endfor %}
+                {% for lang in page_languages %}
+                <li class="{% if not forloop.last %}last{% endif %}">
+                    <a href="{{ url }}{{ page.id }}/?language={{ lang.0  
}}" class="changelink{% if page|has_content_in:lang.0 %} translated{%  
endif %}">{{ lang.0 }}<span class="help">{% trans "edit the page in" %}  
{{lang.1}}</span></a>
+                </li>
+                {% endfor %}
              </ul>
          </td>
          <td class="publish-cell">

Modified: branches/electron/pages/templatetags/pages_tags.py
==============================================================================
--- branches/electron/pages/templatetags/pages_tags.py  (original)
+++ branches/electron/pages/templatetags/pages_tags.py  Tue May  5 06:17:15  
2009
@@ -48,6 +48,7 @@
              if page.id in ids:
                  expanded = True

+    page_languages = settings.PAGE_LANGUAGES
      has_permission = page.has_page_permission(request)

      return locals()
@@ -58,6 +59,8 @@
      return page.has_page_permission(request)
  register.filter(has_permission)

+
+
  def get_content(context, page, content_type, lang, fallback=True):
      request = context.get('request', False)
      if not request or not page:
@@ -148,6 +151,7 @@
  do_get_content = register.tag('get_content', do_get_content)


+
  def show_absolute_url(context, page, lang=None):
      """Show the url of a page in the right language

@@ -190,6 +194,11 @@
      return {'revisions':revisions[0:10]}
  show_revisions = register.inclusion_tag('pages/revisions.html',
                                          takes_context=True)(show_revisions)
+
+
+def has_content_in(page,language):
+    return Content.objects.filter(page=page,language=language).count() > 0
+register.filter(has_content_in)

  def do_placeholder(parser, token):
      """

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to