Skip to content

Commit

Permalink
Fix #7710 (#7717)
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun committed Dec 11, 2023
1 parent d021a26 commit 9a7fe85
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
6 changes: 3 additions & 3 deletions cms/extensions/extension_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ def _copy_page_extensions(self, source_page, target_page, language):
instance.copy(target_page, language)

def _copy_content_extensions(self, source_page, target_page, language):
source_content = source_page.pagecontent_set(manager="admin_manager").get(language=language)
target_title = target_page.pagecontent_set(manager="admin_manager").get(language=language)
source_content = source_page.pagecontent_set(manager="admin_manager").current_content(language=language).get()
target_content = target_page.pagecontent_set(manager="admin_manager").current_content(language=language).get()
for extension in self.page_content_extensions:
for instance in extension.objects.filter(extended_object=source_content):
instance.copy(target_title, language)
instance.copy(target_content, language)

def copy_extensions(self, source_page, target_page, languages=None):
if not languages:
Expand Down
19 changes: 12 additions & 7 deletions cms/toolbar/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def add_item(self, item, position=None):
return item

def find_items(self, item_type, **attributes):
"""Returns a list of :class:`ItemSearchResult` objects matching all items of ``item_type``
"""Returns a list of :class:`~cms.toolbar.items.ItemSearchResult` objects matching all items of ``item_type``
(e.g. ``LinkItem``)."""
results = []
attr_items = attributes.items()
Expand All @@ -126,8 +126,8 @@ def find_items(self, item_type, **attributes):
return results

def find_first(self, item_type, **attributes):
"""Returns the first :class:`ItemSearchResult` that matches the search, or ``None``. The
search strategy is the same as in :meth:`find_items`. The return value of this method is
"""Returns the first :class:`~cms.toolbar.items.ItemSearchResult` that matches the search, or ``None``.
The search strategy is the same as in :meth:`find_items`. The return value of this method is
safe to use as the :option:`position` argument of the various APIs to add items."""
try:
return self.find_items(item_type, **attributes)[0]
Expand Down Expand Up @@ -163,7 +163,7 @@ def remove_item(self, item):

def add_sideframe_item(self, name, url, active=False, disabled=False,
extra_classes=None, on_close=None, side=LEFT, position=None):
"""Adds a :class:`SideframeItem` that opens ``url`` in the sideframe and returns it."""
"""Adds a :class:`~cms.toolbar.items.SideframeItem` that opens ``url`` in the sideframe and returns it."""

item = SideframeItem(
name, url,
Expand All @@ -178,7 +178,7 @@ def add_sideframe_item(self, name, url, active=False, disabled=False,

def add_modal_item(self, name, url, active=False, disabled=False,
extra_classes=None, on_close=REFRESH_PAGE, side=LEFT, position=None):
"""Similar to :meth:`add_sideframe_item`, but adds a :class:`ModalItem` that opens the
"""Similar to :meth:`add_sideframe_item`, but adds a :class:`~cms.toolbar.items.ModalItem` that opens the
``url`` in a modal dialog instead of the sideframe, and returns it."""

item = ModalItem(
Expand All @@ -194,7 +194,7 @@ def add_modal_item(self, name, url, active=False, disabled=False,

def add_link_item(self, name, url, active=False, disabled=False,
extra_classes=None, side=LEFT, position=None):
"""Adds a :class:`LinkItem` that opens ``url``, and returns it."""
"""Adds a :class:`~cms.toolbar.items.LinkItem` that opens ``url``, and returns it."""

item = LinkItem(
name, url,
Expand All @@ -209,7 +209,7 @@ def add_link_item(self, name, url, active=False, disabled=False,
def add_ajax_item(self, name, action, active=False, disabled=False,
extra_classes=None, data=None, question=None,
side=LEFT, position=None, on_success=None, method='POST'):
"""Adds :class:`AjaxItem` that sends a POST request to ``action`` with ``data``, and returns
"""Adds :class:`~cms.toolbar.items.AjaxItem` that sends a POST request to ``action`` with ``data``, and returns
it. ``data`` should be ``None`` or a dictionary. The CSRF token will automatically be added
to the item.
Expand Down Expand Up @@ -370,6 +370,11 @@ def get_context(self):


class FrameItem(BaseItem):
"""
Base class for :class:`~cms.toolbar.items.ModalItem` and :class:`~cms.toolbar.items.SideframeItem`.
Frame items have three dots besides their name indicating that some frame or dialog will open
when selected.
"""
# Be sure to define the correct template

def __init__(self, name, url, active=False, disabled=False,
Expand Down

0 comments on commit 9a7fe85

Please sign in to comment.