Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixes the backend part

  • Loading branch information...
commit 019c21cda6be865e51261a6559794efacaaeb9d9 1 parent 28b70a4
@digi604 authored
View
6 cms/admin/change_list.py
@@ -62,6 +62,10 @@ def __init__(self, request, *args, **kwargs):
def get_query_set(self, request=None):
if COPY_VAR in self.params:
del self.params[COPY_VAR]
+ if 'language' in self.params:
+ del self.params['language']
+ if 'page_id' in self.params:
+ del self.params['page_id']
if django.VERSION[1] > 3:
qs = super(CMSChangeList, self).get_query_set(request).drafts()
else:
@@ -82,7 +86,7 @@ def get_query_set(self, request=None):
def is_filtered(self):
from cms.utils.plugins import SITE_VAR
lookup_params = self.params.copy() # a dictionary of the query string
- for i in (ALL_VAR, ORDER_VAR, ORDER_TYPE_VAR, SEARCH_VAR, IS_POPUP_VAR, SITE_VAR):
+ for i in (ALL_VAR, ORDER_VAR, ORDER_TYPE_VAR, SEARCH_VAR, IS_POPUP_VAR, SITE_VAR, 'language', 'page_id'):
if i in lookup_params:
del lookup_params[i]
if not lookup_params.items() and not self.query:
View
3  cms/admin/pageadmin.py
@@ -20,7 +20,7 @@
from django.shortcuts import render_to_response, get_object_or_404
from django.template.context import RequestContext
from django.template.defaultfilters import escape
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import ugettext_lazy as _, get_language
from django.utils.decorators import method_decorator
from django.views.decorators.http import require_POST
@@ -636,6 +636,7 @@ def changelist_view(self, request, extra_context=None):
'has_add_permission': self.has_add_permission(request),
'root_path': reverse('admin:index'),
'app_label': app_label,
+ 'preview_language': request.GET.get('language', get_language()),
'CMS_MEDIA_URL': get_cms_setting('MEDIA_URL'),
'CMS_PERMISSION': get_cms_setting('PERMISSION'),
'DEBUG': settings.DEBUG,
View
9 cms/cms_toolbar.py
@@ -101,7 +101,7 @@ def add_admin_menu(self):
for site in sites_queryset:
sites_menu.add_link_item(site.name, url='http://%s' % site.domain,
active=site.pk == self.current_site.pk)
- # admin
+ # admin
admin_menu.add_sideframe_item(_('Administration'), url=reverse('admin:index'))
admin_menu.add_break(ADMINISTRATION_BREAK)
# cms users
@@ -138,7 +138,7 @@ def populate(self):
self.change_admin_menu()
if self.page:
self.add_page_menu()
- # history menu
+ # history menu
if self.page and self.toolbar.edit_mode:
self.add_history_menu()
self.change_language_menu()
@@ -247,7 +247,10 @@ def change_language_menu(self):
def change_admin_menu(self):
admin_menu = self.toolbar.get_or_create_menu(ADMIN_MENU_IDENTIFIER)
# cms page admin
- admin_menu.add_sideframe_item(_('Pages'), url=reverse("admin:cms_page_changelist"), position=0)
+ url = "%s?language=%s" % (reverse("admin:cms_page_changelist"), self.toolbar.language)
+ if self.page:
+ url += "&page_id=%s" % self.page.pk
+ admin_menu.add_sideframe_item(_('Pages'), url=url, position=0)
def add_page_menu(self):
# menu for current page
View
4 cms/templates/admin/cms/page/tree/menu_item.html
@@ -3,7 +3,9 @@
<div class="cont {{ css_class }}">
<div class="col1">
{% if has_change_permission %}
- <a href="{{ page.id }}/{{ lang }}/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>
+ {% 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>
+ {% endlanguage %}
{% else %}
<span class="title">{{ page.get_admin_tree_title }}</span>
{% endif %}
Please sign in to comment.
Something went wrong with that request. Please try again.