Skip to content

Commit

Permalink
Merge remote-tracking branch 'dCA/release/3.11.x' into private/uniweb…
Browse files Browse the repository at this point in the history
…-3.11

# Conflicts:
#	.github/workflows/frontend.yml
#	CHANGELOG.rst
#	cms/locale/es/LC_MESSAGES/django.po
#	cms/locale/es/LC_MESSAGES/djangojs.po
#	cms/locale/fr/LC_MESSAGES/django.po
#	cms/locale/fr/LC_MESSAGES/djangojs.po
#	cms/locale/it/LC_MESSAGES/django.po
#	cms/locale/it/LC_MESSAGES/djangojs.po
#	cms/locale/pt/LC_MESSAGES/django.po
#	cms/locale/pt/LC_MESSAGES/djangojs.po
#	cms/locale/pt_BR/LC_MESSAGES/django.po
#	cms/locale/pt_BR/LC_MESSAGES/djangojs.po
#	cms/locale/ru/LC_MESSAGES/django.po
#	cms/static/cms/js/modules/cms.plugins.js
#	cms/toolbar/toolbar.py
#	cms/utils/conf.py
#	docs/reference/configuration.rst
#	docs/upgrade/index.rst
  • Loading branch information
jrief committed Jul 4, 2022
2 parents 5ceccad + 1fbf7b8 commit c9565f3
Show file tree
Hide file tree
Showing 53 changed files with 593 additions and 161 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
node-version: ['16']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand Down
45 changes: 38 additions & 7 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,40 @@ Highlights:
* Support for django 4
* Dark mode support

* Added dark mode support to css, dark mode settings and toggle button
* Fix publishing of static placeholders outside of CMS pages
* Allow to override the template rendered after a plugin has been saved.
* Revert change to the toolbar sites menu to use ``http`` protocol.
* Fix edit plugin popup width (remove 850px width constraint).
* Fix except block using list instead of tuple. (#7334)
* Added cache ttl extension point.

3.10.1 (2022-06-28)
===================

Bug Fixes:
----------
* Changelog titles for 3.10.x (#7347) (31f399535) -- Mark Walker
* Request missing from test rendering (#7346) (eff54b0fd) -- Mark Walker
* Changelog title for 3.10.1rc1 (#7345) (966a90fd2) -- Mark Walker
* Revert change to the toolbar sites menu to use ``http`` protocol (#7332) (caddfe7f4) -- Mark Walker
* Fixed ``AttributeError`` (#7288) when the current toolbar object doesn't define ``get_draft_url()`` (#7289) -- Marco Bonetti
* Fix for django 2.2 in middleware [#7290] (#7293) -- Mark Walker
* Update release script to start bringing support for macOS (#7294) -- Mark Walker
* Fix release script version commit. (#7295) -- Mark Walker
* Revert change to the toolbar sites menu to use ``http`` protocol. (#7331) -- Mark Walker

Statistics:
-----------

This release includes 12 pull requests, and was created with the help of the following contributors (in alphabetical order):

* Conrad (3 pull requests)
* Florian Delizy (1 pull request)
* Marco Bonetti (1 pull request)
* Mark Walker (7 pull requests)

Thanks to all contributors for their efforts!

Features:
---------
Expand All @@ -19,6 +53,7 @@ Features:
* Add support for django 4 (#7268) (9e8eb17) -- Vinit Kumar
* Make Plugin Confirm Template configurable (#7267) (bab1e6e) -- Jacob Rief
* Add support for dark mode for toolbar, page tree, structure tree, modals (#7245) (b2d9a08) -- Fabian Braun
* Allow to override the template rendered after a plugin has been saved.

Bug Fixes:
----------
Expand Down Expand Up @@ -129,10 +164,6 @@ With the review help of the following contributors:

Thanks to all contributors for their efforts!

* Added dark mode support to css
* Fix publishing of static placeholders outside of CMS pages
* Allow to override the template rendered after a plugin has been saved.

3.9.0 (2021-06-30)
==================

Expand Down Expand Up @@ -179,7 +210,7 @@ Bug Fixes:
* Fix styles issues, caused by switching to the ``display: flex`` on the page tree renderer.
* Fixed missing builtin arguments on main ``cms`` management command causing it to crash
* Fixed template label nested translation
* Fixed a bug where the fallback page title would be returned instead of the one from the current language
* Fixed a bug where the fallback page title whould be returned instead of the one from the current language
* Fixed an issue when running migrations on a multi database project
* Fixes #7033: also check for Django 3.2, now that 3.9 supports it. (#7054) (02083f2dc) -- Marco Bonetti

Expand Down Expand Up @@ -280,7 +311,7 @@ Thanks to all contributors for their efforts!
* Fixed an issue in ``wizards/create.html`` where the error message did not use the plural form
* Improved documentation building
* Updated the content for django CMS’s development community
* Replaced all occurrences of ``force_text`` and ``smart_text`` against
* Replaced all occurences of ``force_text`` and ``smart_text`` against
``force_str``and ``smart_str``.


Expand Down Expand Up @@ -818,7 +849,7 @@ Thanks to all contributors for their efforts!
- Substantial improvements to the page tree and significant reduction of reloads
- Update jsTree version to 3.2.1 with slight adaptions to the Pagetree
- Documentation improvements
- Improve the display and usability of the language menu, especially in cases
- Improve the display and useability of the language menu, especially in cases
where there are many languages.
- Fix an issue relating to search fields in plugins
- Fix an issue where the app-resolver would trigger locales into migrations
Expand Down
6 changes: 5 additions & 1 deletion cms/admin/settingsadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
HttpResponse, HttpResponseBadRequest, HttpResponseRedirect,
)
from django.http.request import QueryDict
from django.urls import re_path
from django.urls import Resolver404, re_path, resolve
from django.utils.translation import override

from cms.admin.forms import RequestToolbarForm
Expand Down Expand Up @@ -97,6 +97,10 @@ def get_toolbar(self, request):
request = copy.copy(request)
request.GET = data
request.current_page = current_page
try:
request.resolver_match = resolve(origin_url.path)
except Resolver404:
pass
request.toolbar = CMSToolbar(request, request_path=origin_url.path, _async=True)
request.toolbar.set_object(attached_obj or current_page)
return HttpResponse(request.toolbar.render())
Expand Down
32 changes: 20 additions & 12 deletions cms/cache/page.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

import hashlib
from datetime import timedelta
from importlib import import_module

from django.conf import settings
from django.utils.cache import (
Expand Down Expand Up @@ -45,30 +46,37 @@ def set_page_cache(response):

placeholders = toolbar.content_renderer.get_rendered_placeholders()
# Checks if there's a plugin using the legacy "cache = False"
placeholder_ttl_list = []
ttl_list = []
vary_cache_on_set = set()
for ph in placeholders:
# get_cache_expiration() always returns:
# EXPIRE_NOW <= int <= MAX_EXPIRATION_IN_SECONDS
ttl = ph.get_cache_expiration(request, timestamp)
vary_cache_on = ph.get_vary_cache_on(request)

placeholder_ttl_list.append(ttl)
ttl_list.append(ttl)
if ttl and vary_cache_on:
# We're only interested in vary headers if they come from
# a cache-able placeholder.
vary_cache_on_set |= set(vary_cache_on)

if EXPIRE_NOW not in placeholder_ttl_list:
if placeholder_ttl_list:
min_placeholder_ttl = min(x for x in placeholder_ttl_list)
else:
# Should only happen when there are no placeholders at all
min_placeholder_ttl = MAX_EXPIRATION_TTL
ttl = min(
get_cms_setting('CACHE_DURATIONS')['content'],
min_placeholder_ttl
)
if EXPIRE_NOW not in ttl_list:
ttl_list.append(get_cms_setting('CACHE_DURATIONS')['content'])
ttl_list.append(MAX_EXPIRATION_TTL)

if hasattr(settings, 'CMS_LIMIT_TTL_CACHE_FUNCTION'):
extension_point = settings.CMS_LIMIT_TTL_CACHE_FUNCTION

module, func_name = extension_point.rsplit('.', 1)
module = import_module(module)
limit_ttl_cache_function = getattr(module, func_name)
limit_ttl = limit_ttl_cache_function(response)

# if the extension point returns an integer as ttl
if isinstance(limit_ttl, int):
ttl_list.append(limit_ttl)

ttl = min(ttl_list)

if ttl > 0:
# Adds expiration, etc. to headers
Expand Down
18 changes: 17 additions & 1 deletion cms/cms_toolbars.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,22 @@ def add_wizard_button(self):
disabled=disabled,
on_close=REFRESH_PAGE)

@toolbar_pool.register
class AppearanceToolbar(CMSToolbar):
"""
Adds appearance switches, esp. for dark and light mode
"""
color_scheme_toggle = get_cms_setting('COLOR_SCHEME_TOGGLE')

def populate(self):
if self.color_scheme_toggle:
dark_mode_toggle = TemplateItem(
template="cms/toolbar/items/dark_mode_toggle.html",
side=self.toolbar.RIGHT,
)
self.toolbar.add_item(dark_mode_toggle)



@toolbar_pool.register
class BasicToolbar(CMSToolbar):
Expand Down Expand Up @@ -129,7 +145,7 @@ def add_admin_menu(self):
sites_menu.add_sideframe_item(_('Admin Sites'), url=admin_reverse('sites_site_changelist'))
sites_menu.add_break(ADMIN_SITES_BREAK)
for site in sites_queryset:
sites_menu.add_link_item(site.name, url='https://%s' % site.domain,
sites_menu.add_link_item(site.name, url='http://%s' % site.domain,
active=site.pk == self.current_site.pk)

# admin
Expand Down
4 changes: 2 additions & 2 deletions cms/locale/es/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ msgid ""
msgstr ""
"Project-Id-Version: django CMS\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-05-23 23:22+0200\n"
"POT-Creation-Date: 2022-05-31 20:29+0200\n"
"PO-Revision-Date: 2010-11-30 06:47+0000\n"
"Last-Translator: Pier Jose Gotta Perez <piegope@protonmail.com>, 2020\n"
"Language-Team: Spanish (http://www.transifex.com/divio/django-cms/language/es/)\n"
Expand Down Expand Up @@ -945,7 +945,7 @@ msgstr "Ver en el sitio"
msgid "Please correct the error below."
msgid_plural "Please correct the errors below."
msgstr[0] "Por favor, corrija el error de abajo."
msgstr[1] ""
msgstr[1] "Por favor, corrija los errores de abajo."
msgstr[2] "Por favor, corrija los errores de abajo."

msgid "All permissions"
Expand Down
2 changes: 1 addition & 1 deletion cms/locale/es/LC_MESSAGES/djangojs.po
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: django CMS\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-05-23 23:22+0200\n"
"POT-Creation-Date: 2022-05-31 20:29+0200\n"
"PO-Revision-Date: 2010-11-30 06:49+0000\n"
"Last-Translator: e4db27214f7e7544f2022c647b585925_bb0e321, 2015\n"
"Language-Team: Spanish (http://www.transifex.com/divio/django-cms/language/es/)\n"
Expand Down
2 changes: 1 addition & 1 deletion cms/locale/fr/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ msgid ""
msgstr ""
"Project-Id-Version: django CMS\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-05-23 23:22+0200\n"
"POT-Creation-Date: 2022-05-31 20:29+0200\n"
"PO-Revision-Date: 2010-11-30 06:47+0000\n"
"Last-Translator: Robin Durner, 2022\n"
"Language-Team: French (http://www.transifex.com/divio/django-cms/language/fr/)\n"
Expand Down
2 changes: 1 addition & 1 deletion cms/locale/fr/LC_MESSAGES/djangojs.po
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ msgid ""
msgstr ""
"Project-Id-Version: django CMS\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-05-23 23:22+0200\n"
"POT-Creation-Date: 2022-05-31 20:29+0200\n"
"PO-Revision-Date: 2010-11-30 06:49+0000\n"
"Last-Translator: Frigory33 <chironsylvain@orange.fr>, 2016\n"
"Language-Team: French (http://www.transifex.com/divio/django-cms/language/fr/)\n"
Expand Down
2 changes: 1 addition & 1 deletion cms/locale/it/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ msgid ""
msgstr ""
"Project-Id-Version: django CMS\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-05-23 23:22+0200\n"
"POT-Creation-Date: 2022-05-31 20:29+0200\n"
"PO-Revision-Date: 2010-11-30 06:47+0000\n"
"Last-Translator: yakky <i.spalletti@nephila.it>, 2013-2016,2019\n"
"Language-Team: Italian (http://www.transifex.com/divio/django-cms/language/it/)\n"
Expand Down
2 changes: 1 addition & 1 deletion cms/locale/it/LC_MESSAGES/djangojs.po
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ msgid ""
msgstr ""
"Project-Id-Version: django CMS\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-05-23 23:22+0200\n"
"POT-Creation-Date: 2022-05-31 20:29+0200\n"
"PO-Revision-Date: 2010-11-30 06:49+0000\n"
"Last-Translator: yakky <i.spalletti@nephila.it>, 2015\n"
"Language-Team: Italian (http://www.transifex.com/divio/django-cms/language/it/)\n"
Expand Down
2 changes: 1 addition & 1 deletion cms/locale/pt/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ msgid ""
msgstr ""
"Project-Id-Version: django CMS\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-05-23 23:22+0200\n"
"POT-Creation-Date: 2022-05-31 20:29+0200\n"
"PO-Revision-Date: 2010-11-30 06:47+0000\n"
"Last-Translator: André Cruz <transifex@cabine.org>, 2018\n"
"Language-Team: Portuguese (http://www.transifex.com/divio/django-cms/language/pt/)\n"
Expand Down
2 changes: 1 addition & 1 deletion cms/locale/pt/LC_MESSAGES/djangojs.po
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: django CMS\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-05-23 23:22+0200\n"
"POT-Creation-Date: 2022-05-31 20:29+0200\n"
"PO-Revision-Date: 2010-11-30 06:49+0000\n"
"Last-Translator: Vítor Figueiró <vfigueiro@gmail.com>, 2012\n"
"Language-Team: Portuguese (http://www.transifex.com/divio/django-cms/language/pt/)\n"
Expand Down
2 changes: 1 addition & 1 deletion cms/locale/pt_BR/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ msgid ""
msgstr ""
"Project-Id-Version: django CMS\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-05-23 23:22+0200\n"
"POT-Creation-Date: 2022-05-31 20:29+0200\n"
"PO-Revision-Date: 2010-11-30 06:47+0000\n"
"Last-Translator: Welligton Miguel <miguelwelligton@gmail.com>, 2020\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/divio/django-cms/language/pt_BR/)\n"
Expand Down
2 changes: 1 addition & 1 deletion cms/locale/pt_BR/LC_MESSAGES/djangojs.po
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ msgid ""
msgstr ""
"Project-Id-Version: django CMS\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-05-23 23:22+0200\n"
"POT-Creation-Date: 2022-05-31 20:29+0200\n"
"PO-Revision-Date: 2010-11-30 06:49+0000\n"
"Last-Translator: Diego Ponci <dgo.ponciano@gmail.com>, 2016\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/divio/django-cms/language/pt_BR/)\n"
Expand Down
2 changes: 1 addition & 1 deletion cms/locale/ru/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ msgid ""
msgstr ""
"Project-Id-Version: django CMS\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-05-23 23:22+0200\n"
"POT-Creation-Date: 2022-05-31 20:29+0200\n"
"PO-Revision-Date: 2010-11-30 06:47+0000\n"
"Last-Translator: Dmitrii Kurskov, 2022\n"
"Language-Team: Russian (http://www.transifex.com/divio/django-cms/language/ru/)\n"
Expand Down
2 changes: 1 addition & 1 deletion cms/models/pagemodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ def get_draft_url(self, language=None, fallback=True):
"""
try:
return self.get_draft_object().get_absolute_url(language, fallback)
except [AttributeError, NoReverseMatch, TypeError]:
except (AttributeError, NoReverseMatch, TypeError):
return ''

def set_tree_node(self, site, target=None, position='first-child'):
Expand Down
Binary file not shown.
4 changes: 4 additions & 0 deletions cms/static/cms/fonts/src/moon.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions cms/static/cms/fonts/src/sun.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 9 additions & 11 deletions cms/static/cms/js/modules/cms.structureboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -1022,26 +1022,24 @@ class StructureBoard {
// refresh toolbar
var currentMode = CMS.settings.mode;

this._loadToolbar()
.done(newToolbar => {
CMS.API.Toolbar._refreshMarkup($(newToolbar).find('.cms-toolbar'));
})
.fail(() => Helpers.reloadBrowser());

if (currentMode === 'structure') {
this._requestcontent = null;

if (this._loadedContent && action !== 'COPY') {
this.updateContent();
return; // Toolbar loaded
}
return;
}

// invalidate the content mode
if (action !== 'COPY') {
} else if (action !== 'COPY') {
this._requestcontent = null;
this.updateContent();
return; // Toolbar loaded

}
this._loadToolbar()
.done(newToolbar => {
CMS.API.Toolbar._refreshMarkup($(newToolbar).find('.cms-toolbar'));
})
.fail(() => Helpers.reloadBrowser());
}

_propagateInvalidatedState(action, data) {
Expand Down

0 comments on commit c9565f3

Please sign in to comment.