Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixes correct descendants language

  • Loading branch information...
commit 2b30ead42b36cbd2589ba90d81919fb7713089e9 1 parent 6e3b046
@digi604 digi604 authored
View
6 cms/admin/pageadmin.py
@@ -119,13 +119,13 @@ def get_urls(self):
pat(r'^([0-9]+)/copy-page/$', self.copy_page),
pat(r'^([0-9]+)/copy-language/$', self.copy_language),
pat(r'^([0-9]+)/dialog/copy/$', get_copy_dialog), # copy dialog
- pat(r'^([0-9]+)/descendants/$', self.descendants), # menu html for page descendants
pat(r'^([0-9]+)/change-navigation/$', self.change_innavigation),
pat(r'^([0-9]+)/jsi18n/$', self.redirect_jsi18n),
pat(r'^([0-9]+)/permissions/$', self.get_permissions),
pat(r'^([0-9]+)/undo/$', self.undo),
pat(r'^([0-9]+)/redo/$', self.redo),
pat(r'^([0-9]+)/change_template/$', self.change_template),
+ pat(r'^([0-9]+)/([a-z\-]+)/descendants/$', self.descendants), # menu html for page descendants
pat(r'^([0-9]+)/([a-z\-]+)/edit-field/$', self.edit_title_fields),
pat(r'^([0-9]+)/([a-z\-]+)/publish/$', self.publish_page),
pat(r'^([0-9]+)/([a-z\-]+)/unpublish/$', self.unpublish),
@@ -1216,7 +1216,7 @@ def change_innavigation(self, request, page_id):
return admin_utils.render_admin_menu_item(request, page)
return HttpResponseForbidden(force_unicode(_("You do not have permission to change this page's in_navigation status")))
- def descendants(self, request, page_id):
+ def descendants(self, request, page_id, language):
"""
Get html for descendants of given page
Used for lazy loading pages in cms.changelist.js
@@ -1226,7 +1226,7 @@ def descendants(self, request, page_id):
"""
page = get_object_or_404(Page, pk=page_id)
return admin_utils.render_admin_menu_item(request, page,
- template="admin/cms/page/tree/lazy_menu.html")
+ template="admin/cms/page/tree/lazy_menu.html", language=language)
def add_page_type(self, request):
site = Site.objects.get_current()
View
4 cms/static/cms/js/modules/cms.changelist.js
@@ -469,8 +469,8 @@ $(document).ready(function () {
// the other click event on this element to fire
jtarget.addClass("loading");
var pageId = $(jtarget).attr("id").split("page_")[1];
-
- $.get(admin_base_url + "cms/page/" + pageId + "/descendants/", {}, function(r, status) {
+ var language = $(jtarget).children('div.cont').children('div.col1').children('.title').attr('lang')
+ $.get(admin_base_url + "cms/page/" + pageId + "/" + language + "/descendants/", {}, function(r, status) {
jtarget.children('ul').append(r);
// show move targets if needed
if($('span.move-target-container:visible').length > 0) {
View
4 cms/templates/admin/cms/page/tree/menu_item.html
@@ -4,10 +4,10 @@
<div class="col1">
{% if has_change_permission %}
{% language preview_language %}
- <a href="{{ page.id }}/{{ preview_language }}/preview/" target="_parent" class="title" {% if cl.is_popup %}onclick="opener.dismissRelatedLookupPopup(window, {{ page.id }}); return false;" title="{% trans "select this page" %}"{% else %}title="{% trans "edit this page" %}"{% endif %}>{{ page.get_admin_tree_title }}</a>
+ <a href="{{ page.id }}/{{ preview_language }}/preview/" target="_parent" class="title" lang="{{ preview_language }}" {% if cl.is_popup %}onclick="opener.dismissRelatedLookupPopup(window, {{ page.id }}); return false;" title="{% trans "select this page" %}"{% else %}title="{% trans "edit this page" %}"{% endif %}>{{ page.get_admin_tree_title }}</a>
{% endlanguage %}
{% else %}
- <span class="title">{{ page.get_admin_tree_title }}</span>
+ <span class="title" lang="{{ preview_language }}">{{ page.get_admin_tree_title }}</span>
{% endif %}
</div>
<div class="col2">
View
10 cms/utils/admin.py
@@ -15,6 +15,7 @@
from cms.utils import get_language_list
from cms.utils import get_cms_setting
from cms.constants import PUBLISHER_STATE_PENDING, PUBLISHER_STATE_DIRTY
+from django.utils.translation.trans_real import get_language
NOT_FOUND_RESPONSE = "NotFound"
DJANGO_1_4 = LooseVersion(django.get_version()) < LooseVersion('1.5')
@@ -37,7 +38,7 @@ def jsonify_request(response):
}
-def get_admin_menu_item_context(request, page, filtered=False):
+def get_admin_menu_item_context(request, page, filtered=False, language=None):
"""
Used for rendering the page tree, inserts into context everything what
we need for single item
@@ -74,12 +75,15 @@ def get_admin_menu_item_context(request, page, filtered=False):
has_add_on_same_level_permission = permissions.has_generic_permission(page.parent_id, request.user, "add",
page.site)
#has_add_on_same_level_permission = has_add_page_on_same_level_permission(request, page)
+ if not language:
+ language = get_language()
context = {
'page': page,
'site': site,
'lang': lang,
'filtered': filtered,
'metadata': metadata,
+ 'preview_language': language,
'has_change_permission': page.has_change_permission(request),
'has_publish_permission': page.has_publish_permission(request),
'has_delete_permission': page.has_delete_permission(request),
@@ -91,7 +95,7 @@ def get_admin_menu_item_context(request, page, filtered=False):
return context
-def render_admin_menu_item(request, page, template=None):
+def render_admin_menu_item(request, page, template=None, language=None):
"""
Renders requested page item for the tree. This is used in case when item
must be reloaded over ajax.
@@ -110,7 +114,7 @@ def render_admin_menu_item(request, page, template=None):
})
filtered = 'filtered' in request.REQUEST
- context.update(get_admin_menu_item_context(request, page, filtered))
+ context.update(get_admin_menu_item_context(request, page, filtered, language))
# add mimetype to help out IE
if DJANGO_1_4:
return render_to_response(template, context, mimetype="text/html; charset=utf-8")
Please sign in to comment.
Something went wrong with that request. Please try again.