8000 Fixes/use svg icons by jrief · Pull Request #6455 · django-cms/django-cms · GitHub
[go: up one dir, main page]

Skip to content

Fixes/use svg icons #6455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
163baaf
Added 3.6 CHANGELOG
czpython Feb 6, 2018
ed0c722
Removed backwards compatible shims from 3.5
czpython Feb 6, 2018
db8b1ef
Removed the cms moderator command
czpython Feb 6, 2018
967b838
Dropped support for Django < 1.11
czpython Feb 6, 2018
b1d1d50
Removed the translatable content get / set methods from CMSPlugin model
czpython Feb 6, 2018
9988097
Removed signal handlers for Page, Title, Placeholder and CMSPlugin mo…
czpython Feb 8, 2018
0b930e5
Updated links to contributing docs
czpython Apr 24, 2018
c5780a0
Fixed #6340 -- Reorder models to support dumpdata (#6341)
heppstux Apr 25, 2018
fe29ed6
Fixed #6336 -- request.current_page should always respect draft/live …
8000 czpython May 1, 2018
dc1c19e
Refs #6185 -- Moved meta description length restriction from model to…
chaosk May 7, 2018
6d2d14b
Fixed #6353 -- Removed extra quotation mark from button sideframe tem…
vxsx May 9, 2018
74ca478
Fixed #6002 -- Prevent users from moving homepage under another page…
vaquer May 15, 2018
91b799e
Updated links in README to use https where possible (#6375)
Jamim May 17, 2018
e9c1627
Fixed a bug where structureboard tried to preload markup with legacy …
vxsx May 28, 2018
61dfbdb
Fixed a bug with incorrect move plugin handling
vxsx Apr 13, 2018
591efd6
Fixed some spelling and build issues (#6391)
evildmp May 31, 2018
32d9b73
Fixes/improves introductory tutorial (#6390)
evildmp May 31, 2018
d5e25f4
Cleaned up apphooks documentation (#6397)
evildmp May 31, 2018
4205eca
Improved toolbar tutorial (#6400)
evildmp Jun 1, 2018
9381429
Docs tutorials small fixes (#6405)
evildmp Jun 5, 2018
33bf57d
Update 03-integrating_applications.rst
evildmp Jun 5, 2018
25a6e11
Docs tutorials small fixes (#6408)
evildmp Jun 5, 2018
675de13
Fixed #6346 -- Set xframe options exempt on cached response (#6403)
czpython Jun 10, 2018
899a3d8
Fixed #6335 -- Global permissions take precedence over cached page pe…
czpython Jun 12, 2018
0507212
Update apphooks.rst (#6255)
Chematronix Jun 12, 2018
deeccbc
Added page_title parameter to create_page API function(#6122)
sir-sigurd Jun 15, 2018
a210eb7
Fixed a bug with not enabling plugins that are not rendered in content
vxsx May 29, 2018
09a8242
Updated apphooks (how-to and introduction) (#6409)
evildmp Jun 19, 2018
8964d77
Fixed a bug with expanding static placeholder by clicking on "Expand …
vxsx Jun 18, 2018
50dee52
Introduced Django 2.0 & 2.1 support (#6402)
Jul 13, 2018
0b47198
use SVG icons
jrief Jul 23, 2018
a549262
add release notes
jrief Jul 23, 2018
fedae1c
Move release notes to changelog
jrief Jul 24, 2018
b1eb9ab
add compatibility layer for Django-1.8
jrief Jul 24, 2018
28b7715
Merge branch 'develop' into fixes/use-svg-icons
jrief Jul 24, 2018
a998160
describe change fix
jrief Jul 24, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed #6336 -- request.current_page should always respect draft/live …
…state (#6350)
  • Loading branch information
czpython authored May 1, 2018
commit fe29ed60d130adc7f6df026da6893c9b4ca9a8b5
6 changes: 5 additions & 1 deletion cms/appresolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from cms.models.pagemodel import Page
from cms.utils import get_current_site
from cms.utils.i18n import get_language_list
from cms.utils.moderator import use_draft

APP_RESOLVERS = []

Expand All @@ -37,6 +38,9 @@ def applications_page_check(request, current_page=None, path=None):
for lang in get_language_list():
if path.startswith(lang + "/"):
path = path[len(lang + "/"):]

use_public = not use_draft(request)

for resolver in APP_RESOLVERS:
try:
page_id = resolver.resolve_page_id(path)
Expand All @@ -45,7 +49,7 @@ def applications_page_check(request, current_page=None, path=None):
# If current page was matched, then we have some override for
# content from cms, but keep current page. Otherwise return page
# to which was application assigned.
return page
return page if use_public else page.publisher_public
except Resolver404:
# Raised if the page is not managed by an apphook
pass
Expand Down
7 changes: 7 additions & 0 deletions cms/test_utils/project/sampleapp/cms_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
from .models import SampleAppConfig


class AppWithNoMenu(CMSApp):
app_name = 'app_with_no_menu'

def get_urls(self, page=None, language=None, **kwargs):
return ["cms.test_utils.project.sampleapp.urls"]


class SampleApp(CMSApp):
name = _("Sample App")
permissions = True
Expand Down
99 changes: 96 additions & 3 deletions cms/tests/test_apphooks.py
8000
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from cms.appresolver import applications_page_check, clear_app_resolvers, get_app_patterns
from cms.constants import PUBLISHER_STATE_DIRTY
from cms.models import Title, Page
from cms.middleware.page import get_page
from cms.test_utils.project.placeholderapp.models import Example1
from cms.test_utils.testcases import CMSTestCase
from cms.tests.test_menu_utils import DumbPageLanguageUrl
Expand Down Expand Up @@ -325,20 +326,33 @@ def test_get_page_for_apphook_on_preview_or_edit(self):

public_page = page.get_public_object()

with force_language("en"):
path = reverse('sample-settings')
request = self.get_request(path)
request.LANGUAGE_CODE = 'en'
attached_to_page = applications_page_check(request, path=path[1:]) # strip leading slash
self.assertEqual(attached_to_page.pk, public_page.pk)

with force_language("de"):
path = reverse('sample-settings')
request = self.get_request(path)
request.LANGUAGE_CODE = 'de'
attached_to_page = applications_page_check(request, path=path[1:]) # strip leading slash
self.assertEqual(attached_to_page.pk, public_page.pk)

with self.login_user_context(superuser):
with force_language("en"):
path = reverse('sample-settings')
request = self.get_request(path + '?%s' % get_cms_setting('CMS_TOOLBAR_URL__EDIT_ON'))
request.LANGUAGE_CODE = 'en'
attached_to_page = applications_page_check(request, path=path[1:]) # strip leading slash
response = self.client.get(path+"?edit")
self.assertContains(response, '?redirect=')
self.assertEqual(attached_to_page.pk, page.pk)
with force_language("de"):
path = reverse('sample-settings')
request = self.get_request(path + '?%s' % get_cms_setting('CMS_TOOLBAR_URL__EDIT_ON'))
request.LANGUAGE_CODE = 'de'
attached_to_page = applications_page_check(request, path=path[1:]) # strip leading slash
self.assertEqual(attached_to_page.pk, public_page.pk)
self.assertEqual(attached_to_page.pk, page.pk)

@override_settings(ROOT_URLCONF='cms.test_utils.project.second_urls_for_apphook_tests')
def test_get_root_page_for_apphook_with_instance_namespace(self):
Expand Down Expand Up @@ -869,6 +883,85 @@ def test_get_menus(self):

self.apphook_clear()

@override_settings(
CMS_APPHOOKS=['cms.test_utils.project.sampleapp.cms_apps.AppWithNoMenu'],
)
def test_menu_node_is_selected_on_app_root(self):
"""
If a user requests a page with an apphook,
the menu should mark the node for that page as selected.
"""
defaults = {
'language': 'en',
'published': True,
'in_navigation': True,
'template': 'nav_playground.html',
}
homepage = create_page('EN-P1', **defaults)
homepage.set_as_homepage()
app_root = create_page('EN-P2', apphook='AppWithNoMenu', apphook_namespace='app_with_no_menu', **defaults)

# Public version
request = self.get_request(self.get_edit_on_url('/en/en-p2/'))
request.current_page = get_page(request)
menu_nodes = menu_pool.get_renderer(request).get_nodes()
self.assertEqual(len(menu_nodes), 2)
self.assertEqual(menu_nodes[0].id, homepage.publisher_public_id)
self.assertEqual(menu_nodes[0].selected, False)
self.assertEqual(menu_nodes[1].id, app_root.publisher_public_id)
self.assertEqual(menu_nodes[1].selected, True)

# Draft version
with self.login_user_context(self.get_superuser()):
request = self.get_request(self.get_edit_on_url('/en/en-p2/'))
request.current_page = get_page(request)
menu_nodes = menu_pool.get_renderer(request).get_nodes()
self.assertEqual(len(menu_nodes), 2)
self.assertEqual(menu_nodes[0].id, homepage.pk)
self.assertEqual(menu_nodes[0].selected, False)
self.assertEqual(menu_nodes[1].id, app_root.pk)
self.assertEqual(menu_nodes[1].selected, True)

@override_settings(
CMS_APPHOOKS=['cms.test_utils.project.sampleapp.cms_apps.AppWithNoMenu'],
)
def test_menu_node_is_selected_on_app_sub_path(self):
"""
If a user requests a path belonging to an apphook,
the menu should mark the node for the apphook page as selected.
"""
# Refs - https://github.com/divio/django-cms/issues/6336
defaults = {
'language': 'en',
'published': True,
'in_navigation': True,
'template': 'nav_playground.html',
}
homepage = create_page('EN-P1', **defaults)
homepage.set_as_homepage()
app_root = create_page('EN-P2', apphook='AppWithNoMenu', apphook_namespace='app_with_no_menu', **defaults)

# Public version
request = self.get_request(self.get_edit_on_url('/en/en-p2/settings/'))
request.current_page = get_page(request)
menu_nodes = menu_pool.get_renderer(request).get_nodes()
self.assertEqual(len(menu_nodes), 2)
self.assertEqual(menu_nodes[0].id, homepage.publisher_public_id)
self.assertEqual(menu_nodes[0].selected, False)
self.assertEqual(menu_nodes[1].id, app_root.publisher_public_id)
self.assertEqual(menu_nodes[1].selected, True)

# Draft version
with self.login_user_context(self.get_superuser()):
request = self.get_request(self.get_edit_on_url('/en/en-p2/settings/'))
request.current_page = get_page(request)
menu_nodes = menu_pool.get_renderer(request).get_nodes()
self.assertEqual(len(menu_nodes), 2)
self.assertEqual(menu_nodes[0].id, homepage.pk)
self.assertEqual(menu_nodes[0].selected, False)
self.assertEqual(menu_nodes[1].id, app_root.pk)
self.assertEqual(menu_nodes[1].selected, True)


class ApphooksPageLanguageUrlTestCase(CMSTestCase):
def setUp(self):
Expand Down
0