merge default
authorDamien Correia
Mon, 25 Jun 2018 16:15:14 +0200
changeset 743 1c10079005f6
parent 742 224161f6d31c
child 769 d10609b12d9d
merge default
src/pyams_content/shared/site/zmi/container.py
--- a/src/pyams_content/shared/site/zmi/container.py	Mon Jun 25 16:03:54 2018 +0200
+++ b/src/pyams_content/shared/site/zmi/container.py	Mon Jun 25 16:15:14 2018 +0200
@@ -27,7 +27,7 @@
 from pyams_i18n.interfaces import II18n
 from pyams_skin.interfaces import IInnerPage, IPageHeader
 from pyams_skin.interfaces.container import ITableElementEditor, ITableElementName, ITableWithActions
-from pyams_skin.interfaces.viewlet import IBreadcrumbItem, ITableItemColumnActionsMenu, IContextActions
+from pyams_skin.interfaces.viewlet import IBreadcrumbItem, ITableItemColumnActionsMenu
 from pyams_skin.layer import IPyAMSLayer
 from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION
 from pyams_utils.interfaces.traversing import IPathElements
@@ -58,7 +58,6 @@
 from pyams_utils.registry import get_utility
 from pyams_utils.timezone import tztime
 from pyams_utils.traversing import get_parent
-from pyams_utils.unicode import translate_string
 from pyams_utils.url import absolute_url
 from pyams_viewlet.manager import viewletmanager_config
 from pyams_viewlet.viewlet import viewlet_config
@@ -633,62 +632,3 @@
     def url(self):
         version = IWorkflowVersions(self.context).get_last_versions(count=1)[0]
         return absolute_url(version, self.request, self.view_name)
-
-
-#
-# Site container rename view
-#
-
-@viewlet_config(name='rename-item.menu', context=ISiteContainer, layer=IPyAMSLayer,
-                view=ISiteTreeTable, manager=ITableItemColumnActionsMenu,
-                permission=MANAGE_SITE_PERMISSION, weight=900)
-@viewlet_config(name='rename-item.menu', context=ISiteContainer, layer=IPyAMSLayer,
-                view=Interface, manager=IContextActions,
-                permission=MANAGE_SITE_PERMISSION, weight=900)
-class SiteContainerRenameMenu(ToolbarMenuItem):
-    """Site container rename menu"""
-
-    label = _("Change URL...")
-    label_css_class = 'fa fa-fw fa-edit'
-    url = 'rename-item.html'
-    modal_target = True
-
-
-@pagelet_config(name='rename-item.html', context=ISiteContainer, layer=IPyAMSLayer,
-                permission=MANAGE_SITE_PERMISSION)
-@ajax_config(name='rename-item.json', context=ISiteContainer, layer=IPyAMSLayer)
-class SiteContainerRenameForm(AdminDialogEditForm):
-    """Site container rename form"""
-
-    prefix = 'rename_item.'
-
-    legend = _("Change item URL")
-
-    fields = field.Fields(ISiteContainer).select('__name__')
-    edit_permission = MANAGE_SITE_PERMISSION
-
-    def updateWidgets(self, prefix=None):
-        super(SiteContainerRenameForm, self).updateWidgets(prefix)
-        self.widgets['__name__'].label = _("Item URL part")
-
-    def update_content(self, content, data):
-        old_name = content.__name__
-        changes = super(SiteContainerRenameForm, self).update_content(content, data)
-        if changes:
-            # revert rename to adjust container properties
-            new_name = translate_string(content.__name__, spaces='-', keep_chars='-')
-            content.__name__ = old_name
-            parent = content.__parent__
-            parent[new_name] = content
-            del parent[old_name]
-        return changes
-
-    def get_ajax_output(self, changes):
-        if changes:
-            return {
-                'status': 'redirect',
-                'location': absolute_url(self.context, self.request, 'admin'),
-                'message': self.request.localizer.translate(self.successMessage)
-            }
-        else:
-            return super(SiteContainerRenameForm, self).get_ajax_output(changes)