Repository: django-cms/django-cms

Issue:
tree view sidebar take current language if klick on title



Discussion:
also highlight current page in tree view...


Resolving patch:
diff --git a/cms/admin/change_list.py b/cms/admin/change_list.py
--- a/cms/admin/change_list.py
+++ b/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:
diff --git a/cms/admin/pageadmin.py b/cms/admin/pageadmin.py
--- a/cms/admin/pageadmin.py
+++ b/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,
diff --git a/cms/cms_toolbar.py b/cms/cms_toolbar.py
--- a/cms/cms_toolbar.py
+++ b/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
@@ -140,7 +140,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()
@@ -249,7 +249,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


Test patch: