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 31 commits
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
8000 Fixed #6336 -- request.current_page should always respect draft/live …
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
294 changes: 60 additions & 234 deletions .travis.yml

Large diffs are not rendered by default.

30 changes: 11 additions & 19 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
=== 3.5.3 (unreleased) ===

* Fixed ``TreeNode.DoesNotExist`` exception raised when exporting
and loading database contents via ``dumpdata`` and ``loaddata``.
* Fixed a bug where ``request.current_page`` would always be the public page,
regardless of the toolbar status (draft / live). This only affected custom
urls from an apphook.
* Removed extra quotation mark from the sideframe button template
* Fixed a bug where structureboard tried to preload markup when using legacy
renderer
* Fixed a bug where updates on other tab are not correctly propagated if the
  operation was to move a plugin in the top level of same placeholder
* Fixed a bug where xframe options were processed by clickjacking middleware
when page was served from cache, rather then get this value from cache
* Fixed a bug where cached page permissions overrides global permissions
* Fixed a bug where plugins that are not rendered in content wouldn't be
editable in structure board
* Fixed a bug with expanding static placeholder by clicking on "Expand All" button
* Fixed rendering of permission icons. Use SVG variants instead of GIFs.
=== 3.6.0 (unreleased) ===

* Removed the ``cms moderator`` command.
* Dropped Django < 1.11 support.
* Removed the translatable content get / set methods from ``CMSPlugin`` model.
* Removed signal handlers for ``Page``, ``Title``, ``Placeholder`` and ``CMSPlugin`` models.
* Moved ``Title.meta_description`` length restriction from model to form
and increased its max length to 320 characters.
* Added ``page_title`` parameter for ``cms.api.create_page()`` and ``cms.api.create_title()``.
* Introduced Django 2.0 support.
* Introduced Django 2.1 support.


=== 3.5.2 (2018-04-11) ===
Expand Down
12 changes: 6 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
django CMS
##########
.. image:: https://travis-ci.org/divio/django-cms.svg?branch=develop
:target: http://travis-ci.org/divio/django-cms
:target: https://travis-ci.org/divio/django-cms
.. image:: https://img.shields.io/pypi/v/django-cms.svg
:target: https://pypi.python.org/pypi/django-cms/
.. image:: https://img.shields.io/badge/wheel-yes-green.svg
Expand Down Expand Up @@ -48,17 +48,17 @@ Features

Developing applications that integrate with and take advantage of django CMS features is easy and well-documented.

More information on `our website <http://www.django-cms.org>`_.
More information on `our website <https://www.django-cms.org>`_.

************
Requirements
************

See the `Python/Django requirements for the current release version
<http://docs.django-cms.org/en/stable/#software-version-requirements-and-release-notes>`_ in our documentation.
<http://docs.django-cms.org/en/latest/#software-version-requirements-and-release-notes>`_ in our documentation.

See the `installation how-to guide for an overview of some other requirements and dependencies of the current release
<http://docs.django-cms.org/en/stable/how-to/install.html>`_
<http://docs.django-cms.org/en/latest/how_to/install.html>`_

*************
Documentation
Expand All @@ -71,7 +71,7 @@ We maintain documentation for several versions of the project. Key versions are:
* `develop <http://docs.django-cms.org/en/develop/>`_, representing the latest build of the **develop branch**

For more information about our branch policy, see `Branches
<http://docs.django-cms.org/en/stable/contributing/development-policies.html>`_.
<http://docs.django-cms.org/en/latest/contributing/development-policies.html>`_.

Our documentation is hosted courtesy of `Read the Docs <https://readthedocs.org>`_.

Expand Down Expand Up @@ -122,7 +122,7 @@ Credits
* Includes icons from `FamFamFam <http://www.famfamfam.com>`_.
* Python tree engine powered by
`django-treebeard <https://tabo.pe/projects/django-treebeard/>`_.
* JavaScript tree in admin uses `jsTree <http://www.jstree.com>`_.
* JavaScript tree in admin uses `jsTree <https://www.jstree.com>`_.
* Many thanks to the
`over 515 contributors <https://github.com/divio/django-cms/blob/develop/AUTHORS>`_
to the django CMS!
27 changes: 24 additions & 3 deletions cms/admin/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from cms import api
from cms.apphook_pool import apphook_pool
from cms.cache.permissions import clear_permission_cache
from cms.exceptions import PluginLimitReached
from cms.extensions import extension_pool
from cms.constants import PAGE_TYPES_ID, PUBLISHER_STATE_DIRTY, ROOT_USER_LEVEL
Expand Down Expand Up @@ -126,9 +127,9 @@ class BasePageForm(forms.ModelForm):
help_text=_('Overwrites what is displayed at the top of your browser or in bookmarks'),
required=False)
meta_description = forms.CharField(label=_('Description meta tag'), required=False,
widget=forms.Textarea(attrs={'maxlength': '155', 'rows': '4'}),
widget=forms.Textarea(attrs={'maxlength': '320', 'rows': '4'}),
help_text=_('A description of the page used by search engines.'),
max_length=155)
max_length=320)

class Meta:
model = Page
Expand Down Expand Up @@ -465,6 +466,7 @@ def save(self, commit=True):
api.create_title(language=self._language, page=cms_page, **translation_data)
else:
cms_page._update_title_path_recursive(self._language)
cms_page.clear_cache(menu=True)
return cms_page


Expand All @@ -474,6 +476,11 @@ class Meta:
model = Page
fields = ['publication_date', 'publication_end_date']

def save(self, *args, **kwargs):
page = super(PublicationDatesForm, self).save(*args, **kwargs)
page.clear_cache(menu=True)
return page


class AdvancedSettingsForm(forms.ModelForm):
from cms.forms.fields import PageSmartLinkField
Expand All @@ -499,7 +506,7 @@ class AdvancedSettingsForm(forms.ModelForm):
redirect = PageSmartLinkField(label=_('Redirect'), required=False,
help_text=_('Redirects to this URL.'),
placeholder_text=_('Start typing...'),
ajax_view='admin:cms_page_get_published_pagelist'
ajax_view='admin:cms_page_get_published_pagelist',
)

# This is really a 'fake' field which does not correspond to any Page attribute
Expand Down Expand Up @@ -758,6 +765,7 @@ def save(self, *args, **kwargs):

if is_draft_and_has_public and self.has_changed_apphooks():
self.update_apphooks()
page.clear_cache(menu=True)
return page


Expand All @@ -767,6 +775,12 @@ class Meta:
model = Page
fields = ['login_required', 'limit_visibility_in_menu']

def save(self, *args, **kwargs):
page = super(PagePermissionForm, self).save(*args, **kwargs)
page.clear_cache(menu=True)
clear_permission_cache()
return page


class PageTreeForm(forms.Form):

Expand Down Expand Up @@ -825,6 +839,13 @@ def _get_tree_options_for_parent(self, parent_node, position):

class MovePageForm(PageTreeForm):

def clean(self):
cleaned_data = super(MovePageForm, self).clean()

if self.page.is_home and cleaned_data.get('target'):
self.add_error('target', force_text(_('You can\'t move the home page inside another page')))
return cleaned_data

def get_tree_options(self):
options = super(MovePageForm, self).get_tree_options()
target_node, target_node_position = options
Expand Down
54 changes: 45 additions & 9 deletions cms/admin/pageadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
)
from cms.admin.permissionadmin import PERMISSION_ADMIN_INLINES
from cms.admin.placeholderadmin import PlaceholderAdminMixin
from cms.cache.permissions import clear_permission_cache
from cms.constants import PUBLISHER_STATE_PENDING
from cms.models import (
EmptyTitle, Page, PageType,
Expand All @@ -72,6 +73,7 @@
get_site_language_from_request,
)
from cms.utils.admin import jsonify_request
from cms.utils.compat import DJANGO_2_0
from cms.utils.conf import get_cms_setting
from cms.utils.urlutils import admin_reverse

Expand Down Expand Up @@ -441,8 +443,19 @@ def delete_view(self, request, object_id, extra_context=None):
# Populate deleted_objects, a data structure of all related objects that
# will also be deleted.
objs = [obj] + list(obj.get_descendant_pages())

if DJANGO_2_0:
get_deleted_objects_additional_kwargs = {
'opts': opts,
'using': using,
'user': request.user,
}
else:
get_deleted_objects_additional_kwargs = {'request': request}
(deleted_objects, model_count, perms_needed, protected) = get_deleted_objects(
objs, opts, request.user, self.admin_site, using)
objs, admin_site=self.admin_site,
**get_deleted_objects_additional_kwargs
)

if request.POST and not protected: # The user has confirmed the deletion.
if perms_needed:
Expand Down Expand Up @@ -486,6 +499,19 @@ def delete_model(self, request, obj):
obj=obj,
)

cms_pages = [obj]

if obj.publisher_public:
cms_pages.append(obj.publisher_public)

if obj.node.is_branch:
nodes = obj.node.get_descendants()
cms_pages.extend(self.model.objects.filter(node__in=nodes))

for page in cms_pages:
page._clear_placeholders()
page.get_placeholders().delete()

super(BasePageAdmin, self).delete_model(request, obj)

self._send_post_page_operation(
Expand All @@ -495,6 +521,11 @@ def delete_model(self, request, obj):
obj=obj,
)

clear_permission_cache()

if obj.application_urls:
set_restart_trigger()

def get_copy_dialog(self, request, page_id):
if not get_cms_setting('PERMISSION'):
return HttpResponse('')
Expand Down Expand Up @@ -644,6 +675,9 @@ def has_change_permission(self, request, obj=None):
)
return can_change_page

def has_view_permission(self, request, obj=None):
return self.has_change_permission(request, obj)

def has_change_advanced_settings_permission(self, request, obj=None):
if not obj:
return False
Expand Down Expand Up @@ -1251,22 +1285,24 @@ def delete_translation(self, request, object_id, extra_context=None):
pluginopts = CMSPlugin._meta

saved_plugins = CMSPlugin.objects.filter(placeholder__page__id=object_id, language=language)

using = router.db_for_read(self.model)
kwargs = {
'admin_site': self.admin_site,
'user': request.user,
'using': using
}

kwargs = {'admin_site': self.admin_site}
if DJANGO_2_0:
kwargs.update({'using': using, 'opts': titleopts, 'user': request.user})
else:
kwargs.update({'request': request})
deleted_objects, __, perms_needed = get_deleted_objects(
[translation],
titleopts,
**kwargs
)[:3]

if DJANGO_2_0:
kwargs.update({'using': using, 'opts': pluginopts, 'user': request.user})
else:
kwargs.update({'request': request})
to_delete_plugins, __, perms_needed_plugins = get_deleted_objects(
saved_plugins,
pluginopts,
**kwargs
)[:3]

Expand Down
14 changes: 13 additions & 1 deletion cms/admin/permissionadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from cms.admin.forms import GlobalPagePermissionAdminForm, PagePermissionInlineAdminForm, ViewRestrictionInlineAdminForm
from cms.exceptions import NoPermissionsException
from cms.models import PagePermission, GlobalPagePermission
from cms.utils import permissions
from cms.utils import permissions, page_permissions
from cms.utils.conf import get_cms_setting
from cms.utils.helpers import classproperty

Expand All @@ -38,6 +38,18 @@ class PagePermissionInlineAdmin(TabularInline):
extra = 0 # edit page load time boost
show_with_view_permissions = False

def has_change_permission(self, request, obj=None):
if not obj:
return False
return page_permissions.user_can_change_page_permissions(
request.user,
page=obj,
site=obj.node.site,
)

def has_add_permission(self, request, obj=None):
return self.has_change_permission(request, obj)

@classproperty
def raw_id_fields(cls):
# Dynamically set raw_id_fields based on settings
Expand Down
Loading
0