From 644ee5fd255ab9e92b090da2995b8a773fb6593a Mon Sep 17 00:00:00 2001 From: tischsoic Date: Fri, 8 Sep 2023 09:42:27 +0200 Subject: [PATCH 01/40] IBX-6279: Simplify actions in create and edit modes --- .../config/services/form_processors.yaml | 3 ++ .../translations/ibexa_dashboard.en.xliff | 5 ++ .../translations/ibexa_menu.en.xliff | 15 ++++++ .../admin/content/create/create.html.twig | 2 + .../themes/admin/content/edit/edit.html.twig | 2 + .../Processor/ContentEditFormProcessor.php | 48 +++++++++++++++++++ ...ontentTypeGroupEditRightSidebarBuilder.php | 34 +++++++++---- .../Menu/ContentEditRightSidebarBuilder.php | 44 ++++++++++++----- 8 files changed, 131 insertions(+), 22 deletions(-) create mode 100644 src/lib/Form/Processor/ContentEditFormProcessor.php diff --git a/src/bundle/Resources/config/services/form_processors.yaml b/src/bundle/Resources/config/services/form_processors.yaml index b7524a24cb..9a46dd2156 100644 --- a/src/bundle/Resources/config/services/form_processors.yaml +++ b/src/bundle/Resources/config/services/form_processors.yaml @@ -28,6 +28,9 @@ services: $siteaccessGroups: '%ibexa.site_access.groups%' $systemUrlRedirectProcessor: '@Ibexa\AdminUi\Form\Processor\Content\UrlRedirectProcessor.inner' + Ibexa\AdminUi\Form\Processor\ContentEditFormProcessor: + public: true + Ibexa\AdminUi\Form\Processor\ContentEditNotificationFormProcessor: public: true arguments: diff --git a/src/bundle/Resources/translations/ibexa_dashboard.en.xliff b/src/bundle/Resources/translations/ibexa_dashboard.en.xliff index 5d167fe9ea..8f1ddd71f8 100644 --- a/src/bundle/Resources/translations/ibexa_dashboard.en.xliff +++ b/src/bundle/Resources/translations/ibexa_dashboard.en.xliff @@ -6,6 +6,11 @@ The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message. + + Dashboard + Dashboard + key: dashboard.breadcrumbs.dashboard + Create content Create content diff --git a/src/bundle/Resources/translations/ibexa_menu.en.xliff b/src/bundle/Resources/translations/ibexa_menu.en.xliff index 0e73d9eb2d..b868804f2e 100644 --- a/src/bundle/Resources/translations/ibexa_menu.en.xliff +++ b/src/bundle/Resources/translations/ibexa_menu.en.xliff @@ -46,6 +46,11 @@ Move key: content__sidebar_right__move + + Preview + Preview + key: content__sidebar_right__preview + Reveal Reveal @@ -161,6 +166,11 @@ Save key: content_type_group_edit__sidebar_right__save + + Save and close + Save and close + key: content_type_group_edit__sidebar_right__save_and_close + Cancel Cancel @@ -251,6 +261,11 @@ Dashboard key: main__dashboard + + Drafts + Drafts + key: main__drafts + Trash Trash diff --git a/src/bundle/Resources/views/themes/admin/content/create/create.html.twig b/src/bundle/Resources/views/themes/admin/content/create/create.html.twig index c4663504df..66d725e157 100644 --- a/src/bundle/Resources/views/themes/admin/content/create/create.html.twig +++ b/src/bundle/Resources/views/themes/admin/content/create/create.html.twig @@ -41,7 +41,9 @@
{{ parent() }} {{ form_widget(form.publish, {'attr': {'hidden': 'hidden'}}) }} + {{ form_widget(form.publishAndEdit, { attr: { hidden: 'hidden' }}) }} {{ form_widget(form.saveDraft, {'attr': {'hidden': 'hidden'}}) }} + {{ form_widget(form.saveDraftAndClose, { attr: { hidden: 'hidden' }}) }} {{ form_widget(form.cancel, {'attr': {'hidden': 'hidden'}}) }}
diff --git a/src/bundle/Resources/views/themes/admin/content/edit/edit.html.twig b/src/bundle/Resources/views/themes/admin/content/edit/edit.html.twig index 92bcf3b58d..06030b6cfa 100644 --- a/src/bundle/Resources/views/themes/admin/content/edit/edit.html.twig +++ b/src/bundle/Resources/views/themes/admin/content/edit/edit.html.twig @@ -45,7 +45,9 @@
{{ parent() }} {{ form_widget(form.publish, {'attr': {'hidden': 'hidden'}}) }} + {{ form_widget(form.publishAndEdit, { attr: { hidden: 'hidden' }}) }} {{ form_widget(form.saveDraft, {'attr': {'hidden': 'hidden'}}) }} + {{ form_widget(form.saveDraftAndClose, { attr: { hidden: 'hidden' }}) }} {{ form_widget(form.cancel, {'attr': {'hidden': 'hidden'}}) }}
diff --git a/src/lib/Form/Processor/ContentEditFormProcessor.php b/src/lib/Form/Processor/ContentEditFormProcessor.php new file mode 100644 index 0000000000..eb25f811c9 --- /dev/null +++ b/src/lib/Form/Processor/ContentEditFormProcessor.php @@ -0,0 +1,48 @@ +router = $router; + } + + /** + * {@inheritdoc} + */ + public static function getSubscribedEvents() + { + return [ + ContentFormEvents::CONTENT_SAVE_DRAFT_AND_CLOSE => ['redirectToDraftsView', 5], + ]; + } + + /** + * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + */ + public function redirectToDraftsView(FormActionEvent $event) + { + $form = $event->getForm(); + $formConfig = $form->getConfig(); + $defaultUrl = $this->router->generate('ibexa.content_draft.list'); + + $event->setResponse(new RedirectResponse($formConfig->getAction() ?: $defaultUrl)); + } +} diff --git a/src/lib/Menu/Admin/ContentType/ContentTypeGroupEditRightSidebarBuilder.php b/src/lib/Menu/Admin/ContentType/ContentTypeGroupEditRightSidebarBuilder.php index f771efc140..5448971f49 100644 --- a/src/lib/Menu/Admin/ContentType/ContentTypeGroupEditRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/ContentType/ContentTypeGroupEditRightSidebarBuilder.php @@ -25,6 +25,7 @@ class ContentTypeGroupEditRightSidebarBuilder extends AbstractBuilder implements { /* Menu items */ public const ITEM__SAVE = 'content_type_group_edit__sidebar_right__save'; + public const ITEM__SAVE_AND_CLOSE = 'content_type_group_edit__sidebar_right__save_and_close'; public const ITEM__CANCEL = 'content_type_group_edit__sidebar_right__cancel'; /** @var \Symfony\Contracts\Translation\TranslatorInterface */ @@ -64,16 +65,28 @@ public function createStructure(array $options): ItemInterface /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); + $saveItem = $this->createMenuItem( + self::ITEM__SAVE, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => sprintf('#%s', $saveId), + ], + ] + ); + + $saveItem->addChild( + self::ITEM__SAVE_AND_CLOSE, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => sprintf('#%s', $saveId), + ], + ] + ); + $menu->setChildren([ - self::ITEM__SAVE => $this->createMenuItem( - self::ITEM__SAVE, - [ - 'attributes' => [ - 'class' => 'ibexa-btn--trigger', - 'data-click' => sprintf('#%s', $saveId), - ], - ] - ), + self::ITEM__SAVE => $saveItem, self::ITEM__CANCEL => $this->createMenuItem( self::ITEM__CANCEL, [ @@ -92,7 +105,8 @@ public static function getTranslationMessages(): array { return [ (new Message(self::ITEM__SAVE, 'ibexa_menu'))->setDesc('Save'), - (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard changes'), + (new Message(self::ITEM__SAVE_AND_CLOSE, 'ibexa_menu'))->setDesc('Save and close'), + (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard'), ]; } } diff --git a/src/lib/Menu/ContentEditRightSidebarBuilder.php b/src/lib/Menu/ContentEditRightSidebarBuilder.php index 6d3bb19816..0fb28dbdc1 100644 --- a/src/lib/Menu/ContentEditRightSidebarBuilder.php +++ b/src/lib/Menu/ContentEditRightSidebarBuilder.php @@ -32,6 +32,7 @@ class ContentEditRightSidebarBuilder extends AbstractBuilder implements Translat /* Menu items */ public const ITEM__PUBLISH = 'content_edit__sidebar_right__publish'; public const ITEM__SAVE_DRAFT = 'content_edit__sidebar_right__save_draft'; + public const ITEM__SAVE_DRAFT_AND_CLOSE = 'content_edit__sidebar_right__save_draft_and_close'; public const ITEM__PREVIEW = 'content_edit__sidebar_right__preview'; public const ITEM__CANCEL = 'content_edit__sidebar_right__cancel'; @@ -106,10 +107,14 @@ public function createStructure(array $options): ItemInterface 'class' => self::BTN_TRIGGER_CLASS, 'data-click' => '#ezplatform_content_forms_content_edit_publish', ]; - $editAttributes = [ + $saveDraftAttributes = [ 'class' => self::BTN_TRIGGER_CLASS, 'data-click' => '#ezplatform_content_forms_content_edit_saveDraft', ]; + $saveDraftAndCloseAttributes = [ + 'class' => self::BTN_TRIGGER_CLASS, + 'data-click' => '#ezplatform_content_forms_content_edit_saveDraftAndClose', + ]; $deleteAttributes = [ 'class' => self::BTN_TRIGGER_CLASS, 'data-click' => '#ezplatform_content_forms_content_edit_cancel', @@ -127,19 +132,34 @@ public function createStructure(array $options): ItemInterface ], ] ), - self::ITEM__SAVE_DRAFT => $this->createMenuItem( - self::ITEM__SAVE_DRAFT, - [ - 'attributes' => $canEdit - ? $editAttributes - : array_merge($editAttributes, self::BTN_DISABLED_ATTR), - 'extras' => [ - 'orderNumber' => 50, - ], - ] - ), ]; + $saveDraftAndCloseItem = $this->createMenuItem( + self::ITEM__SAVE_DRAFT_AND_CLOSE, + [ + 'attributes' => $canEdit + ? $saveDraftAndCloseAttributes + : array_merge($saveDraftAndCloseAttributes, self::BTN_DISABLED_ATTR), + 'extras' => [ + 'orderNumber' => 80, + ], + ] + ); + + $saveDraftAndCloseItem->addChild( + self::ITEM__SAVE_DRAFT, + [ + 'attributes' => $canEdit + ? $saveDraftAttributes + : array_merge($saveDraftAttributes, self::BTN_DISABLED_ATTR), + 'extras' => [ + 'orderNumber' => 80, + ], + ] + ); + + $items[self::ITEM__SAVE_DRAFT_AND_CLOSE] = $saveDraftAndCloseItem; + $items[self::ITEM__PREVIEW] = $this->getContentPreviewItem( $location, $content, From b3c71686bd387c0d394ba3b268a23193605d45f2 Mon Sep 17 00:00:00 2001 From: tischsoic Date: Thu, 17 Aug 2023 21:48:07 +0200 Subject: [PATCH 02/40] context menu in Content Type create/edit --- .../ContentTypeDraftParamConverter.php | 2 +- .../translations/ibexa_content_type.en.xliff | 5 +++ .../translations/ibexa_menu.en.xliff | 28 ++++++++++----- .../admin/content_type/create.html.twig | 7 ++-- .../themes/admin/content_type/edit.html.twig | 6 ++-- src/contracts/Event/FormEvents.php | 5 +++ .../ContentType/ContentTypeFormProcessor.php | 14 ++++++++ .../ContentType/ContentTypeUpdateType.php | 3 ++ ...AbstractContentTypeRightSidebarBuilder.php | 35 ++++++++++++++----- .../ContentTypeCreateRightSidebarBuilder.php | 11 ++++-- .../ContentTypeEditRightSidebarBuilder.php | 11 ++++-- 11 files changed, 98 insertions(+), 29 deletions(-) diff --git a/src/bundle/ParamConverter/ContentTypeDraftParamConverter.php b/src/bundle/ParamConverter/ContentTypeDraftParamConverter.php index 5577e32e66..a98efdf1a4 100644 --- a/src/bundle/ParamConverter/ContentTypeDraftParamConverter.php +++ b/src/bundle/ParamConverter/ContentTypeDraftParamConverter.php @@ -20,7 +20,7 @@ class ContentTypeDraftParamConverter implements ParamConverterInterface private $contentTypeService; /** - * ContentTypeGroupParamConverter constructor. + * ContentTypeDraftParamConverter constructor. * * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeGroupService */ diff --git a/src/bundle/Resources/translations/ibexa_content_type.en.xliff b/src/bundle/Resources/translations/ibexa_content_type.en.xliff index d2e3b4ffc2..fdb5c93ac9 100644 --- a/src/bundle/Resources/translations/ibexa_content_type.en.xliff +++ b/src/bundle/Resources/translations/ibexa_content_type.en.xliff @@ -171,6 +171,11 @@ OK key: content_type.publish
+ + Save + Save + key: content_type.publish_and_edit + Cancel Cancel diff --git a/src/bundle/Resources/translations/ibexa_menu.en.xliff b/src/bundle/Resources/translations/ibexa_menu.en.xliff index b868804f2e..9e2591a126 100644 --- a/src/bundle/Resources/translations/ibexa_menu.en.xliff +++ b/src/bundle/Resources/translations/ibexa_menu.en.xliff @@ -117,13 +117,18 @@ key: content_type__sidebar_right__edit - Cancel - Cancel + Discard + Discard key: content_type_create__sidebar_right__cancel + + Save + Save + key: content_type_create__sidebar_right__publish_and_edit + - Create - Create + Save and close + Save and close key: content_type_create__sidebar_right__save @@ -137,13 +142,18 @@ key: content_type_edit__anchor_menu__global_properties - Cancel - Cancel + Delete draft + Delete draft key: content_type_edit__sidebar_right__cancel - + Save Save + key: content_type_edit__sidebar_right__publish_and_edit + + + Save and close + Save and close key: content_type_edit__sidebar_right__save @@ -157,8 +167,8 @@ key: content_type_group_create__sidebar_right__create - Discard changes - Discard changes + Discard + Discard key: content_type_group_edit__sidebar_right__cancel diff --git a/src/bundle/Resources/views/themes/admin/content_type/create.html.twig b/src/bundle/Resources/views/themes/admin/content_type/create.html.twig index 407ebd7aaa..a64f98ff5c 100644 --- a/src/bundle/Resources/views/themes/admin/content_type/create.html.twig +++ b/src/bundle/Resources/views/themes/admin/content_type/create.html.twig @@ -6,7 +6,9 @@ {% block header %} {% set content_type_create_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.content_type_create.sidebar_right', [], { - 'form_view': form, + 'save_id': form.publishContentType.vars.id, + form_view: form, + 'group': content_type_group }) %} {% include '@ibexadesign/ui/edit_header.html.twig' with { @@ -84,7 +86,8 @@ {{ form_widget(form.saveContentType, { attr: { hidden: 'hidden' }}) }} - {{ form_widget(form.publishContentType, { attr: { class: 'ibexa-content-type-edit__publish-content-type', hidden: 'hidden' }}) }} + {{ form_widget(form.publishContentType, { attr: { hidden: 'hidden' }}) }} + {{ form_widget(form.publishAndEditContentType, { attr: { hidden: 'hidden' }}) }} {{ form_widget(form.removeDraft, { attr: { hidden: 'hidden', formnovalidate: true }}) }} {{ form_widget(form._token) }} diff --git a/src/bundle/Resources/views/themes/admin/content_type/edit.html.twig b/src/bundle/Resources/views/themes/admin/content_type/edit.html.twig index c5cbf79eaa..bdfe52413c 100644 --- a/src/bundle/Resources/views/themes/admin/content_type/edit.html.twig +++ b/src/bundle/Resources/views/themes/admin/content_type/edit.html.twig @@ -96,10 +96,8 @@ - {{ form_widget(form.publishContentType, { attr: { - class: 'ibexa-content-type-edit__publish-content-type', - hidden: 'hidden' - }}) }} + {{ form_widget(form.publishContentType, { attr: { hidden: 'hidden' }}) }} + {{ form_widget(form.publishAndEditContentType, { attr: { hidden: 'hidden' }}) }} {{ form_widget(form.removeDraft, { attr: { hidden: 'hidden', formnovalidate: true, diff --git a/src/contracts/Event/FormEvents.php b/src/contracts/Event/FormEvents.php index 0a3f0c58d2..a42dbfb5d9 100644 --- a/src/contracts/Event/FormEvents.php +++ b/src/contracts/Event/FormEvents.php @@ -28,6 +28,11 @@ final class FormEvents */ public const CONTENT_TYPE_PUBLISH = 'contentType.update.publishContentType'; + /** + * Triggered when saving the draft + publishing the ContentType and starting edition on new draft. + */ + public const CONTENT_TYPE_PUBLISH_AND_EDIT = 'contentType.update.publishAndEditContentType'; + /** * Triggered when removing the draft (e.g. "cancel" action). */ diff --git a/src/lib/Form/Processor/ContentType/ContentTypeFormProcessor.php b/src/lib/Form/Processor/ContentType/ContentTypeFormProcessor.php index 459e21f9e7..42258184ee 100644 --- a/src/lib/Form/Processor/ContentType/ContentTypeFormProcessor.php +++ b/src/lib/Form/Processor/ContentType/ContentTypeFormProcessor.php @@ -67,6 +67,7 @@ public static function getSubscribedEvents() FormEvents::CONTENT_TYPE_ADD_FIELD_DEFINITION => 'processAddFieldDefinition', FormEvents::CONTENT_TYPE_REMOVE_FIELD_DEFINITION => 'processRemoveFieldDefinition', FormEvents::CONTENT_TYPE_PUBLISH => 'processPublishContentType', + FormEvents::CONTENT_TYPE_PUBLISH_AND_EDIT => 'processPublishAndEditContentType', FormEvents::CONTENT_TYPE_REMOVE_DRAFT => 'processRemoveContentTypeDraft', ]; } @@ -168,6 +169,19 @@ public function processPublishContentType(FormActionEvent $event) } } + public function processPublishAndEditContentType(FormActionEvent $event) + { + $eventData = $event->getData(); + /** @var ContentTypeDraft $contentTypeDraft */ + $contentTypeDraft = $eventData->contentTypeDraft; + $languageCode = $eventData->languageCode; + + $this->contentTypeService->publishContentTypeDraft($contentTypeDraft); + + $contentType = $this->contentTypeService->loadContentType($contentTypeDraft->id, [$languageCode]); + $this->contentTypeService->createContentTypeDraft($contentType); + } + public function processRemoveContentTypeDraft(FormActionEvent $event) { $contentTypeDraft = $event->getData()->contentTypeDraft; diff --git a/src/lib/Form/Type/ContentType/ContentTypeUpdateType.php b/src/lib/Form/Type/ContentType/ContentTypeUpdateType.php index dfc26f880e..516951260f 100644 --- a/src/lib/Form/Type/ContentType/ContentTypeUpdateType.php +++ b/src/lib/Form/Type/ContentType/ContentTypeUpdateType.php @@ -115,6 +115,9 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('publishContentType', SubmitType::class, [ 'label' => /** @Desc("OK") */ 'content_type.publish', ]) + ->add('publishAndEditContentType', SubmitType::class, [ + 'label' => /** @Desc("Save") */ 'content_type.publish_and_edit', + ]) ; } } diff --git a/src/lib/Menu/Admin/ContentType/AbstractContentTypeRightSidebarBuilder.php b/src/lib/Menu/Admin/ContentType/AbstractContentTypeRightSidebarBuilder.php index 7fb95b14bb..c18b7688bd 100644 --- a/src/lib/Menu/Admin/ContentType/AbstractContentTypeRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/ContentType/AbstractContentTypeRightSidebarBuilder.php @@ -22,18 +22,33 @@ public function createStructure(array $options): ItemInterface $menu = $this->factory->createItem('root'); $itemSaveIdentifier = $this->getItemSaveIdentifier(); + $itemPublishAndEditIdentifier = $this->getItemPublishAndEditIdentifier(); $itemCancelIdentifier = $this->getItemCancelIdentifier(); + $publishItem = $this->createMenuItem( + $itemSaveIdentifier, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => sprintf('#%s', $contentTypeFormView['publishContentType']->vars['id']), + ], + ] + ); + + $publishAndEditItem = $this->createMenuItem( + $itemPublishAndEditIdentifier, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => sprintf('#%s', $contentTypeFormView['publishAndEditContentType']->vars['id']), + ], + ] + ); + + $publishItem->addChild($publishAndEditItem); + $menu->setChildren([ - $itemSaveIdentifier => $this->createMenuItem( - $itemSaveIdentifier, - [ - 'attributes' => [ - 'class' => 'ibexa-btn--trigger ibexa-btn--save-content-type', - 'data-click' => sprintf('#%s', $contentTypeFormView['publishContentType']->vars['id']), - ], - ] - ), + $itemSaveIdentifier => $publishItem, $itemCancelIdentifier => $this->createMenuItem( $itemCancelIdentifier, [ @@ -50,5 +65,7 @@ public function createStructure(array $options): ItemInterface abstract public function getItemSaveIdentifier(): string; + abstract public function getItemPublishAndEditIdentifier(): string; + abstract public function getItemCancelIdentifier(): string; } diff --git a/src/lib/Menu/Admin/ContentType/ContentTypeCreateRightSidebarBuilder.php b/src/lib/Menu/Admin/ContentType/ContentTypeCreateRightSidebarBuilder.php index fbcb772190..182401cba3 100644 --- a/src/lib/Menu/Admin/ContentType/ContentTypeCreateRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/ContentType/ContentTypeCreateRightSidebarBuilder.php @@ -19,6 +19,7 @@ class ContentTypeCreateRightSidebarBuilder extends AbstractContentTypeRightSideb { /* Menu items */ public const ITEM__SAVE = 'content_type_create__sidebar_right__save'; + public const ITEM__PUBLISH_AND_EDIT = 'content_type_create__sidebar_right__publish_and_edit'; public const ITEM__CANCEL = 'content_type_create__sidebar_right__cancel'; protected function getConfigureEventName(): string @@ -32,8 +33,9 @@ protected function getConfigureEventName(): string public static function getTranslationMessages(): array { return [ - (new Message(self::ITEM__SAVE, 'ibexa_menu'))->setDesc('Create'), - (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Cancel'), + (new Message(self::ITEM__SAVE, 'ibexa_menu'))->setDesc('Save and close'), + (new Message(self::ITEM__PUBLISH_AND_EDIT, 'ibexa_menu'))->setDesc('Save'), + (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard'), ]; } @@ -42,6 +44,11 @@ public function getItemSaveIdentifier(): string return self::ITEM__SAVE; } + public function getItemPublishAndEditIdentifier(): string + { + return self::ITEM__PUBLISH_AND_EDIT; + } + public function getItemCancelIdentifier(): string { return self::ITEM__CANCEL; diff --git a/src/lib/Menu/Admin/ContentType/ContentTypeEditRightSidebarBuilder.php b/src/lib/Menu/Admin/ContentType/ContentTypeEditRightSidebarBuilder.php index 852c6e1401..d04c70d522 100644 --- a/src/lib/Menu/Admin/ContentType/ContentTypeEditRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/ContentType/ContentTypeEditRightSidebarBuilder.php @@ -19,6 +19,7 @@ class ContentTypeEditRightSidebarBuilder extends AbstractContentTypeRightSidebar { /* Menu items */ public const ITEM__SAVE = 'content_type_edit__sidebar_right__save'; + public const ITEM__PUBLISH_AND_EDIT = 'content_type_edit__sidebar_right__publish_and_edit'; public const ITEM__CANCEL = 'content_type_edit__sidebar_right__cancel'; protected function getConfigureEventName(): string @@ -32,8 +33,9 @@ protected function getConfigureEventName(): string public static function getTranslationMessages(): array { return [ - (new Message(self::ITEM__SAVE, 'ibexa_menu'))->setDesc('Save'), - (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Cancel'), + (new Message(self::ITEM__SAVE, 'ibexa_menu'))->setDesc('Save and close'), + (new Message(self::ITEM__PUBLISH_AND_EDIT, 'ibexa_menu'))->setDesc('Save'), + (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Delete draft'), ]; } @@ -42,6 +44,11 @@ public function getItemSaveIdentifier(): string return self::ITEM__SAVE; } + public function getItemPublishAndEditIdentifier(): string + { + return self::ITEM__PUBLISH_AND_EDIT; + } + public function getItemCancelIdentifier(): string { return self::ITEM__CANCEL; From bd4575674abcda9727100354ff8b679eb5827e0b Mon Sep 17 00:00:00 2001 From: tischsoic Date: Fri, 18 Aug 2023 19:25:14 +0200 Subject: [PATCH 03/40] sections menus --- src/bundle/Controller/SectionController.php | 21 +++++++++-- .../Resources/translations/forms.en.xliff | 10 ++++++ .../translations/ibexa_menu.en.xliff | 18 +++++++--- .../themes/admin/section/create.html.twig | 1 + .../themes/admin/section/update.html.twig | 1 + .../themes/admin/user/role/edit.html.twig | 2 +- .../Form/Type/Section/SectionCreateType.php | 6 ++++ .../Form/Type/Section/SectionUpdateType.php | 10 ++++-- .../Menu/SectionCreateRightSidebarBuilder.php | 36 +++++++++++++------ .../Menu/SectionEditRightSidebarBuilder.php | 32 ++++++++++++----- 10 files changed, 107 insertions(+), 30 deletions(-) diff --git a/src/bundle/Controller/SectionController.php b/src/bundle/Controller/SectionController.php index e699a8d184..bba8bed5ab 100644 --- a/src/bundle/Controller/SectionController.php +++ b/src/bundle/Controller/SectionController.php @@ -18,6 +18,8 @@ use Ibexa\AdminUi\Form\DataMapper\SectionUpdateMapper; use Ibexa\AdminUi\Form\Factory\FormFactory; use Ibexa\AdminUi\Form\SubmitHandler; +use Ibexa\AdminUi\Form\Type\Section\SectionCreateType; +use Ibexa\AdminUi\Form\Type\Section\SectionUpdateType; use Ibexa\AdminUi\UI\Service\PathService; use Ibexa\Bundle\AdminUi\View\EzPagerfantaView; use Ibexa\Bundle\AdminUi\View\Template\EzPagerfantaTemplate; @@ -38,6 +40,7 @@ use JMS\TranslationBundle\Annotation\Desc; use Pagerfanta\Adapter\ArrayAdapter; use Pagerfanta\Pagerfanta; +use Symfony\Component\Form\Button; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -414,6 +417,14 @@ public function createAction(Request $request): Response 'ibexa_section' ); + if ($form->getClickedButton() instanceof Button + && $form->getClickedButton()->getName() === SectionCreateType::BTN_CREATE_AND_EDIT + ) { + return $this->redirectToRoute('ibexa.section.update', [ + 'sectionId' => $section->id, + ]); + } + return new RedirectResponse($this->generateUrl('ibexa.section.view', [ 'sectionId' => $section->id, ])); @@ -456,9 +467,13 @@ public function updateAction(Request $request, Section $section): Response 'ibexa_section' ); - return new RedirectResponse($this->generateUrl('ibexa.section.view', [ - 'sectionId' => $section->id, - ])); + if ($form->getClickedButton() instanceof Button + && $form->getClickedButton()->getName() === SectionUpdateType::BTN_UPDATE + ) { + return new RedirectResponse($this->generateUrl('ibexa.section.view', [ + 'sectionId' => $section->id, + ])); + } } catch (Exception $e) { $this->notificationHandler->error(/** @Ignore */ $e->getMessage() diff --git a/src/bundle/Resources/translations/forms.en.xliff b/src/bundle/Resources/translations/forms.en.xliff index 05f3b04704..cdfb26eb82 100644 --- a/src/bundle/Resources/translations/forms.en.xliff +++ b/src/bundle/Resources/translations/forms.en.xliff @@ -266,6 +266,16 @@ Create key: section_create_form.create + + Save and edit + Save and edit + key: section_create_form.create_and_edit + + + Save and edit + Save and edit + key: section_create_form.update_and_edit + Delete Delete diff --git a/src/bundle/Resources/translations/ibexa_menu.en.xliff b/src/bundle/Resources/translations/ibexa_menu.en.xliff index 9e2591a126..ff1b33a8ca 100644 --- a/src/bundle/Resources/translations/ibexa_menu.en.xliff +++ b/src/bundle/Resources/translations/ibexa_menu.en.xliff @@ -382,15 +382,20 @@ key: role_edit__sidebar_right__save - Discard changes - Discard changes + Discard + Discard key: section_create__sidebar_right__cancel - Create - Create + Save and close + Save and close key: section_create__sidebar_right__create + + Save + Save + key: section_create__sidebar_right__create_and_edit + Discard changes Discard changes @@ -401,6 +406,11 @@ Save key: section_edit__sidebar_right__save + + Save and close + Save and close + key: section_edit__sidebar_right__save_and_close + Bookmarks Bookmarks diff --git a/src/bundle/Resources/views/themes/admin/section/create.html.twig b/src/bundle/Resources/views/themes/admin/section/create.html.twig index 5f0e27aa44..286b87a563 100644 --- a/src/bundle/Resources/views/themes/admin/section/create.html.twig +++ b/src/bundle/Resources/views/themes/admin/section/create.html.twig @@ -23,5 +23,6 @@ {{ form_widget(form_section_create.create, {'attr': {'hidden': 'hidden'}}) }} + {{ form_widget(form_section_create.create_and_edit, { attr: { hidden: 'hidden' }}) }} {{ form_end(form_section_create) }} {% endblock %} diff --git a/src/bundle/Resources/views/themes/admin/section/update.html.twig b/src/bundle/Resources/views/themes/admin/section/update.html.twig index e55964a6c2..82f72118b2 100644 --- a/src/bundle/Resources/views/themes/admin/section/update.html.twig +++ b/src/bundle/Resources/views/themes/admin/section/update.html.twig @@ -25,5 +25,6 @@ {{ form_widget(form_section_update.update, {'attr': {'hidden': 'hidden'}}) }} + {{ form_widget(form_section_update.update_and_edit, { attr: { hidden: 'hidden' }}) }} {{ form_end(form_section_update) }} {% endblock %} diff --git a/src/bundle/Resources/views/themes/admin/user/role/edit.html.twig b/src/bundle/Resources/views/themes/admin/user/role/edit.html.twig index bc725d2f56..54825b436b 100644 --- a/src/bundle/Resources/views/themes/admin/user/role/edit.html.twig +++ b/src/bundle/Resources/views/themes/admin/user/role/edit.html.twig @@ -15,7 +15,7 @@ {% endblock %} {% block form %} - {{ form_start(form, {'attr': {'class': 'update-section'}}) }} + {{ form_start(form, {'attr': {'class': 'update-role'}}) }}
diff --git a/src/lib/Form/Type/Section/SectionCreateType.php b/src/lib/Form/Type/Section/SectionCreateType.php index 431a6b2e55..76ea8aa724 100644 --- a/src/lib/Form/Type/Section/SectionCreateType.php +++ b/src/lib/Form/Type/Section/SectionCreateType.php @@ -14,6 +14,8 @@ class SectionCreateType extends AbstractType { + public const BTN_CREATE_AND_EDIT = 'create_and_edit'; + /** @var SectionType */ protected $sectionType; @@ -33,6 +35,10 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('create', SubmitType::class, [ 'label' => /** @Desc("Create") */ 'section_create_form.create', + ]) + ->add(self::BTN_CREATE_AND_EDIT, SubmitType::class, [ + 'label' => /** @Desc("Save and edit") */ + 'section_create_form.create_and_edit', ]); } diff --git a/src/lib/Form/Type/Section/SectionUpdateType.php b/src/lib/Form/Type/Section/SectionUpdateType.php index fddbca1ac9..af194422de 100644 --- a/src/lib/Form/Type/Section/SectionUpdateType.php +++ b/src/lib/Form/Type/Section/SectionUpdateType.php @@ -14,6 +14,8 @@ class SectionUpdateType extends AbstractType { + public const BTN_UPDATE = 'update'; + /** @var SectionType */ protected $sectionType; @@ -30,9 +32,13 @@ public function buildForm(FormBuilderInterface $builder, array $options) $this->sectionType->buildForm($builder, $options); $builder - ->add('update', SubmitType::class, [ - 'label' => /** @Desc("Update") */ + ->add(self::BTN_UPDATE, SubmitType::class, [ + 'label' => /** @Desc("Save") */ 'section_update_form.update', + ]) + ->add('update_and_edit', SubmitType::class, [ + 'label' => /** @Desc("Save and edit") */ + 'section_create_form.update_and_edit', ]); } diff --git a/src/lib/Menu/SectionCreateRightSidebarBuilder.php b/src/lib/Menu/SectionCreateRightSidebarBuilder.php index 0423cb020a..32a23503ec 100644 --- a/src/lib/Menu/SectionCreateRightSidebarBuilder.php +++ b/src/lib/Menu/SectionCreateRightSidebarBuilder.php @@ -24,6 +24,7 @@ class SectionCreateRightSidebarBuilder extends AbstractBuilder implements Transl { /* Menu items */ public const ITEM__CREATE = 'section_create__sidebar_right__create'; + public const ITEM__CREATE_AND_EDIT = 'section_create__sidebar_right__create_and_edit'; public const ITEM__CANCEL = 'section_create__sidebar_right__cancel'; /** @var \Symfony\Contracts\Translation\TranslatorInterface */ @@ -61,16 +62,28 @@ public function createStructure(array $options): ItemInterface /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); + $createItem = $this->createMenuItem( + self::ITEM__CREATE, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => '#section_create_create', + ], + ] + ); + + $createItem->addChild( + self::ITEM__CREATE_AND_EDIT, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => '#section_create_create_and_edit', + ], + ] + ); + $menu->setChildren([ - self::ITEM__CREATE => $this->createMenuItem( - self::ITEM__CREATE, - [ - 'attributes' => [ - 'class' => 'ibexa-btn--trigger', - 'data-click' => '#section_create_create', - ], - ] - ), + self::ITEM__CREATE => $createItem, self::ITEM__CANCEL => $this->createMenuItem( self::ITEM__CANCEL, [ @@ -88,8 +101,9 @@ public function createStructure(array $options): ItemInterface public static function getTranslationMessages(): array { return [ - (new Message(self::ITEM__CREATE, 'ibexa_menu'))->setDesc('Create'), - (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard changes'), + (new Message(self::ITEM__CREATE, 'ibexa_menu'))->setDesc('Save and close'), + (new Message(self::ITEM__CREATE_AND_EDIT, 'ibexa_menu'))->setDesc('Save'), + (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard'), ]; } } diff --git a/src/lib/Menu/SectionEditRightSidebarBuilder.php b/src/lib/Menu/SectionEditRightSidebarBuilder.php index 7e42e87610..994fdc3e8b 100644 --- a/src/lib/Menu/SectionEditRightSidebarBuilder.php +++ b/src/lib/Menu/SectionEditRightSidebarBuilder.php @@ -25,6 +25,7 @@ class SectionEditRightSidebarBuilder extends AbstractBuilder implements Translat { /* Menu items */ public const ITEM__SAVE = 'section_edit__sidebar_right__save'; + public const ITEM__SAVE_AND_CLOSE = 'section_edit__sidebar_right__save_and_close'; public const ITEM__CANCEL = 'section_edit__sidebar_right__cancel'; /** @var \Symfony\Contracts\Translation\TranslatorInterface */ @@ -65,16 +66,28 @@ public function createStructure(array $options): ItemInterface /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); + $saveAndCloseItem = $this->createMenuItem( + self::ITEM__SAVE_AND_CLOSE, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => sprintf('#update-section-%d_update', $section->id), + ], + ] + ); + + $saveAndCloseItem->addChild( + self::ITEM__SAVE, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => sprintf('#update-section-%d_update_and_edit', $section->id), + ], + ] + ); + $menu->setChildren([ - self::ITEM__SAVE => $this->createMenuItem( - self::ITEM__SAVE, - [ - 'attributes' => [ - 'class' => 'ibexa-btn--trigger', - 'data-click' => sprintf('#update-section-%d_update', $section->id), - ], - ] - ), + self::ITEM__SAVE_AND_CLOSE => $saveAndCloseItem, self::ITEM__CANCEL => $this->createMenuItem( self::ITEM__CANCEL, [ @@ -93,6 +106,7 @@ public static function getTranslationMessages(): array { return [ (new Message(self::ITEM__SAVE, 'ibexa_menu'))->setDesc('Save'), + (new Message(self::ITEM__SAVE_AND_CLOSE, 'ibexa_menu'))->setDesc('Save and close'), (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard changes'), ]; } From 2619e1348cbb4a4052ad5a4b8b4b0cb03bb1972e Mon Sep 17 00:00:00 2001 From: tischsoic Date: Fri, 18 Aug 2023 21:14:50 +0200 Subject: [PATCH 04/40] obj state groups and obj state menus --- .../Controller/ObjectStateController.php | 21 ++++++++- .../Controller/ObjectStateGroupController.php | 23 +++++++++- .../translations/ibexa_menu.en.xliff | 32 +++++++++++--- .../translations/ibexa_object_state.en.xliff | 44 ++++++++++++++----- .../themes/admin/object_state/add.html.twig | 7 ++- .../themes/admin/object_state/edit.html.twig | 9 +++- .../object_state_group/add.html.twig | 1 + .../object_state_group/edit.html.twig | 8 +++- .../ContentType/ContentTypeFormProcessor.php | 2 +- .../ObjectState/ObjectStateCreateType.php | 7 ++- .../ObjectStateGroupCreateType.php | 7 ++- .../ObjectStateGroupUpdateType.php | 7 ++- .../ObjectState/ObjectStateUpdateType.php | 9 +++- .../ObjectStateCreateRightSidebarBuilder.php | 34 +++++++++----- .../ObjectStateEditRightSidebarBuilder.php | 33 ++++++++++---- ...ectStateGroupCreateRightSidebarBuilder.php | 36 ++++++++++----- ...bjectStateGroupEditRightSidebarBuilder.php | 33 ++++++++++---- 17 files changed, 243 insertions(+), 70 deletions(-) diff --git a/src/bundle/Controller/ObjectStateController.php b/src/bundle/Controller/ObjectStateController.php index ddb467ecac..abbb6fe814 100644 --- a/src/bundle/Controller/ObjectStateController.php +++ b/src/bundle/Controller/ObjectStateController.php @@ -29,6 +29,7 @@ use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\MVC\Symfony\Security\Authorization\Attribute; use JMS\TranslationBundle\Annotation\Desc; +use Symfony\Component\Form\Button; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -140,7 +141,7 @@ public function addAction(Request $request, ObjectStateGroup $objectStateGroup): if ($form->isSubmitted()) { $result = $this->submitHandler->handle( $form, - function (ObjectStateCreateData $data) use ($defaultLanguageCode, $objectStateGroup) { + function (ObjectStateCreateData $data) use ($defaultLanguageCode, $objectStateGroup, $form) { $createStruct = $this->objectStateService->newObjectStateCreateStruct( $data->getIdentifier() ); @@ -155,6 +156,14 @@ function (ObjectStateCreateData $data) use ($defaultLanguageCode, $objectStateGr 'ibexa_object_state' ); + if ($form->getClickedButton() instanceof Button + && $form->getClickedButton()->getName() === ObjectStateCreateType::BTN_CREATE_AND_EDIT + ) { + return $this->redirectToRoute('ibexa.object_state.state.update', [ + 'objectStateId' => $objectState->id, + ]); + } + return $this->redirectToRoute('ibexa.object_state.state.view', [ 'objectStateId' => $objectState->id, ]); @@ -267,7 +276,7 @@ public function updateAction(Request $request, ObjectState $objectState): Respon $form->handleRequest($request); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (ObjectStateUpdateData $data) { + $result = $this->submitHandler->handle($form, function (ObjectStateUpdateData $data) use ($form) { $objectState = $data->getObjectState(); $updateStruct = $this->objectStateService->newObjectStateUpdateStruct(); $updateStruct->identifier = $data->getIdentifier(); @@ -282,6 +291,14 @@ public function updateAction(Request $request, ObjectState $objectState): Respon 'ibexa_object_state' ); + if ($form->getClickedButton() instanceof Button + && $form->getClickedButton()->getName() === ObjectStateUpdateType::BTN_SAVE + ) { + return $this->redirectToRoute('ibexa.object_state.state.update', [ + 'objectStateId' => $objectState->id, + ]); + } + return $this->redirectToRoute('ibexa.object_state.state.view', [ 'objectStateId' => $objectState->id, ]); diff --git a/src/bundle/Controller/ObjectStateGroupController.php b/src/bundle/Controller/ObjectStateGroupController.php index 9657fcfc3c..d4443e60c0 100644 --- a/src/bundle/Controller/ObjectStateGroupController.php +++ b/src/bundle/Controller/ObjectStateGroupController.php @@ -14,6 +14,8 @@ use Ibexa\AdminUi\Form\Data\ObjectState\ObjectStateGroupUpdateData; use Ibexa\AdminUi\Form\Factory\FormFactory; use Ibexa\AdminUi\Form\SubmitHandler; +use Ibexa\AdminUi\Form\Type\ObjectState\ObjectStateGroupCreateType; +use Ibexa\AdminUi\Form\Type\ObjectState\ObjectStateUpdateType; use Ibexa\Contracts\AdminUi\Controller\Controller; use Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface; use Ibexa\Contracts\Core\Repository\ObjectStateService; @@ -21,6 +23,7 @@ use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\MVC\Symfony\Security\Authorization\Attribute; use JMS\TranslationBundle\Annotation\Desc; +use Symfony\Component\Form\Button; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -117,7 +120,7 @@ public function addAction(Request $request): Response if ($form->isSubmitted()) { $result = $this->submitHandler->handle( $form, - function (ObjectStateGroupCreateData $data) use ($defaultLanguageCode) { + function (ObjectStateGroupCreateData $data) use ($defaultLanguageCode, $form) { $createStruct = $this->objectStateService->newObjectStateGroupCreateStruct( $data->getIdentifier() ); @@ -132,6 +135,14 @@ function (ObjectStateGroupCreateData $data) use ($defaultLanguageCode) { 'ibexa_object_state' ); + if ($form->getClickedButton() instanceof Button + && $form->getClickedButton()->getName() === ObjectStateGroupCreateType::BTN_CREATE_AND_EDIT + ) { + return $this->redirectToRoute('ibexa.object_state.group.update', [ + 'objectStateGroupId' => $group->id, + ]); + } + return $this->redirectToRoute('ibexa.object_state.group.view', [ 'objectStateGroupId' => $group->id, ]); @@ -236,7 +247,7 @@ public function updateAction(Request $request, ObjectStateGroup $group): Respons $form->handleRequest($request); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (ObjectStateGroupUpdateData $data) { + $result = $this->submitHandler->handle($form, function (ObjectStateGroupUpdateData $data) use ($form) { $group = $data->getObjectStateGroup(); $updateStruct = $this->objectStateService->newObjectStateGroupUpdateStruct(); $updateStruct->identifier = $data->getIdentifier(); @@ -251,6 +262,14 @@ public function updateAction(Request $request, ObjectStateGroup $group): Respons 'ibexa_object_state' ); + if ($form->getClickedButton() instanceof Button + && $form->getClickedButton()->getName() === ObjectStateUpdateType::BTN_SAVE + ) { + return $this->redirectToRoute('ibexa.object_state.group.update', [ + 'objectStateGroupId' => $group->id, + ]); + } + return $this->redirectToRoute('ibexa.object_state.group.view', [ 'objectStateGroupId' => $group->id, ]); diff --git a/src/bundle/Resources/translations/ibexa_menu.en.xliff b/src/bundle/Resources/translations/ibexa_menu.en.xliff index ff1b33a8ca..54c17ec48f 100644 --- a/src/bundle/Resources/translations/ibexa_menu.en.xliff +++ b/src/bundle/Resources/translations/ibexa_menu.en.xliff @@ -287,10 +287,15 @@ key: object_state_create__sidebar_right__cancel - Create - Create + Save and close + Save and close key: object_state_create__sidebar_right__create + + Save + Save + key: object_state_create__sidebar_right__create_and_edit + Discard changes Discard changes @@ -301,16 +306,26 @@ Save key: object_state_edit__sidebar_right__save + + Save and close + Save and close + key: object_state_edit__sidebar_right__save_and_close + - Discard changes - Discard changes + Discard + Discard key: object_state_group_create__sidebar_right__cancel - Create - Create + Save and close + Save and close key: object_state_group_create__sidebar_right__create + + Save + Save + key: object_state_group_create__sidebar_right__create_and_edit + Discard changes Discard changes @@ -321,6 +336,11 @@ Save key: object_state_group_edit__sidebar_right__save + + Save and close + Save and close + key: object_state_group_edit__sidebar_right__save_and_close + Discard changes Discard changes diff --git a/src/bundle/Resources/translations/ibexa_object_state.en.xliff b/src/bundle/Resources/translations/ibexa_object_state.en.xliff index 062f0a4da1..50e4599314 100644 --- a/src/bundle/Resources/translations/ibexa_object_state.en.xliff +++ b/src/bundle/Resources/translations/ibexa_object_state.en.xliff @@ -36,6 +36,16 @@ Set key: object_state.button.set + + Save and close + Save and close + key: object_state.create.create + + + Save + Save + key: object_state.create.create_and_edit + Identifier Identifier @@ -46,11 +56,6 @@ Name key: object_state.create.name - - Create - Create - key: object_state.create.submit - Object state '%name%' created. Object state '%name%' created. @@ -101,10 +106,15 @@ Name key: object_state.update.name - + Save Save - key: object_state.update.submit + key: object_state.update.save + + + Save and close + Save and close + key: object_state.update.save_and_close Object state '%name%' updated. @@ -146,6 +156,16 @@ Delete Object state group key: object_state_group.bulk_delete.delete + + Save and close + Save and close + key: object_state_group.create.create + + + Save + Save + key: object_state_group.create.create_and_edit + Identifier Identifier @@ -156,11 +176,6 @@ Name key: object_state_group.create.name - - Create - Create - key: object_state_group.create.submit - Object state group '%name%' created. Object state group '%name%' created. @@ -231,6 +246,11 @@ Save key: object_state_group.update.save + + Save and close + Save and close + key: object_state_group.update.save_and_close + Object state group '%name%' updated. Object state group '%name%' updated. diff --git a/src/bundle/Resources/views/themes/admin/object_state/add.html.twig b/src/bundle/Resources/views/themes/admin/object_state/add.html.twig index f3980fd3ed..c91dc0367a 100644 --- a/src/bundle/Resources/views/themes/admin/object_state/add.html.twig +++ b/src/bundle/Resources/views/themes/admin/object_state/add.html.twig @@ -5,7 +5,11 @@ {% trans_default_domain 'ibexa_object_state' %} {% block header_admin %} - {% set object_state_create_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.object_state_create.sidebar_right', [], {'group_id': object_state_group.id}) %} + {% set object_state_create_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.object_state_create.sidebar_right', [], + { + group_id: object_state_group.id, + }) + %} {% include '@ibexadesign/ui/edit_header.html.twig' with { action_name: 'object_state.creating'|trans|desc('Creating'), @@ -25,5 +29,6 @@
{{ form_widget(form.create, { 'attr': { 'hidden': 'hidden' } }) }} + {{ form_widget(form.create_and_edit, { attr: { hidden: 'hidden' }}) }} {{ form_end(form) }} {% endblock %} diff --git a/src/bundle/Resources/views/themes/admin/object_state/edit.html.twig b/src/bundle/Resources/views/themes/admin/object_state/edit.html.twig index bfa7a4d1d6..30bbe90040 100644 --- a/src/bundle/Resources/views/themes/admin/object_state/edit.html.twig +++ b/src/bundle/Resources/views/themes/admin/object_state/edit.html.twig @@ -5,7 +5,13 @@ {% trans_default_domain 'ibexa_object_state' %} {% block header_admin %} - {% set object_state_edit_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.object_state_edit.sidebar_right', [], {'group_id': object_state_group.id, 'save_id': form.save.vars.id}) %} + {% set object_state_edit_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.object_state_edit.sidebar_right', [], + { + group_id: object_state_group.id, + save_id: form.save.vars.id, + save_and_close_id: form.save_and_close.vars.id, + }) + %} {% include '@ibexadesign/ui/edit_header.html.twig' with { action_name: 'object_state.editing'|trans|desc('Editing'), @@ -25,5 +31,6 @@ {{ form_widget(form.save, { 'attr': { 'hidden': 'hidden' } }) }} + {{ form_widget(form.save_and_close, { attr: { hidden: 'hidden' }}) }} {{ form_end(form) }} {% endblock %} diff --git a/src/bundle/Resources/views/themes/admin/object_state/object_state_group/add.html.twig b/src/bundle/Resources/views/themes/admin/object_state/object_state_group/add.html.twig index 2f45519438..0161241429 100644 --- a/src/bundle/Resources/views/themes/admin/object_state/object_state_group/add.html.twig +++ b/src/bundle/Resources/views/themes/admin/object_state/object_state_group/add.html.twig @@ -25,5 +25,6 @@ {{ form_widget(form.create, { 'attr': { 'hidden': 'hidden' } }) }} + {{ form_widget(form.create_and_edit, { attr: { hidden: 'hidden' }}) }} {{ form_end(form) }} {% endblock %} diff --git a/src/bundle/Resources/views/themes/admin/object_state/object_state_group/edit.html.twig b/src/bundle/Resources/views/themes/admin/object_state/object_state_group/edit.html.twig index 5ee92aaf95..3f272e9526 100644 --- a/src/bundle/Resources/views/themes/admin/object_state/object_state_group/edit.html.twig +++ b/src/bundle/Resources/views/themes/admin/object_state/object_state_group/edit.html.twig @@ -5,7 +5,12 @@ {% trans_default_domain 'ibexa_object_state' %} {% block header_admin %} - {% set object_state_group_edit_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.object_state_group_edit.sidebar_right', [], {'save_id': form.save.vars.id}) %} + {% set object_state_group_edit_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.object_state_group_edit.sidebar_right', [], + { + save_id: form.save.vars.id, + save_and_close_id: form.save_and_close.vars.id, + }) + %} {% include '@ibexadesign/ui/edit_header.html.twig' with { action_name: 'object_state_group.editing'|trans|desc('Editing'), @@ -25,5 +30,6 @@ {{ form_widget(form.save, {"attr": {"hidden": "hidden"}}) }} + {{ form_widget(form.save_and_close, { attr: { hidden: 'hidden' }}) }} {{ form_end(form) }} {% endblock %} diff --git a/src/lib/Form/Processor/ContentType/ContentTypeFormProcessor.php b/src/lib/Form/Processor/ContentType/ContentTypeFormProcessor.php index 42258184ee..797d9da09e 100644 --- a/src/lib/Form/Processor/ContentType/ContentTypeFormProcessor.php +++ b/src/lib/Form/Processor/ContentType/ContentTypeFormProcessor.php @@ -172,7 +172,7 @@ public function processPublishContentType(FormActionEvent $event) public function processPublishAndEditContentType(FormActionEvent $event) { $eventData = $event->getData(); - /** @var ContentTypeDraft $contentTypeDraft */ + /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft */ $contentTypeDraft = $eventData->contentTypeDraft; $languageCode = $eventData->languageCode; diff --git a/src/lib/Form/Type/ObjectState/ObjectStateCreateType.php b/src/lib/Form/Type/ObjectState/ObjectStateCreateType.php index 349af42751..c5db06c784 100644 --- a/src/lib/Form/Type/ObjectState/ObjectStateCreateType.php +++ b/src/lib/Form/Type/ObjectState/ObjectStateCreateType.php @@ -18,6 +18,8 @@ class ObjectStateCreateType extends AbstractType { + public const BTN_CREATE_AND_EDIT = 'create_and_edit'; + /** * {@inheritdoc} */ @@ -31,7 +33,10 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'label' => /** @Desc("Name") */ 'object_state.create.name', ]) ->add('create', SubmitType::class, [ - 'label' => /** @Desc("Create") */ 'object_state.create.submit', + 'label' => /** @Desc("Save and close") */ 'object_state.create.create', + ]) + ->add(self::BTN_CREATE_AND_EDIT, SubmitType::class, [ + 'label' => /** @Desc("Save") */ 'object_state.create.create_and_edit', ]); } diff --git a/src/lib/Form/Type/ObjectState/ObjectStateGroupCreateType.php b/src/lib/Form/Type/ObjectState/ObjectStateGroupCreateType.php index acdbe7b569..bc9d81baab 100644 --- a/src/lib/Form/Type/ObjectState/ObjectStateGroupCreateType.php +++ b/src/lib/Form/Type/ObjectState/ObjectStateGroupCreateType.php @@ -18,6 +18,8 @@ class ObjectStateGroupCreateType extends AbstractType { + public const BTN_CREATE_AND_EDIT = 'create_and_edit'; + /** * {@inheritdoc} */ @@ -31,7 +33,10 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'label' => /** @Desc("Name") */ 'object_state_group.create.name', ]) ->add('create', SubmitType::class, [ - 'label' => /** @Desc("Create") */ 'object_state_group.create.submit', + 'label' => /** @Desc("Save and close") */ 'object_state_group.create.create', + ]) + ->add(self::BTN_CREATE_AND_EDIT, SubmitType::class, [ + 'label' => /** @Desc("Save") */ 'object_state_group.create.create_and_edit', ]); } diff --git a/src/lib/Form/Type/ObjectState/ObjectStateGroupUpdateType.php b/src/lib/Form/Type/ObjectState/ObjectStateGroupUpdateType.php index 010d8dc892..2f6f59a597 100644 --- a/src/lib/Form/Type/ObjectState/ObjectStateGroupUpdateType.php +++ b/src/lib/Form/Type/ObjectState/ObjectStateGroupUpdateType.php @@ -18,6 +18,8 @@ class ObjectStateGroupUpdateType extends AbstractType { + public const BTN_SAVE = 'save'; + /** * {@inheritdoc} */ @@ -30,8 +32,11 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('name', TextType::class, [ 'label' => /** @Desc("Name") */ 'object_state_group.update.name', ]) - ->add('save', SubmitType::class, [ + ->add(self::BTN_SAVE, SubmitType::class, [ 'label' => /** @Desc("Save") */ 'object_state_group.update.save', + ]) + ->add('save_and_close', SubmitType::class, [ + 'label' => /** @Desc("Save and close") */ 'object_state_group.update.save_and_close', ]); } diff --git a/src/lib/Form/Type/ObjectState/ObjectStateUpdateType.php b/src/lib/Form/Type/ObjectState/ObjectStateUpdateType.php index efd3f1f40c..5055b080de 100644 --- a/src/lib/Form/Type/ObjectState/ObjectStateUpdateType.php +++ b/src/lib/Form/Type/ObjectState/ObjectStateUpdateType.php @@ -18,6 +18,8 @@ class ObjectStateUpdateType extends AbstractType { + public const BTN_SAVE = 'save'; + /** * {@inheritdoc} */ @@ -30,8 +32,11 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('name', TextType::class, [ 'label' => /** @Desc("Name") */ 'object_state.update.name', ]) - ->add('save', SubmitType::class, [ - 'label' => /** @Desc("Save") */ 'object_state.update.submit', + ->add(self::BTN_SAVE, SubmitType::class, [ + 'label' => /** @Desc("Save") */ 'object_state.update.save', + ]) + ->add('save_and_close', SubmitType::class, [ + 'label' => /** @Desc("Save and close") */ 'object_state.update.save_and_close', ]); } diff --git a/src/lib/Menu/Admin/ObjectState/ObjectStateCreateRightSidebarBuilder.php b/src/lib/Menu/Admin/ObjectState/ObjectStateCreateRightSidebarBuilder.php index 4be4d90feb..fdabe7222f 100644 --- a/src/lib/Menu/Admin/ObjectState/ObjectStateCreateRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/ObjectState/ObjectStateCreateRightSidebarBuilder.php @@ -24,6 +24,7 @@ class ObjectStateCreateRightSidebarBuilder extends AbstractBuilder implements Tr { /* Menu items */ public const ITEM__CREATE = 'object_state_create__sidebar_right__create'; + public const ITEM__CREATE_AND_EDIT = 'object_state_create__sidebar_right__create_and_edit'; public const ITEM__CANCEL = 'object_state_create__sidebar_right__cancel'; /** @@ -50,16 +51,28 @@ public function createStructure(array $options): ItemInterface /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); + $createItem = $this->createMenuItem( + self::ITEM__CREATE, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => '#object_state_create_create', + ], + ] + ); + + $createItem->addChild( + self::ITEM__CREATE_AND_EDIT, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => '#object_state_create_create_and_edit', + ], + ] + ); + $menu->setChildren([ - self::ITEM__CREATE => $this->createMenuItem( - self::ITEM__CREATE, - [ - 'attributes' => [ - 'class' => 'ibexa-btn--trigger', - 'data-click' => '#object_state_create_create', - ], - ] - ), + self::ITEM__CREATE => $createItem, self::ITEM__CANCEL => $this->createMenuItem( self::ITEM__CANCEL, [ @@ -80,7 +93,8 @@ public function createStructure(array $options): ItemInterface public static function getTranslationMessages(): array { return [ - (new Message(self::ITEM__CREATE, 'ibexa_menu'))->setDesc('Create'), + (new Message(self::ITEM__CREATE, 'ibexa_menu'))->setDesc('Save and close'), + (new Message(self::ITEM__CREATE_AND_EDIT, 'ibexa_menu'))->setDesc('Save'), (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard changes'), ]; } diff --git a/src/lib/Menu/Admin/ObjectState/ObjectStateEditRightSidebarBuilder.php b/src/lib/Menu/Admin/ObjectState/ObjectStateEditRightSidebarBuilder.php index 5bd173ed8b..cfbb8291b9 100644 --- a/src/lib/Menu/Admin/ObjectState/ObjectStateEditRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/ObjectState/ObjectStateEditRightSidebarBuilder.php @@ -24,6 +24,7 @@ class ObjectStateEditRightSidebarBuilder extends AbstractBuilder implements Tran { /* Menu items */ public const ITEM__SAVE = 'object_state_edit__sidebar_right__save'; + public const ITEM__SAVE_AND_CLOSE = 'object_state_edit__sidebar_right__save_and_close'; public const ITEM__CANCEL = 'object_state_edit__sidebar_right__cancel'; /** @@ -47,20 +48,33 @@ public function createStructure(array $options): ItemInterface { $groupId = $options['group_id']; $saveId = $options['save_id']; + $saveAncCloseId = $options['save_and_close_id']; /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); + $saveAndCloseItem = $this->createMenuItem( + self::ITEM__SAVE_AND_CLOSE, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => sprintf('#%s', $saveAncCloseId), + ], + ] + ); + + $saveAndCloseItem->addChild( + self::ITEM__SAVE, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => sprintf('#%s', $saveId), + ], + ] + ); + $menu->setChildren([ - self::ITEM__SAVE => $this->createMenuItem( - self::ITEM__SAVE, - [ - 'attributes' => [ - 'class' => 'ibexa-btn--trigger', - 'data-click' => sprintf('#%s', $saveId), - ], - ] - ), + self::ITEM__SAVE => $saveAndCloseItem, self::ITEM__CANCEL => $this->createMenuItem( self::ITEM__CANCEL, [ @@ -82,6 +96,7 @@ public static function getTranslationMessages(): array { return [ (new Message(self::ITEM__SAVE, 'ibexa_menu'))->setDesc('Save'), + (new Message(self::ITEM__SAVE_AND_CLOSE, 'ibexa_menu'))->setDesc('Save and close'), (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard changes'), ]; } diff --git a/src/lib/Menu/Admin/ObjectState/ObjectStateGroupCreateRightSidebarBuilder.php b/src/lib/Menu/Admin/ObjectState/ObjectStateGroupCreateRightSidebarBuilder.php index 19f1156a18..6b64b682f9 100644 --- a/src/lib/Menu/Admin/ObjectState/ObjectStateGroupCreateRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/ObjectState/ObjectStateGroupCreateRightSidebarBuilder.php @@ -27,6 +27,7 @@ class ObjectStateGroupCreateRightSidebarBuilder extends AbstractBuilder implemen { /* Menu items */ public const ITEM__CREATE = 'object_state_group_create__sidebar_right__create'; + public const ITEM__CREATE_AND_EDIT = 'object_state_group_create__sidebar_right__create_and_edit'; public const ITEM__CANCEL = 'object_state_group_create__sidebar_right__cancel'; /** @var \Symfony\Contracts\Translation\TranslatorInterface */ @@ -64,16 +65,28 @@ public function createStructure(array $options): ItemInterface /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); + $createItem = $this->createMenuItem( + self::ITEM__CREATE, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => '#object_state_group_create_create', + ], + ] + ); + + $createItem->addChild( + self::ITEM__CREATE_AND_EDIT, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => '#object_state_group_create_create_and_edit', + ], + ] + ); + $menu->setChildren([ - self::ITEM__CREATE => $this->createMenuItem( - self::ITEM__CREATE, - [ - 'attributes' => [ - 'class' => 'ibexa-btn--trigger', - 'data-click' => '#object_state_group_create_create', - ], - ] - ), + self::ITEM__CREATE => $createItem, self::ITEM__CANCEL => $this->createMenuItem( self::ITEM__CANCEL, [ @@ -91,8 +104,9 @@ public function createStructure(array $options): ItemInterface public static function getTranslationMessages(): array { return [ - (new Message(self::ITEM__CREATE, 'ibexa_menu'))->setDesc('Create'), - (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard changes'), + (new Message(self::ITEM__CREATE, 'ibexa_menu'))->setDesc('Save and close'), + (new Message(self::ITEM__CREATE_AND_EDIT, 'ibexa_menu'))->setDesc('Save'), + (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard'), ]; } } diff --git a/src/lib/Menu/Admin/ObjectState/ObjectStateGroupEditRightSidebarBuilder.php b/src/lib/Menu/Admin/ObjectState/ObjectStateGroupEditRightSidebarBuilder.php index 93e8868fe2..01aaa43d95 100644 --- a/src/lib/Menu/Admin/ObjectState/ObjectStateGroupEditRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/ObjectState/ObjectStateGroupEditRightSidebarBuilder.php @@ -27,6 +27,7 @@ class ObjectStateGroupEditRightSidebarBuilder extends AbstractBuilder implements { /* Menu items */ public const ITEM__SAVE = 'object_state_group_edit__sidebar_right__save'; + public const ITEM__SAVE_AND_CLOSE = 'object_state_group_edit__sidebar_right__save_and_close'; public const ITEM__CANCEL = 'object_state_group_edit__sidebar_right__cancel'; /** @var \Symfony\Contracts\Translation\TranslatorInterface */ @@ -62,20 +63,33 @@ protected function getConfigureEventName(): string public function createStructure(array $options): ItemInterface { $saveId = $options['save_id']; + $saveAncCloseId = $options['save_and_close_id']; /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); + $saveAndCloseItem = $this->createMenuItem( + self::ITEM__SAVE_AND_CLOSE, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => sprintf('#%s', $saveAncCloseId), + ], + ] + ); + + $saveAndCloseItem->addChild( + self::ITEM__SAVE, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => sprintf('#%s', $saveId), + ], + ] + ); + $menu->setChildren([ - self::ITEM__SAVE => $this->createMenuItem( - self::ITEM__SAVE, - [ - 'attributes' => [ - 'class' => 'ibexa-btn--trigger', - 'data-click' => sprintf('#%s', $saveId), - ], - ] - ), + self::ITEM__SAVE_AND_CLOSE => $saveAndCloseItem, self::ITEM__CANCEL => $this->createMenuItem( self::ITEM__CANCEL, [ @@ -94,6 +108,7 @@ public static function getTranslationMessages(): array { return [ (new Message(self::ITEM__SAVE, 'ibexa_menu'))->setDesc('Save'), + (new Message(self::ITEM__SAVE_AND_CLOSE, 'ibexa_menu'))->setDesc('Save and close'), (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard changes'), ]; } From d7b0a6416bebe0a38950276137046f83a0ff1729 Mon Sep 17 00:00:00 2001 From: tischsoic Date: Thu, 24 Aug 2023 16:31:49 +0200 Subject: [PATCH 05/40] fix cotent type menu --- src/bundle/Resources/translations/ibexa_menu.en.xliff | 5 +++++ src/lib/Menu/ContentEditRightSidebarBuilder.php | 1 + 2 files changed, 6 insertions(+) diff --git a/src/bundle/Resources/translations/ibexa_menu.en.xliff b/src/bundle/Resources/translations/ibexa_menu.en.xliff index 54c17ec48f..bd615c6050 100644 --- a/src/bundle/Resources/translations/ibexa_menu.en.xliff +++ b/src/bundle/Resources/translations/ibexa_menu.en.xliff @@ -111,6 +111,11 @@ Save key: content_edit__sidebar_right__save_draft
+ + Save and close + Save and close + key: content_edit__sidebar_right__save_draft_and_close + Edit Edit diff --git a/src/lib/Menu/ContentEditRightSidebarBuilder.php b/src/lib/Menu/ContentEditRightSidebarBuilder.php index 0fb28dbdc1..27444cd239 100644 --- a/src/lib/Menu/ContentEditRightSidebarBuilder.php +++ b/src/lib/Menu/ContentEditRightSidebarBuilder.php @@ -192,6 +192,7 @@ public static function getTranslationMessages(): array return [ (new Message(self::ITEM__PUBLISH, 'ibexa_menu'))->setDesc('Publish'), (new Message(self::ITEM__SAVE_DRAFT, 'ibexa_menu'))->setDesc('Save'), + (new Message(self::ITEM__SAVE_DRAFT_AND_CLOSE, 'ibexa_menu'))->setDesc('Save and close'), (new Message(self::ITEM__PREVIEW, 'ibexa_menu'))->setDesc('Preview'), (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Delete draft'), ]; From 3bf9cec7e2dd49e1c1d8713fc615083732e5b4ba Mon Sep 17 00:00:00 2001 From: tischsoic Date: Mon, 28 Aug 2023 11:25:13 +0200 Subject: [PATCH 06/40] URL (Link Manager) & URL Wildcard --- .../Controller/LinkManagerController.php | 12 ++++++- .../Controller/URLWildcardController.php | 24 ++++++++++++-- .../ibexa_content_forms_url.en.xliff | 10 ++++++ .../translations/ibexa_menu.en.xliff | 10 ++++++ .../themes/admin/link_manager/edit.html.twig | 8 +++-- .../admin/url_wildcard/update.html.twig | 8 +++-- src/lib/Form/Type/URL/URLEditType.php | 11 ++++++- .../URLWildcard/URLWildcardUpdateType.php | 9 ++++++ src/lib/Menu/URLEditRightSidebarBuilder.php | 32 +++++++++++++------ .../URLWildcardEditRightSidebarBuilder.php | 32 +++++++++++++------ 10 files changed, 129 insertions(+), 27 deletions(-) diff --git a/src/bundle/Controller/LinkManagerController.php b/src/bundle/Controller/LinkManagerController.php index 3987242863..7bb2ccff0a 100644 --- a/src/bundle/Controller/LinkManagerController.php +++ b/src/bundle/Controller/LinkManagerController.php @@ -10,6 +10,7 @@ use Ibexa\AdminUi\Form\Data\URL\URLUpdateData; use Ibexa\AdminUi\Form\Factory\FormFactory; use Ibexa\AdminUi\Form\SubmitHandler; +use Ibexa\AdminUi\Form\Type\URL\URLEditType; use Ibexa\AdminUi\Pagination\Pagerfanta\URLUsagesAdapter; use Ibexa\Contracts\AdminUi\Controller\Controller; use Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface; @@ -17,6 +18,7 @@ use Ibexa\Core\MVC\Symfony\Security\Authorization\Attribute; use JMS\TranslationBundle\Annotation\Desc; use Pagerfanta\Pagerfanta; +use Symfony\Component\Form\Button; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -75,7 +77,7 @@ public function editAction(Request $request, int $urlId): Response $form->handleRequest($request); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (URLUpdateData $data) use ($url) { + $result = $this->submitHandler->handle($form, function (URLUpdateData $data) use ($url, $form) { $this->urlService->updateUrl($url, $data); $this->notificationHandler->success( /** @Desc("URL updated") */ @@ -84,6 +86,14 @@ public function editAction(Request $request, int $urlId): Response 'ibexa_linkmanager' ); + if ($form->getClickedButton() instanceof Button + && $form->getClickedButton()->getName() === URLEditType::BTN_SAVE + ) { + return $this->redirectToRoute('ibexa.link_manager.edit', [ + 'urlId' => $url->id, + ]); + } + return $this->redirectToRoute('ibexa.url_management'); }); diff --git a/src/bundle/Controller/URLWildcardController.php b/src/bundle/Controller/URLWildcardController.php index 810d4c6541..0294e03110 100644 --- a/src/bundle/Controller/URLWildcardController.php +++ b/src/bundle/Controller/URLWildcardController.php @@ -13,6 +13,7 @@ use Ibexa\AdminUi\Form\Data\URLWildcard\URLWildcardUpdateData; use Ibexa\AdminUi\Form\Factory\FormFactory; use Ibexa\AdminUi\Form\SubmitHandler; +use Ibexa\AdminUi\Form\Type\URLWildcard\URLWildcardUpdateType; use Ibexa\AdminUi\Tab\URLManagement\URLWildcardsTab; use Ibexa\Contracts\AdminUi\Controller\Controller; use Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface; @@ -20,6 +21,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard; use Ibexa\Contracts\Core\Repository\Values\Content\URLWildcardUpdateStruct; use JMS\TranslationBundle\Annotation\Desc; +use Symfony\Component\Form\Button; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -61,8 +63,8 @@ public function addAction(Request $request): Response $form->handleRequest($request); if ($form->isSubmitted()) { - $this->submitHandler->handle($form, function (URLWildcardData $data) { - $this->urlWildcardService->create( + $this->submitHandler->handle($form, function (URLWildcardData $data) use ($form) { + $urlWildcard = $this->urlWildcardService->create( $data->getSourceURL(), $data->getDestinationUrl(), (bool) $data->getForward() @@ -74,6 +76,14 @@ public function addAction(Request $request): Response [], 'ibexa_url_wildcard' ); + + if ($form->getClickedButton() instanceof Button + && $form->getClickedButton()->getName() === URLWildcardUpdateType::BTN_SAVE + ) { + return $this->redirectToRoute('ibexa.url_wildcard.update', [ + 'urlWildcardId' => $urlWildcard->id, + ]); + } }); } @@ -99,7 +109,7 @@ public function updateAction(URLWildcard $urlWildcard, Request $request): Respon if ($form->isSubmitted()) { $result = $this->submitHandler->handle( $form, - function (URLWildcardUpdateData $data) use ($urlWildcard) { + function (URLWildcardUpdateData $data) use ($urlWildcard, $form) { $urlWildcardUpdateStruct = new URLWildcardUpdateStruct(); $urlWildcardUpdateStruct->destinationUrl = $data->getDestinationUrl(); $urlWildcardUpdateStruct->sourceUrl = $data->getSourceURL(); @@ -117,6 +127,14 @@ function (URLWildcardUpdateData $data) use ($urlWildcard) { 'ibexa_url_wildcard' ); + if ($form->getClickedButton() instanceof Button + && $form->getClickedButton()->getName() === URLWildcardUpdateType::BTN_SAVE + ) { + return $this->redirectToRoute('ibexa.url_wildcard.update', [ + 'urlWildcardId' => $urlWildcard->id, + ]); + } + return $this->redirect($this->generateUrl('ibexa.url_management', [ '_fragment' => URLWildcardsTab::URI_FRAGMENT, ])); diff --git a/src/bundle/Resources/translations/ibexa_content_forms_url.en.xliff b/src/bundle/Resources/translations/ibexa_content_forms_url.en.xliff index 58e6449abf..8df7f2987f 100644 --- a/src/bundle/Resources/translations/ibexa_content_forms_url.en.xliff +++ b/src/bundle/Resources/translations/ibexa_content_forms_url.en.xliff @@ -6,6 +6,16 @@ The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message. + + Save + Save + key: url.save + + + Save and close + Save and close + key: url.save_and_close + All All diff --git a/src/bundle/Resources/translations/ibexa_menu.en.xliff b/src/bundle/Resources/translations/ibexa_menu.en.xliff index bd615c6050..41fae14755 100644 --- a/src/bundle/Resources/translations/ibexa_menu.en.xliff +++ b/src/bundle/Resources/translations/ibexa_menu.en.xliff @@ -476,6 +476,11 @@ Save key: url_edit__sidebar_right__save + + Save and close + Save and close + key: url_edit__sidebar_right__save_and_close + Discard changes Discard changes @@ -486,6 +491,11 @@ Save key: url_wildcard_edit__sidebar_right__save + + Save and close + Save and close + key: url_wildcard_edit__sidebar_right__save_and_close + Logout Logout diff --git a/src/bundle/Resources/views/themes/admin/link_manager/edit.html.twig b/src/bundle/Resources/views/themes/admin/link_manager/edit.html.twig index 3163e8e3de..5bebed6df7 100644 --- a/src/bundle/Resources/views/themes/admin/link_manager/edit.html.twig +++ b/src/bundle/Resources/views/themes/admin/link_manager/edit.html.twig @@ -9,7 +9,10 @@ } %} {% block header %} - {% set url_create_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.url_edit.sidebar_right', [], {'url': url}) %} + {% set url_create_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.url_edit.sidebar_right', [], { + save_and_close_selector: '#' ~ form.saveAndClose.vars.id, + save_selector: '#' ~ form.save.vars.id, + }) %} {% include '@ibexadesign/ui/edit_header.html.twig' with { action_name: 'url.editing'|trans|desc('Editing'), @@ -29,7 +32,8 @@ - + {{ form_widget(form.save, { attr: { hidden: 'hidden' }}) }} + {{ form_widget(form.save_and_close, { attr: { hidden: 'hidden' }}) }} {{ form_end(form) }} {%- endblock -%} diff --git a/src/bundle/Resources/views/themes/admin/url_wildcard/update.html.twig b/src/bundle/Resources/views/themes/admin/url_wildcard/update.html.twig index 8761ee5218..df5489ac10 100644 --- a/src/bundle/Resources/views/themes/admin/url_wildcard/update.html.twig +++ b/src/bundle/Resources/views/themes/admin/url_wildcard/update.html.twig @@ -14,7 +14,10 @@ {% endblock %} {% block context_menu %} - {% set url_create_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu_configure.url_wildcard_edit_sidebar_right', [], {'submit_selector': '#url-update',}) %} + {% set url_create_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu_configure.url_wildcard_edit_sidebar_right', [], { + submit_selector: '#' ~ form.save_and_close.vars.id, + save_selector: '#' ~ form.save.vars.id, + }) %} {{ knp_menu_render(url_create_sidebar_right, {'template': '@ibexadesign/ui/menu/context_menu.html.twig'}) }} {% endblock %} @@ -47,7 +50,8 @@ - + {{ form_widget(form.save, { attr: { hidden: 'hidden' }}) }} + {{ form_widget(form.save_and_close, { attr: { hidden: 'hidden' }}) }} {{ form_end(form) }} diff --git a/src/lib/Form/Type/URL/URLEditType.php b/src/lib/Form/Type/URL/URLEditType.php index f8b524229c..edb7b6397b 100644 --- a/src/lib/Form/Type/URL/URLEditType.php +++ b/src/lib/Form/Type/URL/URLEditType.php @@ -8,6 +8,7 @@ use Ibexa\AdminUi\Form\Data\URL\URLUpdateData; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -17,12 +18,20 @@ */ class URLEditType extends AbstractType { + public const BTN_SAVE = 'save'; + /** * {@inheritdoc} */ public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->add('url', TextType::class); + $builder->add('url', TextType::class) + ->add(self::BTN_SAVE, SubmitType::class, [ + 'label' => /** @Desc("Save") */ 'url.save', + ]) + ->add('save_and_close', SubmitType::class, [ + 'label' => /** @Desc("Save and close") */ 'url.save_and_close', + ]); } /** diff --git a/src/lib/Form/Type/URLWildcard/URLWildcardUpdateType.php b/src/lib/Form/Type/URLWildcard/URLWildcardUpdateType.php index 1519961bf5..89dbfbd461 100644 --- a/src/lib/Form/Type/URLWildcard/URLWildcardUpdateType.php +++ b/src/lib/Form/Type/URLWildcard/URLWildcardUpdateType.php @@ -12,12 +12,15 @@ use JMS\TranslationBundle\Annotation\Desc; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; final class URLWildcardUpdateType extends AbstractType { + public const BTN_SAVE = 'save'; + /** * {@inheritdoc} */ @@ -33,6 +36,12 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ->add('forward', CheckboxType::class, [ 'label' => false, 'required' => false, + ]) + ->add(self::BTN_SAVE, SubmitType::class, [ + 'label' => /** @Desc("Save") */ 'url_wildcard.save', + ]) + ->add('save_and_close', SubmitType::class, [ + 'label' => /** @Desc("Save and close") */ 'url_wildcard.save_and_close', ]); } diff --git a/src/lib/Menu/URLEditRightSidebarBuilder.php b/src/lib/Menu/URLEditRightSidebarBuilder.php index 4889e442ae..2f759e8557 100644 --- a/src/lib/Menu/URLEditRightSidebarBuilder.php +++ b/src/lib/Menu/URLEditRightSidebarBuilder.php @@ -18,6 +18,7 @@ class URLEditRightSidebarBuilder extends AbstractBuilder implements TranslationC { /* Menu items */ public const ITEM__SAVE = 'url_edit__sidebar_right__save'; + public const ITEM__SAVE_AND_CLOSE = 'url_edit__sidebar_right__save_and_close'; public const ITEM__CANCEL = 'url_edit__sidebar_right__cancel'; /** @var \Symfony\Contracts\Translation\TranslatorInterface */ @@ -46,16 +47,28 @@ protected function createStructure(array $options): ItemInterface /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); + $saveAndCloseItem = $this->createMenuItem( + self::ITEM__SAVE_AND_CLOSE, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => $options['save_and_close_selector'], + ], + ] + ); + + $saveAndCloseItem->addChild( + self::ITEM__SAVE, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => $options['save_selector'], + ], + ] + ); + $menu->setChildren([ - self::ITEM__SAVE => $this->createMenuItem( - self::ITEM__SAVE, - [ - 'attributes' => [ - 'class' => 'ibexa-btn--trigger', - 'data-click' => sprintf('#url-update', $url->id), - ], - ] - ), + self::ITEM__SAVE_AND_CLOSE => $saveAndCloseItem, self::ITEM__CANCEL => $this->createMenuItem( self::ITEM__CANCEL, [ @@ -71,6 +84,7 @@ public static function getTranslationMessages(): array { return [ (new Message(self::ITEM__SAVE, 'ibexa_menu'))->setDesc('Save'), + (new Message(self::ITEM__SAVE_AND_CLOSE, 'ibexa_menu'))->setDesc('Save and close'), (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard changes'), ]; } diff --git a/src/lib/Menu/URLWildcardEditRightSidebarBuilder.php b/src/lib/Menu/URLWildcardEditRightSidebarBuilder.php index 571db30c1f..7c30c1eb0b 100644 --- a/src/lib/Menu/URLWildcardEditRightSidebarBuilder.php +++ b/src/lib/Menu/URLWildcardEditRightSidebarBuilder.php @@ -19,6 +19,7 @@ final class URLWildcardEditRightSidebarBuilder extends AbstractBuilder implement { /* Menu items */ public const ITEM__SAVE = 'url_wildcard_edit__sidebar_right__save'; + public const ITEM__SAVE_AND_CLOSE = 'url_wildcard_edit__sidebar_right__save_and_close'; public const ITEM__CANCEL = 'url_wildcard_edit__sidebar_right__cancel'; /** @var \Symfony\Contracts\Translation\TranslatorInterface */ @@ -43,6 +44,7 @@ public static function getTranslationMessages(): array { return [ (new Message(self::ITEM__SAVE, 'ibexa_menu'))->setDesc('Save'), + (new Message(self::ITEM__SAVE_AND_CLOSE, 'ibexa_menu'))->setDesc('Save and close'), (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard changes'), ]; } @@ -57,16 +59,28 @@ protected function createStructure(array $options): ItemInterface /** @var \Knp\Menu\ItemInterface $menu */ $menu = $this->factory->createItem('root'); + $saveAndCloseItem = $this->createMenuItem( + self::ITEM__SAVE_AND_CLOSE, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => $options['submit_selector'], + ], + ] + ); + + $saveAndCloseItem->addChild( + self::ITEM__SAVE, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => $options['save_selector'], + ], + ] + ); + $menu->setChildren([ - self::ITEM__SAVE => $this->createMenuItem( - self::ITEM__SAVE, - [ - 'attributes' => [ - 'class' => 'ibexa-btn--trigger', - 'data-click' => $options['submit_selector'], - ], - ] - ), + self::ITEM__SAVE_AND_CLOSE => $saveAndCloseItem, self::ITEM__CANCEL => $this->createMenuItem( self::ITEM__CANCEL, [ From f8d9208978b87d9ed1c69174f69aeb66d306f3ff Mon Sep 17 00:00:00 2001 From: tischsoic Date: Mon, 28 Aug 2023 16:12:22 +0200 Subject: [PATCH 07/40] Policy & Role, RoleAssignment --- src/bundle/Controller/PolicyController.php | 13 +++++- src/bundle/Controller/RoleController.php | 23 +++++++++- .../Resources/translations/forms.en.xliff | 26 +++++++---- .../translations/ibexa_menu.en.xliff | 43 +++++++++++++------ .../themes/admin/user/policy/add.html.twig | 7 ++- .../policy/create_with_limitation.html.twig | 7 ++- .../themes/admin/user/policy/edit.html.twig | 9 +++- .../themes/admin/user/role/add.html.twig | 8 +++- .../themes/admin/user/role/edit.html.twig | 9 +++- .../user/role_assignment/create.html.twig | 4 +- src/lib/Form/Type/Policy/PolicyCreateType.php | 2 +- src/lib/Form/Type/Policy/PolicyUpdateType.php | 11 ++++- src/lib/Form/Type/Role/RoleCreateType.php | 2 +- src/lib/Form/Type/Role/RoleUpdateType.php | 13 +++--- .../Role/PolicyCreateRightSidebarBuilder.php | 7 +-- .../Role/PolicyEditRightSidebarBuilder.php | 37 ++++++++++------ ...oleAssignmentCreateRightSidebarBuilder.php | 4 +- .../Role/RoleCreateRightSidebarBuilder.php | 39 ++++++++++++----- .../Role/RoleEditRightSidebarBuilder.php | 34 +++++++++++---- 19 files changed, 216 insertions(+), 82 deletions(-) diff --git a/src/bundle/Controller/PolicyController.php b/src/bundle/Controller/PolicyController.php index 33a2681089..499d37d405 100644 --- a/src/bundle/Controller/PolicyController.php +++ b/src/bundle/Controller/PolicyController.php @@ -16,6 +16,7 @@ use Ibexa\AdminUi\Form\DataMapper\PolicyUpdateMapper; use Ibexa\AdminUi\Form\Factory\FormFactory; use Ibexa\AdminUi\Form\SubmitHandler; +use Ibexa\AdminUi\Form\Type\Policy\PolicyUpdateType; use Ibexa\Contracts\AdminUi\Controller\Controller; use Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; @@ -27,6 +28,7 @@ use JMS\TranslationBundle\Annotation\Desc; use Pagerfanta\Adapter\ArrayAdapter; use Pagerfanta\Pagerfanta; +use Symfony\Component\Form\Button; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -235,7 +237,7 @@ public function updateAction(Request $request, Role $role, Policy $policy): Resp $form->handleRequest($request); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (PolicyUpdateData $data) use ($role, $policy) { + $result = $this->submitHandler->handle($form, function (PolicyUpdateData $data) use ($role, $policy, $form) { $policyUpdateStruct = $this->policyUpdateMapper->reverseMap($data); $roleDraft = $this->roleService->createRoleDraft($role); @@ -255,6 +257,15 @@ public function updateAction(Request $request, Role $role, Policy $policy): Resp 'ibexa_role' ); + if ($form->getClickedButton() instanceof Button + && $form->getClickedButton()->getName() === PolicyUpdateType::BTN_SAVE + ) { + return $this->redirectToRoute('ibexa.policy.update', [ + 'roleId' => $roleDraft->id, + 'policyId' => $policy->id, + ]); + } + return new RedirectResponse($this->generateUrl('ibexa.role.view', [ 'roleId' => $role->id, ])); diff --git a/src/bundle/Controller/RoleController.php b/src/bundle/Controller/RoleController.php index a6313ee056..118d6b3a5f 100644 --- a/src/bundle/Controller/RoleController.php +++ b/src/bundle/Controller/RoleController.php @@ -19,6 +19,8 @@ use Ibexa\AdminUi\Form\Factory\FormFactory; use Ibexa\AdminUi\Form\SubmitHandler; use Ibexa\AdminUi\Form\Type\Role\RoleCopyType; +use Ibexa\AdminUi\Form\Type\Role\RoleCreateType; +use Ibexa\AdminUi\Form\Type\Role\RoleUpdateType; use Ibexa\Contracts\AdminUi\Controller\Controller; use Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface; use Ibexa\Contracts\Core\Repository\RoleService; @@ -28,6 +30,7 @@ use JMS\TranslationBundle\Annotation\Desc; use Pagerfanta\Adapter\ArrayAdapter; use Pagerfanta\Pagerfanta; +use Symfony\Component\Form\Button; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -137,7 +140,7 @@ public function createAction(Request $request): Response $form->handleRequest($request); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (RoleCreateData $data) { + $result = $this->submitHandler->handle($form, function (RoleCreateData $data) use ($form) { $roleCreateStruct = $this->roleCreateMapper->reverseMap($data); $roleDraft = $this->roleService->createRole($roleCreateStruct); $this->roleService->publishRoleDraft($roleDraft); @@ -149,6 +152,14 @@ public function createAction(Request $request): Response 'ibexa_role' ); + if ($form->getClickedButton() instanceof Button + && $form->getClickedButton()->getName() === RoleCreateType::BTN_SAVE + ) { + return $this->redirectToRoute('ibexa.role.update', [ + 'roleId' => $roleDraft->id, + ]); + } + return new RedirectResponse($this->generateUrl('ibexa.role.view', [ 'roleId' => $roleDraft->id, ])); @@ -214,7 +225,7 @@ public function updateAction(Request $request, Role $role): Response $form->handleRequest($request); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (RoleUpdateData $data) { + $result = $this->submitHandler->handle($form, function (RoleUpdateData $data) use ($form) { $role = $data->getRole(); $roleUpdateStruct = $this->roleUpdateMapper->reverseMap($data); @@ -230,6 +241,14 @@ public function updateAction(Request $request, Role $role): Response 'ibexa_role' ); + if ($form->getClickedButton() instanceof Button + && $form->getClickedButton()->getName() === RoleUpdateType::BTN_SAVE + ) { + return $this->redirectToRoute('ibexa.role.update', [ + 'roleId' => $role->id, + ]); + } + return new RedirectResponse($this->generateUrl('ibexa.role.view', [ 'roleId' => $role->id, ])); diff --git a/src/bundle/Resources/translations/forms.en.xliff b/src/bundle/Resources/translations/forms.en.xliff index cdfb26eb82..dc327c52f6 100644 --- a/src/bundle/Resources/translations/forms.en.xliff +++ b/src/bundle/Resources/translations/forms.en.xliff @@ -152,8 +152,8 @@ key: policies_delete_form.delete - Create - Create + Save + Save key: policy_create.save @@ -227,10 +227,15 @@ key: role_create.name - Create - Create + Save + Save key: role_create.save + + Save and close + Save and close + key: role_create.save_and_close + Delete Delete @@ -242,10 +247,15 @@ key: role_update.name - Update - Update + Save + Save key: role_update.save + + Save and close + Save and close + key: role_update.save_and_close + Delete Role Delete Role @@ -297,8 +307,8 @@ key: section_subtree_assign_form.assign - Update - Update + Save + Save key: section_update_form.update diff --git a/src/bundle/Resources/translations/ibexa_menu.en.xliff b/src/bundle/Resources/translations/ibexa_menu.en.xliff index 41fae14755..50fd0850ab 100644 --- a/src/bundle/Resources/translations/ibexa_menu.en.xliff +++ b/src/bundle/Resources/translations/ibexa_menu.en.xliff @@ -347,13 +347,13 @@ key: object_state_group_edit__sidebar_right__save_and_close - Discard changes - Discard changes + Discard + Discard key: policy_create__sidebar_right__cancel - Create - Create + Save and close + Save and close key: policy_create__sidebar_right__create @@ -362,18 +362,23 @@ key: policy_edit__sidebar_right__cancel - Update - Update + Save + Save key: policy_edit__sidebar_right__save + + Save and close + Save and close + key: policy_edit__sidebar_right__save_and_close + - Cancel - Cancel + Discard + Discard key: role_assignment_create__sidebar_right__cancel - Save - Save + Save and close + Save and close key: role_assignment_create__sidebar_right__save @@ -387,15 +392,20 @@ key: role_copy__sidebar_right__save - Discard changes - Discard changes + Discard + Discard key: role_create__sidebar_right__cancel - Create - Create + Save and close + Save and close key: role_create__sidebar_right__create + + Save + Save + key: role_create__sidebar_right__create_and_edit + Discard changes Discard changes @@ -406,6 +416,11 @@ Save key: role_edit__sidebar_right__save + + Save and close + Save and close + key: role_edit__sidebar_right__save_and_close + Discard Discard diff --git a/src/bundle/Resources/views/themes/admin/user/policy/add.html.twig b/src/bundle/Resources/views/themes/admin/user/policy/add.html.twig index ccc939f146..34bb32adfc 100644 --- a/src/bundle/Resources/views/themes/admin/user/policy/add.html.twig +++ b/src/bundle/Resources/views/themes/admin/user/policy/add.html.twig @@ -5,7 +5,10 @@ {% trans_default_domain 'ibexa_role' %} {% block header_admin %} - {% set policy_create_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.policy_create.sidebar_right', [], {'role': role}) %} + {% set policy_create_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.policy_create.sidebar_right', [], { + role, + save_id: form.save.vars.id, + }) %} {% include '@ibexadesign/ui/edit_header.html.twig' with { action_name: 'policy.adding'|trans|desc('Adding'), @@ -23,6 +26,6 @@ - {{ form_widget(form.save, {"attr": {"hidden": "hidden"}}) }} + {{ form_widget(form.save, { attr: { hidden: 'hidden' }}) }} {{ form_end(form) }} {% endblock %} diff --git a/src/bundle/Resources/views/themes/admin/user/policy/create_with_limitation.html.twig b/src/bundle/Resources/views/themes/admin/user/policy/create_with_limitation.html.twig index ee6f21ba0f..0707754d62 100644 --- a/src/bundle/Resources/views/themes/admin/user/policy/create_with_limitation.html.twig +++ b/src/bundle/Resources/views/themes/admin/user/policy/create_with_limitation.html.twig @@ -5,7 +5,10 @@ {% trans_default_domain 'ibexa_role' %} {% block header_admin %} - {% set policy_edit_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.policy_edit.sidebar_right', [], {'role': role, 'save_id': form.save.vars.id}) %} + {% set policy_edit_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.policy_create.sidebar_right', [], { + role, + save_id: form.save.vars.id, + }) %} {% include '@ibexadesign/ui/edit_header.html.twig' with { action_name: 'policy.editing'|trans|desc('Editing'), @@ -31,7 +34,7 @@ - {{ form_widget(form.save, {"attr": {"hidden": "hidden"}}) }} + {{ form_widget(form.save, { attr: { hidden: 'hidden' }}) }} {{ form_end(form) }} {% endblock %} diff --git a/src/bundle/Resources/views/themes/admin/user/policy/edit.html.twig b/src/bundle/Resources/views/themes/admin/user/policy/edit.html.twig index 732e40cf12..5863f5c217 100644 --- a/src/bundle/Resources/views/themes/admin/user/policy/edit.html.twig +++ b/src/bundle/Resources/views/themes/admin/user/policy/edit.html.twig @@ -5,7 +5,11 @@ {% trans_default_domain 'ibexa_role' %} {% block header_admin %} - {% set policy_edit_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.policy_edit.sidebar_right', [], {'role': role, 'save_id': form.save.vars.id}) %} + {% set policy_edit_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.policy_edit.sidebar_right', [], { + role, + save_id: form.save.vars.id, + save_and_close_id: form.save_and_close.vars.id, + }) %} {% include '@ibexadesign/ui/edit_header.html.twig' with { action_name: 'policy.editing'|trans|desc('Editing'), @@ -31,7 +35,8 @@ {% endfor %} - {{ form_widget(form.save, {"attr": {"hidden": "hidden"}}) }} + {{ form_widget(form.save, { attr: { hidden: 'hidden' }}) }} + {{ form_widget(form.save_and_close, { attr: { hidden: 'hidden' }}) }} {{ form_end(form) }} {% endblock %} diff --git a/src/bundle/Resources/views/themes/admin/user/role/add.html.twig b/src/bundle/Resources/views/themes/admin/user/role/add.html.twig index 92b0f4bfd0..2fd5857137 100644 --- a/src/bundle/Resources/views/themes/admin/user/role/add.html.twig +++ b/src/bundle/Resources/views/themes/admin/user/role/add.html.twig @@ -5,7 +5,10 @@ {% trans_default_domain 'ibexa_role' %} {% block header_admin %} - {% set role_create_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.role_create.sidebar_right') %} + {% set role_create_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.role_create.sidebar_right', [], { + save_id: form.save.vars.id, + save_and_close_id: form.save_and_close.vars.id, + }) %} {% include '@ibexadesign/ui/edit_header.html.twig' with { action_name: 'role.creating'|trans|desc('Creating'), @@ -23,6 +26,7 @@ - {{ form_widget(form.save, { 'attr': { 'hidden': 'hidden' } }) }} + {{ form_widget(form.save, { attr: { hidden: 'hidden' }}) }} + {{ form_widget(form.save_and_close, { attr: { hidden: 'hidden' }}) }} {{ form_end(form) }} {% endblock %} diff --git a/src/bundle/Resources/views/themes/admin/user/role/edit.html.twig b/src/bundle/Resources/views/themes/admin/user/role/edit.html.twig index 54825b436b..19048378e3 100644 --- a/src/bundle/Resources/views/themes/admin/user/role/edit.html.twig +++ b/src/bundle/Resources/views/themes/admin/user/role/edit.html.twig @@ -5,7 +5,11 @@ {% trans_default_domain 'ibexa_role' %} {% block header_admin %} - {% set role_edit_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.role_edit.sidebar_right', [], {'role': role}) %} + {% set role_edit_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.role_edit.sidebar_right', [], { + role, + save_id: form.save.vars.id, + save_and_close_id: form.save_and_close.vars.id, + }) %} {% include '@ibexadesign/ui/edit_header.html.twig' with { action_name: 'role.editing'|trans|desc('Editing'), @@ -23,6 +27,7 @@ - {{ form_widget(form.save, { 'attr': { 'hidden': 'hidden' }}) }} + {{ form_widget(form.save, { attr: { hidden: 'hidden' }}) }} + {{ form_widget(form.save_and_close, { attr: { hidden: 'hidden' }}) }} {{ form_end(form) }} {% endblock %} diff --git a/src/bundle/Resources/views/themes/admin/user/role_assignment/create.html.twig b/src/bundle/Resources/views/themes/admin/user/role_assignment/create.html.twig index 154f12db52..cba30a0367 100644 --- a/src/bundle/Resources/views/themes/admin/user/role_assignment/create.html.twig +++ b/src/bundle/Resources/views/themes/admin/user/role_assignment/create.html.twig @@ -5,7 +5,9 @@ {% trans_default_domain 'ibexa_role' %} {% block header_admin %} - {% set role_assignment_create_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.role_assignment_create.sidebar_right', [], {'role': role}) %} + {% set role_assignment_create_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.role_assignment_create.sidebar_right', [], { + role, + }) %} {% include '@ibexadesign/ui/edit_header.html.twig' with { action_name: 'role_assignment.assigning'|trans|desc('Assigning'), diff --git a/src/lib/Form/Type/Policy/PolicyCreateType.php b/src/lib/Form/Type/Policy/PolicyCreateType.php index bb8e2f7abe..394bb4ea6d 100644 --- a/src/lib/Form/Type/Policy/PolicyCreateType.php +++ b/src/lib/Form/Type/Policy/PolicyCreateType.php @@ -30,7 +30,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add( 'save', SubmitType::class, - ['label' => /** @Desc("Create") */ 'policy_create.save'] + ['label' => /** @Desc("Save") */ 'policy_create.save'] ); } diff --git a/src/lib/Form/Type/Policy/PolicyUpdateType.php b/src/lib/Form/Type/Policy/PolicyUpdateType.php index 4c8d66fe4c..174fe25323 100644 --- a/src/lib/Form/Type/Policy/PolicyUpdateType.php +++ b/src/lib/Form/Type/Policy/PolicyUpdateType.php @@ -22,6 +22,8 @@ class PolicyUpdateType extends AbstractType { + public const BTN_SAVE = 'save'; + /** @var \Ibexa\Contracts\Core\Repository\RoleService */ private $roleService; @@ -51,9 +53,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) ] ) ->add( - 'save', + self::BTN_SAVE, + SubmitType::class, + ['label' => /** @Desc("Save") */ 'policy_update.save'] + ) + ->add( + 'save_and_close', SubmitType::class, - ['label' => /** @Desc("Update") */ 'policy_create.update'] + ['label' => /** @Desc("Save and close") */ 'policy_update.save_and_close'] ); $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($options) { diff --git a/src/lib/Form/Type/Role/RoleCreateType.php b/src/lib/Form/Type/Role/RoleCreateType.php index 61a08bf347..2e0b208557 100644 --- a/src/lib/Form/Type/Role/RoleCreateType.php +++ b/src/lib/Form/Type/Role/RoleCreateType.php @@ -28,7 +28,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add( 'save', SubmitType::class, - ['label' => /** @Desc("Create") */ 'role_create.save'] + ['label' => /** @Desc("Save") */ 'role_create.save'] ); } diff --git a/src/lib/Form/Type/Role/RoleUpdateType.php b/src/lib/Form/Type/Role/RoleUpdateType.php index 5afc15b058..f2d5045eda 100644 --- a/src/lib/Form/Type/Role/RoleUpdateType.php +++ b/src/lib/Form/Type/Role/RoleUpdateType.php @@ -17,6 +17,8 @@ class RoleUpdateType extends AbstractType { + public const BTN_SAVE = 'save'; + public function buildForm(FormBuilderInterface $builder, array $options) { $builder @@ -25,11 +27,12 @@ public function buildForm(FormBuilderInterface $builder, array $options) TextType::class, ['label' => /** @Desc("Name") */ 'role_update.name'] ) - ->add( - 'save', - SubmitType::class, - ['label' => /** @Desc("Update") */ 'role_update.save'] - ); + ->add(self::BTN_SAVE, SubmitType::class, [ + 'label' => /** @Desc("Save") */ 'role_update.save', + ]) + ->add('save_and_close', SubmitType::class, [ + 'label' => /** @Desc("Save and close") */ 'role_update.save_and_close', + ]); } public function configureOptions(OptionsResolver $resolver) diff --git a/src/lib/Menu/Admin/Role/PolicyCreateRightSidebarBuilder.php b/src/lib/Menu/Admin/Role/PolicyCreateRightSidebarBuilder.php index 569e434242..f52c2b3bbe 100644 --- a/src/lib/Menu/Admin/Role/PolicyCreateRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/Role/PolicyCreateRightSidebarBuilder.php @@ -45,6 +45,7 @@ public function createStructure(array $options): ItemInterface { /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role $section */ $role = $options['role']; + $saveId = $options['save_id']; /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); @@ -55,7 +56,7 @@ public function createStructure(array $options): ItemInterface [ 'attributes' => [ 'class' => 'ibexa-btn--trigger', - 'data-click' => '#policy_create_save', + 'data-click' => sprintf('#%s', $saveId), ], ] ), @@ -79,8 +80,8 @@ public function createStructure(array $options): ItemInterface public static function getTranslationMessages(): array { return [ - (new Message(self::ITEM__CREATE, 'ibexa_menu'))->setDesc('Create'), - (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard changes'), + (new Message(self::ITEM__CREATE, 'ibexa_menu'))->setDesc('Save and close'), + (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard'), ]; } } diff --git a/src/lib/Menu/Admin/Role/PolicyEditRightSidebarBuilder.php b/src/lib/Menu/Admin/Role/PolicyEditRightSidebarBuilder.php index 7a133fef66..facb023749 100644 --- a/src/lib/Menu/Admin/Role/PolicyEditRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/Role/PolicyEditRightSidebarBuilder.php @@ -22,6 +22,7 @@ class PolicyEditRightSidebarBuilder extends AbstractBuilder implements Translati { /* Menu items */ public const ITEM__SAVE = 'policy_edit__sidebar_right__save'; + public const ITEM__SAVE_AND_CLOSE = 'policy_edit__sidebar_right__save_and_close'; public const ITEM__CANCEL = 'policy_edit__sidebar_right__cancel'; /** @@ -45,23 +46,34 @@ public function createStructure(array $options): ItemInterface { /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role $section */ $role = $options['role']; - - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Policy $section */ $saveId = $options['save_id']; + $saveAncCloseId = $options['save_and_close_id']; /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); + $saveAndCloseItem = $this->createMenuItem( + self::ITEM__SAVE_AND_CLOSE, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => sprintf('#%s', $saveAncCloseId), + ], + ] + ); + + $saveAndCloseItem->addChild( + self::ITEM__SAVE, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => sprintf('#%s', $saveId), + ], + ] + ); + $menu->setChildren([ - self::ITEM__SAVE => $this->createMenuItem( - self::ITEM__SAVE, - [ - 'attributes' => [ - 'class' => 'ibexa-btn--trigger', - 'data-click' => sprintf('#%s', $saveId), - ], - ] - ), + self::ITEM__SAVE_AND_CLOSE => $saveAndCloseItem, self::ITEM__CANCEL => $this->createMenuItem( self::ITEM__CANCEL, [ @@ -82,7 +94,8 @@ public function createStructure(array $options): ItemInterface public static function getTranslationMessages(): array { return [ - (new Message(self::ITEM__SAVE, 'ibexa_menu'))->setDesc('Update'), + (new Message(self::ITEM__SAVE, 'ibexa_menu'))->setDesc('Save'), + (new Message(self::ITEM__SAVE_AND_CLOSE, 'ibexa_menu'))->setDesc('Save and close'), (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard changes'), ]; } diff --git a/src/lib/Menu/Admin/Role/RoleAssignmentCreateRightSidebarBuilder.php b/src/lib/Menu/Admin/Role/RoleAssignmentCreateRightSidebarBuilder.php index dcc9da59c4..06d5998727 100644 --- a/src/lib/Menu/Admin/Role/RoleAssignmentCreateRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/Role/RoleAssignmentCreateRightSidebarBuilder.php @@ -79,8 +79,8 @@ public function createStructure(array $options): ItemInterface public static function getTranslationMessages(): array { return [ - (new Message(self::ITEM__SAVE, 'ibexa_menu'))->setDesc('Save'), - (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Cancel'), + (new Message(self::ITEM__SAVE, 'ibexa_menu'))->setDesc('Save and close'), + (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard'), ]; } } diff --git a/src/lib/Menu/Admin/Role/RoleCreateRightSidebarBuilder.php b/src/lib/Menu/Admin/Role/RoleCreateRightSidebarBuilder.php index 5ad79915a2..be8067ce94 100644 --- a/src/lib/Menu/Admin/Role/RoleCreateRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/Role/RoleCreateRightSidebarBuilder.php @@ -25,6 +25,7 @@ class RoleCreateRightSidebarBuilder extends AbstractBuilder implements Translati { /* Menu items */ public const ITEM__CREATE = 'role_create__sidebar_right__create'; + public const ITEM__CREATE_AND_EDIT = 'role_create__sidebar_right__create_and_edit'; public const ITEM__CANCEL = 'role_create__sidebar_right__cancel'; /** @var \Symfony\Contracts\Translation\TranslatorInterface */ @@ -59,19 +60,34 @@ protected function getConfigureEventName(): string */ public function createStructure(array $options): ItemInterface { + $saveId = $options['save_id']; + $saveAncCloseId = $options['save_and_close_id']; + /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); + $saveAndCloseItem = $this->createMenuItem( + self::ITEM__CREATE, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => sprintf('#%s', $saveAncCloseId), + ], + ] + ); + + $saveAndCloseItem->addChild( + self::ITEM__CREATE_AND_EDIT, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => sprintf('#%s', $saveId), + ], + ] + ); + $menu->setChildren([ - self::ITEM__CREATE => $this->createMenuItem( - self::ITEM__CREATE, - [ - 'attributes' => [ - 'class' => 'ibexa-btn--trigger', - 'data-click' => '#role_create_save', - ], - ] - ), + self::ITEM__CREATE => $saveAndCloseItem, self::ITEM__CANCEL => $this->createMenuItem( self::ITEM__CANCEL, [ @@ -89,8 +105,9 @@ public function createStructure(array $options): ItemInterface public static function getTranslationMessages(): array { return [ - (new Message(self::ITEM__CREATE, 'ibexa_menu'))->setDesc('Create'), - (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard changes'), + (new Message(self::ITEM__CREATE, 'ibexa_menu'))->setDesc('Save and close'), + (new Message(self::ITEM__CREATE_AND_EDIT, 'ibexa_menu'))->setDesc('Save'), + (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard'), ]; } } diff --git a/src/lib/Menu/Admin/Role/RoleEditRightSidebarBuilder.php b/src/lib/Menu/Admin/Role/RoleEditRightSidebarBuilder.php index 89216142f0..3c4a7b7f31 100644 --- a/src/lib/Menu/Admin/Role/RoleEditRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/Role/RoleEditRightSidebarBuilder.php @@ -25,6 +25,7 @@ class RoleEditRightSidebarBuilder extends AbstractBuilder implements Translation { /* Menu items */ public const ITEM__SAVE = 'role_edit__sidebar_right__save'; + public const ITEM__SAVE_AND_CLOSE = 'role_edit__sidebar_right__save_and_close'; public const ITEM__CANCEL = 'role_edit__sidebar_right__cancel'; /** @var \Symfony\Contracts\Translation\TranslatorInterface */ @@ -61,20 +62,34 @@ public function createStructure(array $options): ItemInterface { /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role $role */ $role = $options['role']; + $saveId = $options['save_id']; + $saveAncCloseId = $options['save_and_close_id']; /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); + $saveAndCloseItem = $this->createMenuItem( + self::ITEM__SAVE_AND_CLOSE, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => sprintf('#%s', $saveAncCloseId), + ], + ] + ); + + $saveAndCloseItem->addChild( + self::ITEM__SAVE, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => sprintf('#%s', $saveId), + ], + ] + ); + $menu->setChildren([ - self::ITEM__SAVE => $this->createMenuItem( - self::ITEM__SAVE, - [ - 'attributes' => [ - 'class' => 'ibexa-btn--trigger', - 'data-click' => sprintf('#update-role-%d_save', $role->id), - ], - ] - ), + self::ITEM__SAVE_AND_CLOSE => $saveAndCloseItem, self::ITEM__CANCEL => $this->createMenuItem( self::ITEM__CANCEL, [ @@ -93,6 +108,7 @@ public static function getTranslationMessages(): array { return [ (new Message(self::ITEM__SAVE, 'ibexa_menu'))->setDesc('Save'), + (new Message(self::ITEM__SAVE_AND_CLOSE, 'ibexa_menu'))->setDesc('Save and close'), (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard changes'), ]; } From fe354317f6e6328e348ea7c01dda4be1508302cf Mon Sep 17 00:00:00 2001 From: tischsoic Date: Mon, 28 Aug 2023 17:34:11 +0200 Subject: [PATCH 08/40] fix RoleController --- src/lib/Form/Type/Role/RoleCreateType.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/Form/Type/Role/RoleCreateType.php b/src/lib/Form/Type/Role/RoleCreateType.php index 2e0b208557..c2f855326d 100644 --- a/src/lib/Form/Type/Role/RoleCreateType.php +++ b/src/lib/Form/Type/Role/RoleCreateType.php @@ -17,6 +17,8 @@ class RoleCreateType extends AbstractType { + public const BTN_SAVE = 'save'; + public function buildForm(FormBuilderInterface $builder, array $options) { $builder @@ -26,7 +28,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ['label' => /** @Desc("Name") */ 'role_create.name'] ) ->add( - 'save', + self::BTN_SAVE, SubmitType::class, ['label' => /** @Desc("Save") */ 'role_create.save'] ); From ff210e61e2f157c600f3df9a3da2e59bf11d0684 Mon Sep 17 00:00:00 2001 From: tischsoic Date: Mon, 28 Aug 2023 17:48:59 +0200 Subject: [PATCH 09/40] Language --- src/bundle/Controller/LanguageController.php | 23 ++++++++++- .../Resources/translations/forms.en.xliff | 19 +++++---- .../translations/ibexa_menu.en.xliff | 18 +++++++-- .../themes/admin/language/create.html.twig | 8 +++- .../themes/admin/language/edit.html.twig | 8 +++- .../Form/Type/Language/LanguageCreateType.php | 11 +++++- .../Form/Type/Language/LanguageUpdateType.php | 9 ++++- .../LanguageCreateRightSidebarBuilder.php | 39 +++++++++++++------ .../LanguageEditRightSidebarBuilder.php | 34 +++++++++++----- 9 files changed, 128 insertions(+), 41 deletions(-) diff --git a/src/bundle/Controller/LanguageController.php b/src/bundle/Controller/LanguageController.php index fa04c96650..1b8d6b65ad 100644 --- a/src/bundle/Controller/LanguageController.php +++ b/src/bundle/Controller/LanguageController.php @@ -13,6 +13,8 @@ use Ibexa\AdminUi\Form\DataMapper\LanguageCreateMapper; use Ibexa\AdminUi\Form\Factory\FormFactory; use Ibexa\AdminUi\Form\SubmitHandler; +use Ibexa\AdminUi\Form\Type\Language\LanguageCreateType; +use Ibexa\AdminUi\Form\Type\Language\LanguageUpdateType; use Ibexa\Contracts\AdminUi\Controller\Controller; use Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface; use Ibexa\Contracts\Core\Repository\LanguageService; @@ -22,6 +24,7 @@ use JMS\TranslationBundle\Annotation\Desc; use Pagerfanta\Adapter\ArrayAdapter; use Pagerfanta\Pagerfanta; +use Symfony\Component\Form\Button; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -200,7 +203,7 @@ public function createAction(Request $request): Response $form->handleRequest($request); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (LanguageCreateData $data) { + $result = $this->submitHandler->handle($form, function (LanguageCreateData $data) use ($form) { $languageCreateStruct = $this->languageCreateMapper->reverseMap($data); $language = $this->languageService->createLanguage($languageCreateStruct); @@ -211,6 +214,14 @@ public function createAction(Request $request): Response 'ibexa_language' ); + if ($form->getClickedButton() instanceof Button + && $form->getClickedButton()->getName() === LanguageCreateType::BTN_SAVE + ) { + return $this->redirectToRoute('ibexa.language.edit', [ + 'languageId' => $language->id, + ]); + } + return new RedirectResponse($this->generateUrl('ibexa.language.view', [ 'languageId' => $language->id, ])); @@ -235,7 +246,7 @@ public function editAction(Request $request, Language $language): Response $form->handleRequest($request); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (LanguageUpdateData $data) use ($language) { + $result = $this->submitHandler->handle($form, function (LanguageUpdateData $data) use ($language, $form) { $this->languageService->updateLanguageName($language, $data->getName()); $data->isEnabled() @@ -249,6 +260,14 @@ public function editAction(Request $request, Language $language): Response 'ibexa_language' ); + if ($form->getClickedButton() instanceof Button + && $form->getClickedButton()->getName() === LanguageUpdateType::BTN_SAVE + ) { + return $this->redirectToRoute('ibexa.language.edit', [ + 'languageId' => $language->id, + ]); + } + return new RedirectResponse($this->generateUrl('ibexa.language.view', [ 'languageId' => $language->id, ])); diff --git a/src/bundle/Resources/translations/forms.en.xliff b/src/bundle/Resources/translations/forms.en.xliff index dc327c52f6..2d537ba51e 100644 --- a/src/bundle/Resources/translations/forms.en.xliff +++ b/src/bundle/Resources/translations/forms.en.xliff @@ -72,10 +72,15 @@ key: ezplatform.language.create.name - Create - Create + Save + Save key: ezplatform.language.create.save + + Save and close + Save and close + key: ezplatform.language.create.save_and_close + Delete Delete @@ -96,6 +101,11 @@ Save key: ezplatform.language.update.save + + Save and close + Save and close + key: ezplatform.language.update.save_and_close + Sub-items Sub-items @@ -231,11 +241,6 @@ Save key: role_create.save - - Save and close - Save and close - key: role_create.save_and_close - Delete Delete diff --git a/src/bundle/Resources/translations/ibexa_menu.en.xliff b/src/bundle/Resources/translations/ibexa_menu.en.xliff index 50fd0850ab..27246cc09e 100644 --- a/src/bundle/Resources/translations/ibexa_menu.en.xliff +++ b/src/bundle/Resources/translations/ibexa_menu.en.xliff @@ -187,15 +187,20 @@ key: content_type_group_edit__sidebar_right__save_and_close - Cancel - Cancel + Discard + Discard key: language_create__sidebar_right__cancel - Add - Add + Save and close + Save and close key: language_create__sidebar_right__create + + Save + Save + key: language_create__sidebar_right__create_and_edit + Discard changes Discard changes @@ -206,6 +211,11 @@ Save key: language_edit__sidebar_right__save + + Save and close + Save and close + key: language_edit__sidebar_right__save_and_close + Admin Admin diff --git a/src/bundle/Resources/views/themes/admin/language/create.html.twig b/src/bundle/Resources/views/themes/admin/language/create.html.twig index 4dd2aa1653..50d1c2acf5 100644 --- a/src/bundle/Resources/views/themes/admin/language/create.html.twig +++ b/src/bundle/Resources/views/themes/admin/language/create.html.twig @@ -5,7 +5,10 @@ {% trans_default_domain 'ibexa_language' %} {% block header_admin %} - {% set language_create_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.language_create.sidebar_right') %} + {% set language_create_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.language_create.sidebar_right', [], { + save_id: form.save.vars.id, + save_and_close_id: form.save_and_close.vars.id, + }) %} {% include '@ibexadesign/ui/edit_header.html.twig' with { action_name: 'language.creating'|trans|desc('Adding'), @@ -26,6 +29,7 @@ - {{ form_widget(form.save, {"attr": {"hidden": "hidden"}}) }} + {{ form_widget(form.save, { attr: { hidden: 'hidden' }}) }} + {{ form_widget(form.save_and_close, { attr: { hidden: 'hidden' }}) }} {{ form_end(form) }} {% endblock %} diff --git a/src/bundle/Resources/views/themes/admin/language/edit.html.twig b/src/bundle/Resources/views/themes/admin/language/edit.html.twig index d84f1354fc..1e96cfc7bd 100644 --- a/src/bundle/Resources/views/themes/admin/language/edit.html.twig +++ b/src/bundle/Resources/views/themes/admin/language/edit.html.twig @@ -5,7 +5,10 @@ {% trans_default_domain 'ibexa_language' %} {% block header_admin %} - {% set language_edit_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.language_edit.sidebar_right', [], {'save_id': form.save.vars.id}) %} + {% set language_edit_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.language_edit.sidebar_right', [], { + save_id: form.save.vars.id, + save_and_close_id: form.save_and_close.vars.id, + }) %} {% include '@ibexadesign/ui/edit_header.html.twig' with { action_name: 'language.editing'|trans|desc('Editing'), @@ -24,6 +27,7 @@ - {{ form_widget(form.save, {"attr": {"hidden": "hidden"}}) }} + {{ form_widget(form.save, { attr: { hidden: 'hidden' }}) }} + {{ form_widget(form.save_and_close, { attr: { hidden: 'hidden' }}) }} {{ form_end(form) }} {% endblock %} diff --git a/src/lib/Form/Type/Language/LanguageCreateType.php b/src/lib/Form/Type/Language/LanguageCreateType.php index 35d2d7ae9c..e558ad40d0 100644 --- a/src/lib/Form/Type/Language/LanguageCreateType.php +++ b/src/lib/Form/Type/Language/LanguageCreateType.php @@ -16,6 +16,8 @@ class LanguageCreateType extends AbstractType { + public const BTN_SAVE = 'save'; + public function buildForm(FormBuilderInterface $builder, array $options) { $builder @@ -38,9 +40,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) ] ) ->add( - 'save', + self::BTN_SAVE, + SubmitType::class, + ['label' => /** @Desc("Save") */ 'ezplatform.language.create.save'] + ) + ->add( + 'save_and_close', SubmitType::class, - ['label' => /** @Desc("Create") */ 'ezplatform.language.create.save'] + ['label' => /** @Desc("Save and close") */ 'ezplatform.language.create.save_and_close'] ); } diff --git a/src/lib/Form/Type/Language/LanguageUpdateType.php b/src/lib/Form/Type/Language/LanguageUpdateType.php index 3912b9d5ad..b016298240 100644 --- a/src/lib/Form/Type/Language/LanguageUpdateType.php +++ b/src/lib/Form/Type/Language/LanguageUpdateType.php @@ -16,6 +16,8 @@ class LanguageUpdateType extends AbstractType { + public const BTN_SAVE = 'save'; + public function buildForm(FormBuilderInterface $builder, array $options) { $builder @@ -38,9 +40,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) ] ) ->add( - 'save', + self::BTN_SAVE, SubmitType::class, ['label' => /** @Desc("Save") */ 'ezplatform.language.update.save'] + ) + ->add( + 'save_and_close', + SubmitType::class, + ['label' => /** @Desc("Save and close") */ 'ezplatform.language.update.save_and_close'] ); } diff --git a/src/lib/Menu/Admin/Language/LanguageCreateRightSidebarBuilder.php b/src/lib/Menu/Admin/Language/LanguageCreateRightSidebarBuilder.php index 66648b5ba1..9649d64350 100644 --- a/src/lib/Menu/Admin/Language/LanguageCreateRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/Language/LanguageCreateRightSidebarBuilder.php @@ -25,6 +25,7 @@ class LanguageCreateRightSidebarBuilder extends AbstractBuilder implements Trans { /* Menu items */ public const ITEM__CREATE = 'language_create__sidebar_right__create'; + public const ITEM__CREATE_AND_EDIT = 'language_create__sidebar_right__create_and_edit'; public const ITEM__CANCEL = 'language_create__sidebar_right__cancel'; /** @var \Symfony\Contracts\Translation\TranslatorInterface */ @@ -59,19 +60,34 @@ protected function getConfigureEventName(): string */ public function createStructure(array $options): ItemInterface { + $saveId = $options['save_id']; + $saveAncCloseId = $options['save_and_close_id']; + /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); + $saveAndCloseItem = $this->createMenuItem( + self::ITEM__CREATE, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => sprintf('#%s', $saveAncCloseId), + ], + ] + ); + + $saveAndCloseItem->addChild( + self::ITEM__CREATE_AND_EDIT, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => sprintf('#%s', $saveId), + ], + ] + ); + $menu->setChildren([ - self::ITEM__CREATE => $this->createMenuItem( - self::ITEM__CREATE, - [ - 'attributes' => [ - 'class' => 'ibexa-btn--trigger', - 'data-click' => '#language_create_save', - ], - ] - ), + self::ITEM__CREATE => $saveAndCloseItem, self::ITEM__CANCEL => $this->createMenuItem( self::ITEM__CANCEL, [ @@ -89,8 +105,9 @@ public function createStructure(array $options): ItemInterface public static function getTranslationMessages(): array { return [ - (new Message(self::ITEM__CREATE, 'ibexa_menu'))->setDesc('Add'), - (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Cancel'), + (new Message(self::ITEM__CREATE, 'ibexa_menu'))->setDesc('Save and close'), + (new Message(self::ITEM__CREATE_AND_EDIT, 'ibexa_menu'))->setDesc('Save'), + (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard'), ]; } } diff --git a/src/lib/Menu/Admin/Language/LanguageEditRightSidebarBuilder.php b/src/lib/Menu/Admin/Language/LanguageEditRightSidebarBuilder.php index bdbc9a9359..d4c2d2bf8e 100644 --- a/src/lib/Menu/Admin/Language/LanguageEditRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/Language/LanguageEditRightSidebarBuilder.php @@ -25,6 +25,7 @@ class LanguageEditRightSidebarBuilder extends AbstractBuilder implements Transla { /* Menu items */ public const ITEM__SAVE = 'language_edit__sidebar_right__save'; + public const ITEM__SAVE_AND_CLOSE = 'language_edit__sidebar_right__save_and_close'; public const ITEM__CANCEL = 'language_edit__sidebar_right__cancel'; /** @var \Symfony\Contracts\Translation\TranslatorInterface */ @@ -59,22 +60,34 @@ protected function getConfigureEventName(): string */ public function createStructure(array $options): ItemInterface { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language $language */ $saveId = $options['save_id']; + $saveAncCloseId = $options['save_and_close_id']; /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); + $saveAndCloseItem = $this->createMenuItem( + self::ITEM__SAVE_AND_CLOSE, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => sprintf('#%s', $saveAncCloseId), + ], + ] + ); + + $saveAndCloseItem->addChild( + self::ITEM__SAVE, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => sprintf('#%s', $saveId), + ], + ] + ); + $menu->setChildren([ - self::ITEM__SAVE => $this->createMenuItem( - self::ITEM__SAVE, - [ - 'attributes' => [ - 'class' => 'ibexa-btn--trigger', - 'data-click' => sprintf('#%s', $saveId), - ], - ] - ), + self::ITEM__SAVE_AND_CLOSE => $saveAndCloseItem, self::ITEM__CANCEL => $this->createMenuItem( self::ITEM__CANCEL, [ @@ -93,6 +106,7 @@ public static function getTranslationMessages(): array { return [ (new Message(self::ITEM__SAVE, 'ibexa_menu'))->setDesc('Save'), + (new Message(self::ITEM__SAVE_AND_CLOSE, 'ibexa_menu'))->setDesc('Save and close'), (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard changes'), ]; } From 6ab5dca69545a27658eec042ee129966242d3f0a Mon Sep 17 00:00:00 2001 From: tischsoic Date: Mon, 28 Aug 2023 18:14:31 +0200 Subject: [PATCH 10/40] ContentTypeGroup --- .../Controller/ContentTypeGroupController.php | 22 ++++++++++- .../translations/ibexa_content_type.en.xliff | 9 ++++- .../translations/ibexa_menu.en.xliff | 17 +++++--- .../content_type_group/create.html.twig | 8 +++- .../content_type_group/edit.html.twig | 8 +++- .../ContentTypeGroupCreateType.php | 7 +++- .../ContentTypeGroupUpdateType.php | 7 +++- ...tentTypeGroupCreateRightSidebarBuilder.php | 39 +++++++++++++------ ...ontentTypeGroupEditRightSidebarBuilder.php | 15 +++---- 9 files changed, 98 insertions(+), 34 deletions(-) diff --git a/src/bundle/Controller/ContentTypeGroupController.php b/src/bundle/Controller/ContentTypeGroupController.php index 1a9c40614c..66eea85b64 100644 --- a/src/bundle/Controller/ContentTypeGroupController.php +++ b/src/bundle/Controller/ContentTypeGroupController.php @@ -14,6 +14,7 @@ use Ibexa\AdminUi\Form\Data\ContentTypeGroup\ContentTypeGroupUpdateData; use Ibexa\AdminUi\Form\Factory\FormFactory; use Ibexa\AdminUi\Form\SubmitHandler; +use Ibexa\AdminUi\Form\Type\ContentTypeGroup\ContentTypeGroupCreateType; use Ibexa\Contracts\AdminUi\Controller\Controller; use Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface; use Ibexa\Contracts\Core\Repository\ContentTypeService; @@ -23,6 +24,7 @@ use JMS\TranslationBundle\Annotation\Desc; use Pagerfanta\Adapter\ArrayAdapter; use Pagerfanta\Pagerfanta; +use Symfony\Component\Form\Button; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -115,7 +117,7 @@ public function createAction(Request $request): Response $form->handleRequest($request); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (ContentTypeGroupCreateData $data) { + $result = $this->submitHandler->handle($form, function (ContentTypeGroupCreateData $data) use ($form) { $createStruct = $this->contentTypeService->newContentTypeGroupCreateStruct( $data->getIdentifier() ); @@ -128,6 +130,14 @@ public function createAction(Request $request): Response 'ibexa_content_type' ); + if ($form->getClickedButton() instanceof Button + && $form->getClickedButton()->getName() === ContentTypeGroupCreateType::BTN_SAVE + ) { + return $this->redirectToRoute('ibexa.content_type_group.update', [ + 'contentTypeGroupId' => $group->id, + ]); + } + return new RedirectResponse($this->generateUrl('ibexa.content_type_group.view', [ 'contentTypeGroupId' => $group->id, ])); @@ -158,7 +168,7 @@ public function updateAction(Request $request, ContentTypeGroup $group): Respons $form->handleRequest($request); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (ContentTypeGroupUpdateData $data) { + $result = $this->submitHandler->handle($form, function (ContentTypeGroupUpdateData $data) use ($form) { $group = $data->getContentTypeGroup(); $updateStruct = $this->contentTypeService->newContentTypeGroupUpdateStruct(); $updateStruct->identifier = $data->getIdentifier(); @@ -172,6 +182,14 @@ public function updateAction(Request $request, ContentTypeGroup $group): Respons 'ibexa_content_type' ); + if ($form->getClickedButton() instanceof Button + && $form->getClickedButton()->getName() === ContentTypeGroupCreateType::BTN_SAVE + ) { + return $this->redirectToRoute('ibexa.content_type_group.update', [ + 'contentTypeGroupId' => $group->id, + ]); + } + return new RedirectResponse($this->generateUrl('ibexa.content_type_group.view', [ 'contentTypeGroupId' => $group->id, ])); diff --git a/src/bundle/Resources/translations/ibexa_content_type.en.xliff b/src/bundle/Resources/translations/ibexa_content_type.en.xliff index fdb5c93ac9..fa4772ad4f 100644 --- a/src/bundle/Resources/translations/ibexa_content_type.en.xliff +++ b/src/bundle/Resources/translations/ibexa_content_type.en.xliff @@ -386,9 +386,14 @@ Name key: content_type_group.create.name + + Save + Save + key: content_type_group.create.save + - Create - Create + Save and close + Save and close key: content_type_group.create.submit diff --git a/src/bundle/Resources/translations/ibexa_menu.en.xliff b/src/bundle/Resources/translations/ibexa_menu.en.xliff index 27246cc09e..b86041c34e 100644 --- a/src/bundle/Resources/translations/ibexa_menu.en.xliff +++ b/src/bundle/Resources/translations/ibexa_menu.en.xliff @@ -162,18 +162,23 @@ key: content_type_edit__sidebar_right__save - Discard changes - Discard changes + Discard + Discard key: content_type_group_create__sidebar_right__cancel - Create - Create + Save and close + Save and close key: content_type_group_create__sidebar_right__create + + Save + Save + key: content_type_group_create__sidebar_right__create_and_edit + - Discard - Discard + Discard changes + Discard changes key: content_type_group_edit__sidebar_right__cancel diff --git a/src/bundle/Resources/views/themes/admin/content_type/content_type_group/create.html.twig b/src/bundle/Resources/views/themes/admin/content_type/content_type_group/create.html.twig index 855ccb490c..91ffd5b5b7 100644 --- a/src/bundle/Resources/views/themes/admin/content_type/content_type_group/create.html.twig +++ b/src/bundle/Resources/views/themes/admin/content_type/content_type_group/create.html.twig @@ -5,7 +5,10 @@ {% trans_default_domain 'ibexa_content_type' %} {% block header_admin %} - {% set content_type_group_create_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.content_type_group_create.sidebar_right') %} + {% set content_type_group_create_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.content_type_group_create.sidebar_right', [], { + save_id: form.save.vars.id, + save_and_close_id: form.create.vars.id, + }) %} {% include '@ibexadesign/ui/edit_header.html.twig' with { action_name: 'content_type_group.new.action_name'|trans|desc('Creating'), @@ -24,6 +27,7 @@ - {{ form_widget(form.create, {'attr': {'hidden': 'hidden'}}) }} + {{ form_widget(form.save, { attr: { hidden: 'hidden' }}) }} + {{ form_widget(form.create, { attr: { hidden: 'hidden' }}) }} {{ form_end(form) }} {% endblock %} diff --git a/src/bundle/Resources/views/themes/admin/content_type/content_type_group/edit.html.twig b/src/bundle/Resources/views/themes/admin/content_type/content_type_group/edit.html.twig index c8f94570cf..f3f41a55f8 100644 --- a/src/bundle/Resources/views/themes/admin/content_type/content_type_group/edit.html.twig +++ b/src/bundle/Resources/views/themes/admin/content_type/content_type_group/edit.html.twig @@ -5,7 +5,10 @@ {% trans_default_domain 'ibexa_content_type' %} {% block header_admin %} - {% set content_type_group_edit_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.content_type_group_edit.sidebar_right', [], {'save_id': form.update.vars.id}) %} + {% set content_type_group_edit_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.content_type_group_edit.sidebar_right', [], { + save_id: form.save.vars.id, + save_and_close_id: form.update.vars.id, + }) %} {% include '@ibexadesign/ui/edit_header.html.twig' with { action_name: 'content_type_group.edit.action_name'|trans|desc('Editing Content Type group'), @@ -25,6 +28,7 @@ - {{ form_widget(form.update, {'attr': {'hidden': 'hidden'}}) }} + {{ form_widget(form.save, { attr: { hidden: 'hidden' }}) }} + {{ form_widget(form.update, { attr: { hidden: 'hidden' }}) }} {{ form_end(form) }} {% endblock %} diff --git a/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupCreateType.php b/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupCreateType.php index 8b5f90378f..c732d24b11 100644 --- a/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupCreateType.php +++ b/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupCreateType.php @@ -18,6 +18,8 @@ class ContentTypeGroupCreateType extends AbstractType { + public const BTN_SAVE = 'save'; + /** * {@inheritdoc} */ @@ -28,7 +30,10 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'label' => /** @Desc("Name") */ 'content_type_group.create.name', ]) ->add('create', SubmitType::class, [ - 'label' => /** @Desc("Create") */ 'content_type_group.create.submit', + 'label' => /** @Desc("Save and close") */ 'content_type_group.create.submit', + ]) + ->add(self::BTN_SAVE, SubmitType::class, [ + 'label' => /** @Desc("Save") */ 'content_type_group.create.save', ]); } diff --git a/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupUpdateType.php b/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupUpdateType.php index 14af26c4b0..73856bf235 100644 --- a/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupUpdateType.php +++ b/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupUpdateType.php @@ -18,6 +18,8 @@ class ContentTypeGroupUpdateType extends AbstractType { + public const BTN_SAVE = 'save'; + /** * {@inheritdoc} */ @@ -28,7 +30,10 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'label' => /** @Desc("Name") */ 'content_type_group.update.name', ]) ->add('update', SubmitType::class, [ - 'label' => /** @Desc("Update") */ 'content_type_group.update.submit', + 'label' => /** @Desc("Save and close") */ 'content_type_group.update.submit', + ]) + ->add(self::BTN_SAVE, SubmitType::class, [ + 'label' => /** @Desc("Save") */ 'content_type_group.update.save', ]); } diff --git a/src/lib/Menu/Admin/ContentType/ContentTypeGroupCreateRightSidebarBuilder.php b/src/lib/Menu/Admin/ContentType/ContentTypeGroupCreateRightSidebarBuilder.php index 20a7c4a1ea..3d0c166f35 100644 --- a/src/lib/Menu/Admin/ContentType/ContentTypeGroupCreateRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/ContentType/ContentTypeGroupCreateRightSidebarBuilder.php @@ -25,6 +25,7 @@ class ContentTypeGroupCreateRightSidebarBuilder extends AbstractBuilder implemen { /* Menu items */ public const ITEM__CREATE = 'content_type_group_create__sidebar_right__create'; + public const ITEM__CREATE_AND_EDIT = 'content_type_group_create__sidebar_right__create_and_edit'; public const ITEM__CANCEL = 'content_type_group_create__sidebar_right__cancel'; /** @var \Symfony\Contracts\Translation\TranslatorInterface */ @@ -59,19 +60,34 @@ protected function getConfigureEventName(): string */ public function createStructure(array $options): ItemInterface { + $saveId = $options['save_id']; + $saveAncCloseId = $options['save_and_close_id']; + /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); + $saveAndCloseItem = $this->createMenuItem( + self::ITEM__CREATE, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => sprintf('#%s', $saveAncCloseId), + ], + ] + ); + + $saveAndCloseItem->addChild( + self::ITEM__CREATE_AND_EDIT, + [ + 'attributes' => [ + 'class' => 'ibexa-btn--trigger', + 'data-click' => sprintf('#%s', $saveId), + ], + ] + ); + $menu->setChildren([ - self::ITEM__CREATE => $this->createMenuItem( - self::ITEM__CREATE, - [ - 'attributes' => [ - 'class' => 'ibexa-btn--trigger', - 'data-click' => '#content_type_group_create_create', - ], - ] - ), + self::ITEM__CREATE => $saveAndCloseItem, self::ITEM__CANCEL => $this->createMenuItem( self::ITEM__CANCEL, [ @@ -89,8 +105,9 @@ public function createStructure(array $options): ItemInterface public static function getTranslationMessages(): array { return [ - (new Message(self::ITEM__CREATE, 'ibexa_menu'))->setDesc('Create'), - (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard changes'), + (new Message(self::ITEM__CREATE, 'ibexa_menu'))->setDesc('Save and close'), + (new Message(self::ITEM__CREATE_AND_EDIT, 'ibexa_menu'))->setDesc('Save'), + (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard'), ]; } } diff --git a/src/lib/Menu/Admin/ContentType/ContentTypeGroupEditRightSidebarBuilder.php b/src/lib/Menu/Admin/ContentType/ContentTypeGroupEditRightSidebarBuilder.php index 5448971f49..d6b5fee339 100644 --- a/src/lib/Menu/Admin/ContentType/ContentTypeGroupEditRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/ContentType/ContentTypeGroupEditRightSidebarBuilder.php @@ -61,22 +61,23 @@ protected function getConfigureEventName(): string public function createStructure(array $options): ItemInterface { $saveId = $options['save_id']; + $saveAncCloseId = $options['save_and_close_id']; /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); - $saveItem = $this->createMenuItem( - self::ITEM__SAVE, + $saveAndCloseItem = $this->createMenuItem( + self::ITEM__SAVE_AND_CLOSE, [ 'attributes' => [ 'class' => 'ibexa-btn--trigger', - 'data-click' => sprintf('#%s', $saveId), + 'data-click' => sprintf('#%s', $saveAncCloseId), ], ] ); - $saveItem->addChild( - self::ITEM__SAVE_AND_CLOSE, + $saveAndCloseItem->addChild( + self::ITEM__SAVE, [ 'attributes' => [ 'class' => 'ibexa-btn--trigger', @@ -86,7 +87,7 @@ public function createStructure(array $options): ItemInterface ); $menu->setChildren([ - self::ITEM__SAVE => $saveItem, + self::ITEM__SAVE_AND_CLOSE => $saveAndCloseItem, self::ITEM__CANCEL => $this->createMenuItem( self::ITEM__CANCEL, [ @@ -106,7 +107,7 @@ public static function getTranslationMessages(): array return [ (new Message(self::ITEM__SAVE, 'ibexa_menu'))->setDesc('Save'), (new Message(self::ITEM__SAVE_AND_CLOSE, 'ibexa_menu'))->setDesc('Save and close'), - (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard'), + (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Discard changes'), ]; } } From 79638b772862fb21cc3cbc80a352bf2bc4595147 Mon Sep 17 00:00:00 2001 From: tischsoic Date: Wed, 30 Aug 2023 16:09:16 +0200 Subject: [PATCH 11/40] tests fix --- tests/lib/Form/Processor/ContentTypeFormProcessorTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/lib/Form/Processor/ContentTypeFormProcessorTest.php b/tests/lib/Form/Processor/ContentTypeFormProcessorTest.php index 56906181d2..54fe1d466c 100644 --- a/tests/lib/Form/Processor/ContentTypeFormProcessorTest.php +++ b/tests/lib/Form/Processor/ContentTypeFormProcessorTest.php @@ -71,6 +71,7 @@ public function testSubscribedEvents() FormEvents::CONTENT_TYPE_ADD_FIELD_DEFINITION => 'processAddFieldDefinition', FormEvents::CONTENT_TYPE_REMOVE_FIELD_DEFINITION => 'processRemoveFieldDefinition', FormEvents::CONTENT_TYPE_PUBLISH => 'processPublishContentType', + FormEvents::CONTENT_TYPE_PUBLISH_AND_EDIT => 'processPublishAndEditContentType', FormEvents::CONTENT_TYPE_REMOVE_DRAFT => 'processRemoveContentTypeDraft', ], ContentTypeFormProcessor::getSubscribedEvents()); } From a2708ae597d7a3a22e2b55dd50f83c9b9c596c99 Mon Sep 17 00:00:00 2001 From: tischsoic Date: Thu, 31 Aug 2023 19:11:21 +0200 Subject: [PATCH 12/40] Adjusting Behat - test 1 --- src/lib/Behat/Component/ContentActionsMenu.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/lib/Behat/Component/ContentActionsMenu.php b/src/lib/Behat/Component/ContentActionsMenu.php index 9cd4bc013e..6c0892e543 100644 --- a/src/lib/Behat/Component/ContentActionsMenu.php +++ b/src/lib/Behat/Component/ContentActionsMenu.php @@ -36,6 +36,21 @@ public function clickButton(string $buttonName): void return; } + $contextMenuSplitBtnsTogglers = $this->getHTMLPage() + ->findAll($this->getLocator('menuSplitToggler')); + + foreach($contextMenuSplitBtnsTogglers->getIterator() as $splitBtnToggler) { + $splitBtnToggler->click(); + + $matchingSubButtons = $this->getHTMLPage() + ->findAll($this->getLocator('menuSplitSubmenuButton')) + ->filterBy(new ElementTextCriterion($buttonName)); + + if ($matchingSubButtons->any()) { + $matchingSubButtons->first()->click(); + } + } + $this->getHTMLPage()->find($this->getLocator('moreButton'))->click(); $this->getHTMLPage() @@ -79,6 +94,8 @@ protected function specifyLocators(): array { return [ new VisibleCSSLocator('menuButton', '.ibexa-context-menu .ibexa-btn, .ibexa-context-menu__item .ibexa-popup-menu__item, .ibexa-context-menu .btn'), // TO DO: set one selector after redesign + new VisibleCSSLocator('menuSplitToggler', '.ibexa-context-menu .ibexa-split-btn__toggle-btn'), + new VisibleCSSLocator('menuSplitSubmenuButton', '.ibexa-popup-menu:not(.ibexa-popup-menu--hidden) .ibexa-popup-menu__item-content'), new VisibleCSSLocator('label', '.ibexa-btn__label'), new VisibleCSSLocator('moreButton', '.ibexa-context-menu__item--more'), new VisibleCSSLocator('expandedMenuButton', '.ibexa-context-menu__item .ibexa-popup-menu__item-content'), From a0e5dbc91b4fa85fa5d7f4dd5e450e1f882de02e Mon Sep 17 00:00:00 2001 From: tischsoic Date: Tue, 5 Sep 2023 09:48:53 +0200 Subject: [PATCH 13/40] fix-cs; phpstan --- src/bundle/Controller/ContentTypeGroupController.php | 2 ++ src/bundle/Controller/LanguageController.php | 2 ++ src/bundle/Controller/LinkManagerController.php | 1 + src/bundle/Controller/ObjectStateController.php | 2 ++ src/bundle/Controller/ObjectStateGroupController.php | 2 ++ src/bundle/Controller/PolicyController.php | 1 + src/bundle/Controller/RoleController.php | 2 ++ src/bundle/Controller/SectionController.php | 2 ++ src/bundle/Controller/URLWildcardController.php | 2 ++ src/lib/Behat/Component/ContentActionsMenu.php | 2 +- 10 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/bundle/Controller/ContentTypeGroupController.php b/src/bundle/Controller/ContentTypeGroupController.php index 66eea85b64..e773fe7504 100644 --- a/src/bundle/Controller/ContentTypeGroupController.php +++ b/src/bundle/Controller/ContentTypeGroupController.php @@ -111,6 +111,7 @@ public function listAction(Request $request): Response public function createAction(Request $request): Response { $this->denyAccessUnlessGranted(new Attribute('class', 'create')); + /** @var \Symfony\Component\Form\Form $form */ $form = $this->formFactory->createContentTypeGroup( new ContentTypeGroupCreateData() ); @@ -162,6 +163,7 @@ public function createAction(Request $request): Response public function updateAction(Request $request, ContentTypeGroup $group): Response { $this->denyAccessUnlessGranted(new Attribute('class', 'update')); + /** @var \Symfony\Component\Form\Form $form */ $form = $this->formFactory->updateContentTypeGroup( new ContentTypeGroupUpdateData($group) ); diff --git a/src/bundle/Controller/LanguageController.php b/src/bundle/Controller/LanguageController.php index 1b8d6b65ad..e424da9b18 100644 --- a/src/bundle/Controller/LanguageController.php +++ b/src/bundle/Controller/LanguageController.php @@ -199,6 +199,7 @@ public function bulkDeleteAction(Request $request): Response public function createAction(Request $request): Response { + /** @var \Symfony\Component\Form\Form $form */ $form = $this->formFactory->createLanguage(); $form->handleRequest($request); @@ -240,6 +241,7 @@ public function createAction(Request $request): Response public function editAction(Request $request, Language $language): Response { + /** @var \Symfony\Component\Form\Form $form */ $form = $this->formFactory->updateLanguage( new LanguageUpdateData($language) ); diff --git a/src/bundle/Controller/LinkManagerController.php b/src/bundle/Controller/LinkManagerController.php index 7bb2ccff0a..e59b8031d5 100644 --- a/src/bundle/Controller/LinkManagerController.php +++ b/src/bundle/Controller/LinkManagerController.php @@ -69,6 +69,7 @@ public function editAction(Request $request, int $urlId): Response { $url = $this->urlService->loadById($urlId); + /** @var \Symfony\Component\Form\Form $form */ $form = $this->formFactory->createUrlEditForm(new URLUpdateData([ 'id' => $url->id, 'url' => $url->url, diff --git a/src/bundle/Controller/ObjectStateController.php b/src/bundle/Controller/ObjectStateController.php index abbb6fe814..aab0572555 100644 --- a/src/bundle/Controller/ObjectStateController.php +++ b/src/bundle/Controller/ObjectStateController.php @@ -132,6 +132,7 @@ public function addAction(Request $request, ObjectStateGroup $objectStateGroup): $languages = $this->configResolver->getParameter('languages'); $defaultLanguageCode = reset($languages); + /** @var \Symfony\Component\Form\Form $form */ $form = $this->formFactory->create( ObjectStateCreateType::class, new ObjectStateCreateData() @@ -269,6 +270,7 @@ public function bulkDeleteAction(Request $request, int $objectStateGroupId): Res public function updateAction(Request $request, ObjectState $objectState): Response { $this->denyAccessUnlessGranted(new Attribute('state', 'administrate')); + /** @var \Symfony\Component\Form\Form $form */ $form = $this->formFactory->create( ObjectStateUpdateType::class, new ObjectStateUpdateData($objectState) diff --git a/src/bundle/Controller/ObjectStateGroupController.php b/src/bundle/Controller/ObjectStateGroupController.php index d4443e60c0..fe80ab0ebc 100644 --- a/src/bundle/Controller/ObjectStateGroupController.php +++ b/src/bundle/Controller/ObjectStateGroupController.php @@ -112,6 +112,7 @@ public function addAction(Request $request): Response $languages = $this->configResolver->getParameter('languages'); $defaultLanguageCode = reset($languages); + /** @var \Symfony\Component\Form\Form $form */ $form = $this->formFactory->createObjectStateGroup( new ObjectStateGroupCreateData() ); @@ -241,6 +242,7 @@ public function bulkDeleteAction(Request $request): Response public function updateAction(Request $request, ObjectStateGroup $group): Response { $this->denyAccessUnlessGranted(new Attribute('state', 'administrate')); + /** @var \Symfony\Component\Form\Form $form */ $form = $this->formFactory->updateObjectStateGroup( new ObjectStateGroupUpdateData($group) ); diff --git a/src/bundle/Controller/PolicyController.php b/src/bundle/Controller/PolicyController.php index 499d37d405..fe028b4507 100644 --- a/src/bundle/Controller/PolicyController.php +++ b/src/bundle/Controller/PolicyController.php @@ -231,6 +231,7 @@ public function updateAction(Request $request, Role $role, Policy $policy): Resp ])); } + /** @var \Symfony\Component\Form\Form $form */ $form = $this->formFactory->updatePolicy( new PolicyUpdateData($policy) ); diff --git a/src/bundle/Controller/RoleController.php b/src/bundle/Controller/RoleController.php index 118d6b3a5f..5b8f805f86 100644 --- a/src/bundle/Controller/RoleController.php +++ b/src/bundle/Controller/RoleController.php @@ -136,6 +136,7 @@ public function viewAction(Request $request, Role $role, int $policyPage = 1, in public function createAction(Request $request): Response { $this->denyAccessUnlessGranted(new Attribute('role', 'create')); + /** @var \Symfony\Component\Form\Form $form */ $form = $this->formFactory->createRole(); $form->handleRequest($request); @@ -219,6 +220,7 @@ public function copyAction(Request $request, Role $role): Response public function updateAction(Request $request, Role $role): Response { $this->denyAccessUnlessGranted(new Attribute('role', 'update')); + /** @var \Symfony\Component\Form\Form $form */ $form = $this->formFactory->updateRole( new RoleUpdateData($role) ); diff --git a/src/bundle/Controller/SectionController.php b/src/bundle/Controller/SectionController.php index bba8bed5ab..57330061ca 100644 --- a/src/bundle/Controller/SectionController.php +++ b/src/bundle/Controller/SectionController.php @@ -399,6 +399,7 @@ public function assignContentAction(Request $request, Section $section): Respons public function createAction(Request $request): Response { $this->denyAccessUnlessGranted(new Attribute('section', 'edit')); + /** @var \Symfony\Component\Form\Form $form */ $form = $this->formFactory->createSection( new SectionCreateData() ); @@ -449,6 +450,7 @@ public function createAction(Request $request): Response public function updateAction(Request $request, Section $section): Response { $this->denyAccessUnlessGranted(new Attribute('section', 'edit')); + /** @var \Symfony\Component\Form\Form $form */ $form = $this->formFactory->updateSection( new SectionUpdateData($section) ); diff --git a/src/bundle/Controller/URLWildcardController.php b/src/bundle/Controller/URLWildcardController.php index 0294e03110..18d1979cbf 100644 --- a/src/bundle/Controller/URLWildcardController.php +++ b/src/bundle/Controller/URLWildcardController.php @@ -58,6 +58,7 @@ public function __construct( */ public function addAction(Request $request): Response { + /** @var \Symfony\Component\Form\Form $form */ $form = $this->formFactory->createURLWildcard(); $form->handleRequest($request); @@ -100,6 +101,7 @@ public function addAction(Request $request): Response */ public function updateAction(URLWildcard $urlWildcard, Request $request): Response { + /** @var \Symfony\Component\Form\Form $form */ $form = $this->formFactory->createURLWildcardUpdate( new URLWildcardUpdateData($urlWildcard) ); diff --git a/src/lib/Behat/Component/ContentActionsMenu.php b/src/lib/Behat/Component/ContentActionsMenu.php index 6c0892e543..94662a76ed 100644 --- a/src/lib/Behat/Component/ContentActionsMenu.php +++ b/src/lib/Behat/Component/ContentActionsMenu.php @@ -39,7 +39,7 @@ public function clickButton(string $buttonName): void $contextMenuSplitBtnsTogglers = $this->getHTMLPage() ->findAll($this->getLocator('menuSplitToggler')); - foreach($contextMenuSplitBtnsTogglers->getIterator() as $splitBtnToggler) { + foreach ($contextMenuSplitBtnsTogglers->getIterator() as $splitBtnToggler) { $splitBtnToggler->click(); $matchingSubButtons = $this->getHTMLPage() From d033917d5938a180fb3ce30eb7ec0de2eba89baa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Wed, 6 Sep 2023 15:53:23 +0200 Subject: [PATCH 14/40] Fixed tests --- features/personas/ChangePassword.feature | 2 +- features/personas/SubtreeEditor.feature | 8 +- features/standard/Autosave.feature | 2 +- features/standard/ContentDraft.feature | 18 ++-- features/standard/ContentManagement.feature | 12 +-- features/standard/ContentPreview.feature | 2 +- features/standard/ContentTranslation.feature | 4 +- features/standard/ContentType.feature | 8 +- features/standard/ContentTypeGroup.feature | 8 +- features/standard/Languages.feature | 18 ++-- features/standard/MyDrafts.feature | 2 +- features/standard/ObjectStates.feature | 26 +++--- features/standard/Roles.feature | 24 +++--- features/standard/Sections.feature | 14 +-- features/standard/UserCreation.feature | 6 +- features/standard/fields/contentQuery.feature | 6 +- features/standard/fields/date.feature | 6 +- features/standard/fields/map.feature | 6 +- features/standard/fields/media.feature | 8 +- features/standard/fields/other.feature | 6 +- features/standard/fields/relations.feature | 6 +- features/standard/fields/text.feature | 6 +- .../ContentActionsMenuContext.php | 8 +- .../Behat/Component/ContentActionsMenu.php | 85 ++++++++++++------- 24 files changed, 158 insertions(+), 133 deletions(-) diff --git a/features/personas/ChangePassword.feature b/features/personas/ChangePassword.feature index b95ae09f62..6b1c109e50 100644 --- a/features/personas/ChangePassword.feature +++ b/features/personas/ChangePassword.feature @@ -8,7 +8,7 @@ Feature: Verify that an User allowed to change password can change his password And I switch to "My account settings" tab in User settings And I click on the change password button And I change password from "Passw0rd-42" to "Passw0rd-43" - And I click on the edit action bar button "Update" + And I perform the "Update" action Then success notification that "Your password has been successfully changed." appears And I should be on Dashboard page diff --git a/features/personas/SubtreeEditor.feature b/features/personas/SubtreeEditor.feature index 42f29fab2d..dadf83194c 100644 --- a/features/personas/SubtreeEditor.feature +++ b/features/personas/SubtreeEditor.feature @@ -14,7 +14,7 @@ Feature: Verify that an Editor with Subtree limitations can perform all his task | label | value | | Name | | | Short name | | - When I click on the edit action bar button "Publish" + When I perform the "Publish" action Then success notification that "Content published." appears And I should be on Content view Page for "/" @@ -25,12 +25,12 @@ Feature: Verify that an Editor with Subtree limitations can perform all his task Scenario Outline: I can edit Content in locations I'm allowed Given I navigate to content "" of type "DedicatedFolder" in "" - When I click on the edit action bar button "Edit" + When I perform the "Edit" action And I set content fields | label | value | | Name | | | Short name | | - And I click on the edit action bar button "Publish" + And I perform the "Publish" action Then success notification that "Content published." appears And I should be on Content view Page for "/" And content attributes equal @@ -50,7 +50,7 @@ Feature: Verify that an Editor with Subtree limitations can perform all his task Scenario: I can move Content in locations I'm allowed Given I navigate to content "ContentToMove" of type "DedicatedFolder" in "root/FolderGrandParent/FolderParent/FolderChild1" - When I click on the edit action bar button "Move" + When I perform the "Move" action And I select content "root/FolderGrandParent/FolderParent" through UDW And I confirm the selection in UDW Then success notification that "'ContentToMove' moved to 'FolderParent'" appears diff --git a/features/standard/Autosave.feature b/features/standard/Autosave.feature index 46844830cc..149bd6c463 100644 --- a/features/standard/Autosave.feature +++ b/features/standard/Autosave.feature @@ -39,7 +39,7 @@ Feature: Content Items creation And I'm on Content view Page for root And I go to user settings And I disable autosave - And I click on the edit action bar button "Save" + And I perform the "Save" action from the "Save and close" group And I'm on Content view Page for root When I start creating a new content "Article" And I set content fields diff --git a/features/standard/ContentDraft.feature b/features/standard/ContentDraft.feature index edd2c2cb4b..ff78d16c3d 100644 --- a/features/standard/ContentDraft.feature +++ b/features/standard/ContentDraft.feature @@ -7,7 +7,7 @@ Feature: Content items creation Background: Given I am logged as admin - @javascript + @javascript @test Scenario: Content draft can be saved Given I'm on Content view Page for root When I start creating a new content "Article" @@ -15,7 +15,7 @@ Feature: Content items creation | label | value | | Title | Test Article draft | | Short title | Test Article draft | - And I click on the edit action bar button "Save" + And I perform the "Save" action from the "Save and close" group Then success notification that "Content draft saved." appears And I should be on Content update page for "Test Article draft" And I open the "Dashboard" page in admin SiteAccess @@ -29,7 +29,7 @@ Feature: Content items creation And I open the "Dashboard" page in admin SiteAccess And there's draft "TestDraft" on Dashboard list When I start editing content draft "TestDraft" - And I click on the edit action bar button "Delete draft" + And I perform the "Delete draft" action Then I should be on Content view Page for root And I open the "Dashboard" page in admin SiteAccess And there's no draft "TestDraft" on Dashboard list @@ -43,9 +43,9 @@ Feature: Content items creation | Title | TestArticleSavePublish | | Short title | TestArticleSavePublish | | Intro | TestArticleIntro | - When I click on the edit action bar button "Save" + When I perform the "Save" action from the "Save and close" group And I should be on Content update page for "TestArticleSavePublish" - And I click on the edit action bar button "Publish" + And I perform the "Publish" action Then success notification that "Content published." appears And I should be on Content view Page for "TestArticleSavePublish" @@ -70,13 +70,13 @@ Feature: Content items creation | title | short_title | | ContentDraftConflictVersion1 | ContentDraftConflictVersion2 | And I'm on Content view Page for "ContentDraftConflict" - When I click on the edit action bar button "Edit" + When I perform the "Edit" action And I start creating new draft from draft conflict modal And I set content fields | label | value | | Title | ContentDraftConflictVersion2 | | Short title | ContentDraftConflictVersion2 | - And I click on the edit action bar button "Publish" + And I perform the "Publish" action Then success notification that "Content published." appears And I should be on Content view Page for ContentDraftConflictVersion2 And content attributes equal @@ -93,12 +93,12 @@ Feature: Content items creation | title | short_title | | ContentDraftConflictFromTheListVersion2 | ContentDraftConflictFromTheListVersion2 | And I'm on Content view Page for "ContentDraftConflictFromTheList" - When I click on the edit action bar button "Edit" + When I perform the "Edit" action And I start editing draft with version number "2" from draft conflict modal And I set content fields | label | value | | Intro | ContentDraftConflictFromTheListVersion2Edited | - And I click on the edit action bar button "Publish" + And I perform the "Publish" action Then success notification that "Content published." appears And I should be on Content view Page for ContentDraftConflictFromTheListVersion2 And content attributes equal diff --git a/features/standard/ContentManagement.feature b/features/standard/ContentManagement.feature index 22710a64f9..a9415dd89e 100644 --- a/features/standard/ContentManagement.feature +++ b/features/standard/ContentManagement.feature @@ -14,7 +14,7 @@ Scenario: Content moving can be cancelled | ContentManagement | ContentManagement | root | eng-GB | | FolderToCancelMove | FolderToCancelMove | ContentManagement | eng-GB | And I'm on Content view Page for "ContentManagement/FolderToCancelMove" - When I click on the edit action bar button "Move" + When I perform the "Move" action And I select content "Media" through UDW And I close the UDW window Then I should be on Content view Page for "ContentManagement/FolderToCancelMove" @@ -26,7 +26,7 @@ Scenario: Content can be moved | ContentManagement | ContentManagement | root | eng-GB | | FolderToMove | FolderToMove | ContentManagement | eng-GB | And I'm on Content view Page for "ContentManagement/FolderToMove" - When I click on the edit action bar button "Move" + When I perform the "Move" action And I select content "Media/Files" through UDW And I confirm the selection in UDW Then success notification that "'FolderToMove' moved to 'Files'" appears @@ -41,7 +41,7 @@ Scenario: Content copying can be cancelled | ContentManagement | ContentManagement | root | eng-GB | | FolderToCopyCancel | FolderToCopyCancel | ContentManagement | eng-GB | And I'm on Content view Page for "ContentManagement/FolderToCopyCancel" - When I click on the edit action bar button "Copy" + When I perform the "Copy" action And I select content "Media" through UDW And I close the UDW window Then I should be on Content view Page for "ContentManagement/FolderToCopyCancel" @@ -53,7 +53,7 @@ Scenario: Content can be copied | ContentManagement | ContentManagement | root | eng-GB | | FolderToCopy | FolderToCopy | ContentManagement | eng-GB | And I'm on Content view Page for "ContentManagement/FolderToCopy" - When I click on the edit action bar button "Copy" + When I perform the "Copy" action And I select content "Media/Files" through UDW And I confirm the selection in UDW Then success notification that "'FolderToCopy' copied to 'Files'" appears @@ -68,7 +68,7 @@ Scenario: Content can be copied | ContentManagement | ContentManagement | root | eng-GB | | FolderToSubtreeCopyCancel | FolderToSubtreeCopyCancel | ContentManagement | eng-GB | And I'm on Content view Page for "ContentManagement/FolderToSubtreeCopyCancel" - When I click on the edit action bar button "Copy Subtree" + When I perform the "Copy Subtree" action And I select content "Media" through UDW And I close the UDW window Then I should be on Content view Page for "ContentManagement/FolderToSubtreeCopyCancel" @@ -80,7 +80,7 @@ Scenario: Content can be copied | ContentManagement | ContentManagement | root | eng-GB | | FolderToSubtreeCopy | FolderToSubtreeCopy | ContentManagement | eng-GB | And I'm on Content view Page for "ContentManagement/FolderToSubtreeCopy" - When I click on the edit action bar button "Copy Subtree" + When I perform the "Copy Subtree" action And I select content "Media" through UDW And I confirm the selection in UDW Then success notification that "Subtree 'FolderToSubtreeCopy' copied to Location 'Media'" appears diff --git a/features/standard/ContentPreview.feature b/features/standard/ContentPreview.feature index b7124d3fb5..943cf62b15 100644 --- a/features/standard/ContentPreview.feature +++ b/features/standard/ContentPreview.feature @@ -14,7 +14,7 @@ Feature: Content Item preview And I set content fields | label | value | | Name | Test Name | - And I click on the edit action bar button "Preview" + And I perform the "Preview" action And I go to "tablet" preview And I go to "mobile" preview And I go to "desktop" preview diff --git a/features/standard/ContentTranslation.feature b/features/standard/ContentTranslation.feature index 99b1a5a5ff..02034435d1 100644 --- a/features/standard/ContentTranslation.feature +++ b/features/standard/ContentTranslation.feature @@ -14,7 +14,7 @@ Feature: Content item transation | label | value | | Name | FrenchPublished | | Short name | FrenchPublished | - And I click on the edit action bar button "Publish" + And I perform the "Publish" action Then success notification that "Content published." appears And content attributes equal | label | value | @@ -39,7 +39,7 @@ Feature: Content item transation And I'm on Content view Page for "NoBasePublished" When I switch to "Translations" tab in Content structure And I add new translation "French" without base translation - And I click on the edit action bar button "Publish" + And I perform the "Publish" action Then success notification that "Content published." appears And content attributes equal | label | value | diff --git a/features/standard/ContentType.feature b/features/standard/ContentType.feature index 2a03df934c..c30ee8a735 100644 --- a/features/standard/ContentType.feature +++ b/features/standard/ContentType.feature @@ -15,7 +15,7 @@ Feature: Content types management | label | value | | Name | Test Content Type | | Identifier | TestContentTypeIdentifier | - And I click on the edit action bar button "Cancel" + And I perform the "Cancel" action Then I should be on Content Type group page for "Content" group And there's no "Test Content Type" on Content Types list @@ -31,7 +31,7 @@ Feature: Content types management And I select "Content" category to Content Type definition And I add field "Country" to Content Type definition And I set "Name" to "Country field" for "Country" field - And I click on the edit action bar button "Create" + And I perform the "Create" action Then notification that "Content Type" "New Content Type" is updated appears Then I should be on Content Type page for "Test Content Type" And Content Type has proper Global properties @@ -54,7 +54,7 @@ Feature: Content types management And I set fields | label | value | | Name | Test Content Type edited | - And I click on the edit action bar button "Cancel" + And I perform the "Cancel" action Then I should be on Content Type group page for "Content" group And there's a "TestDiscard CT" on Content Types list And there's no "Test Content Type edited" on Content Types list @@ -71,7 +71,7 @@ Feature: Content types management | Name | Test Content Type edited | And I add field "Date" to Content Type definition And I set "Name" to "DateField" for "Date" field - And I click on the edit action bar button "Save" + And I perform the "Save" action from the "Save and close" group Then success notification that "Content Type 'TestEdit CT' updated." appears Then I should be on Content Type page for "Test Content Type edited" And Content Type has proper Global properties diff --git a/features/standard/ContentTypeGroup.feature b/features/standard/ContentTypeGroup.feature index 77db711c55..c5c0043d64 100644 --- a/features/standard/ContentTypeGroup.feature +++ b/features/standard/ContentTypeGroup.feature @@ -14,7 +14,7 @@ Feature: Content type groups management And I set fields | label | value | | Name | Test Content Type Group | - And I click on the edit action bar button "Discard changes" + And I perform the "Discard changes" action Then I should be on "Content Type groups" page And there's no "Test Content Type Group" Content Type group on Content Type groups list @@ -25,7 +25,7 @@ Feature: Content type groups management And I set fields | label | value | | Name | Test Content Type Group | - And I click on the edit action bar button "Create" + And I perform the "Create" action Then I should be on Content Type group page for "Test Content Type Group" group And there're no Content Types for that group @@ -37,7 +37,7 @@ Feature: Content type groups management And I set fields | label | value | | Name | Test Content Type Group edited | - And I click on the edit action bar button "Discard changes" + And I perform the "Discard changes" action Then I should be on "Content Type groups" page And there's a "Test Content Type Group" Content Type group on Content Type groups list And there's no "Test Content Type Group edited" Content Type group on Content Type groups list @@ -50,7 +50,7 @@ Feature: Content type groups management And I set fields | label | value | | Name | Test Content Type Group edited | - And I click on the edit action bar button "Save" + And I perform the "Save" action from the "Save and close" group Then I should be on Content Type group page for "Test Content Type Group edited" group And success notification that "Updated Content Type group 'Test Content Type Group'." appears diff --git a/features/standard/Languages.feature b/features/standard/Languages.feature index 55a4bc1105..0430d26519 100644 --- a/features/standard/Languages.feature +++ b/features/standard/Languages.feature @@ -10,23 +10,23 @@ Feature: Languages management @javascript Scenario: Changes can be discarded while creating new Language - When I click on the edit action bar button "Add language" + When I perform the "Add language" action And I set fields | label | value | | Name | Deutsch | | Language code | de-DE | - And I click on the edit action bar button "Cancel" + And I perform the "Cancel" action Then I should be on "Languages" page And there's no "Deutsch" Language on Languages list @javascript Scenario: New Language can be added - When I click on the edit action bar button "Add language" + When I perform the "Add language" action And I set fields | label | value | | Name | Deutsch | | Language code | de-DE | - And I click on the edit action bar button "Add" + And I perform the "Add" action Then I should be on "Deutsch" Language page And Language has proper attributes | Name | Language code | Enabled | @@ -34,12 +34,12 @@ Feature: Languages management @javascript Scenario: New Language with existing language code cannot be added - When I click on the edit action bar button "Add language" + When I perform the "Add language" action And I set fields | label | value | | Name | Deutsch Second | | Language code | de-DE | - And I click on the edit action bar button "Add" + And I perform the "Add" action Then error notification that "language with the specified language code already exists" appears @javascript @@ -49,7 +49,7 @@ Feature: Languages management And I set fields | label | value | | Name | Edited Deutsch | - And I click on the edit action bar button "Discard changes" + And I perform the "Discard changes" action Then I should be on "Languages" page And there's a "Deutsch" Language on Languages list And there's no "Edited Deutsch" Language on Languages list @@ -62,7 +62,7 @@ Feature: Languages management | label | value | | Name | Edited Deutsch | | Enabled | false | - And I click on the edit action bar button "Save" + And I perform the "Save" action from the "Save and close" group Then I should be on "Edited Deutsch" Language page And notification that "Language" "Deutsch" is updated appears And Language has proper attributes @@ -79,7 +79,7 @@ Feature: Languages management And I set fields | label | value | | Enabled | true | - And I click on the edit action bar button "Save" + And I perform the "Save" action from the "Save and close" group Then I should be on "Edited Deutsch" Language page And notification that "Language" "Edited Deutsch" is updated appears And Language has proper attributes diff --git a/features/standard/MyDrafts.feature b/features/standard/MyDrafts.feature index e91d27b927..558f47ad8d 100644 --- a/features/standard/MyDrafts.feature +++ b/features/standard/MyDrafts.feature @@ -22,5 +22,5 @@ Feature: My Drafts | Title | TestMyDraftSavePublish | | Short title | TestMyDraftSavePublish | | Intro | TestMyDraftIntro | - And I click on the edit action bar button "Save" + And I perform the "Save" action from the "Save and close" group Then I should be on Content update page for "TestMyDraftSavePublish" diff --git a/features/standard/ObjectStates.feature b/features/standard/ObjectStates.feature index 453b08c1eb..a83e5fd0e6 100644 --- a/features/standard/ObjectStates.feature +++ b/features/standard/ObjectStates.feature @@ -15,7 +15,7 @@ Feature: Object States management | label | value | | Name | Test Object State Group | | Identifier | TestObjectStateGroupIdentifier | - And I click on the edit action bar button "Discard changes" + And I perform the "Discard changes" action Then I should be on "Object state groups" page And there's no "Test Object State Group" Object State group on Object State groups list @@ -27,7 +27,7 @@ Feature: Object States management | label | value | | Name | Test Object State Group | | Identifier | TestObjectStateGroupIdentifier | - And I click on the edit action bar button "Create" + And I perform the "Create" action Then I should be on "Test Object State Group" Object State group page And "Test Object State Group" Object State group has no Object States And Object State group has proper attributes @@ -44,7 +44,7 @@ Feature: Object States management And I set fields | label | value | | Name | Test Object State Group edited | - And I click on the edit action bar button "Discard changes" + And I perform the "Discard changes" action Then I should be on "Object state groups" page And there's a "Test Object State Group" Object State group on Object State groups list And there's no "Test Object State Group edited" Object State group on Object State groups list @@ -57,7 +57,7 @@ Feature: Object States management And I set fields | label | value | | Name | Test Object State Group edited | - And I click on the edit action bar button "Save" + And I perform the "Save" action from the "Save and close" group Then notification that "Object state group" "Test Object State Group edited" is updated appears And I should be on "Test Object State Group edited" Object State group page @@ -68,7 +68,7 @@ Feature: Object States management And I set fields | label | value | | Name | Test Object State Group edited2 | - And I click on the edit action bar button "Discard changes" + And I perform the "Discard changes" action Then I should be on "Object state groups" page And there's a "Test Object State Group edited" Object State group on Object State groups list And there's no "Test Object State Group edited2" Object State group on Object State groups list @@ -80,7 +80,7 @@ Feature: Object States management And I set fields | label | value | | Name | Test Object State Group edited2 | - And I click on the edit action bar button "Save" + And I perform the "Save" action from the "Save and close" group Then notification that "Object state group" "Test Object State Group edited2" is updated appears And I should be on "Test Object State Group edited2" Object State group page @@ -92,7 +92,7 @@ Feature: Object States management | label | value | | Name | Test Object State | | Identifier | TestObjectStateIdentifier | - And I click on the edit action bar button "Discard changes" + And I perform the "Discard changes" action Then I should be on "Test Object State Group edited2" Object State group page And there's no "Test Object State" Object State on Object States list for "Test Object State Group edited2" @@ -104,7 +104,7 @@ Feature: Object States management | label | value | | Name | Test Object State | | Identifier | TestObjectStateIdentifier | - And I click on the edit action bar button "Create" + And I perform the "Create" action Then I should be on "Test Object State" Object State page And Object State has proper attributes | label | value | @@ -119,7 +119,7 @@ Feature: Object States management And I set fields | label | value | | Name | Test Object State edited | - And I click on the edit action bar button "Discard changes" + And I perform the "Discard changes" action Then I should be on "Test Object State Group edited2" Object State group page And there's a "Test Object State" Object State on Object States list for "Test Object State Group edited2" And there's no "Test Object State edited" Object State on Object States list for "Test Object State Group edited2" @@ -131,7 +131,7 @@ Feature: Object States management And I set fields | label | value | | Name | Test Object State edited | - And I click on the edit action bar button "Save" + And I perform the "Save" action from the "Save and close" group Then notification that "Object state" "Test Object State edited" is updated appears And I should be on "Test Object State edited" Object State page And Object State has proper attributes @@ -146,7 +146,7 @@ Feature: Object States management And I set fields | label | value | | Name | Test Object State edited2 | - And I click on the edit action bar button "Discard changes" + And I perform the "Discard changes" action Then I should be on "Test Object State Group edited2" Object State group page And there's a "Test Object State edited" Object State on Object States list for "Test Object State Group edited2" And there's no "Test Object State edited2" Object State on Object States list for "Test Object State Group edited2" @@ -158,7 +158,7 @@ Feature: Object States management And I set fields | label | value | | Name | Test Object State edited2 | - And I click on the edit action bar button "Save" + And I perform the "Save" action from the "Save and close" group Then notification that "Object state" "Test Object State edited2" is updated appears And I should be on "Test Object State edited2" Object State page And Object State has proper attributes @@ -174,7 +174,7 @@ Feature: Object States management | label | value | | Name | Test Object State 2 | | Identifier | TestObjectStateIdentifier2 | - And I click on the edit action bar button "Create" + And I perform the "Create" action Then I should be on "Test Object State 2" Object State page And Object State has proper attributes | label | value | diff --git a/features/standard/Roles.feature b/features/standard/Roles.feature index 9433428b94..fc27c5f7b4 100644 --- a/features/standard/Roles.feature +++ b/features/standard/Roles.feature @@ -12,7 +12,7 @@ Feature: Roles management And I set fields | label | value | | Name | Test Role | - And I click on the edit action bar button "Discard changes" + And I perform the "Discard changes" action Then I should be on "Roles" page And there's no "Test Role" Role on Roles list @@ -24,7 +24,7 @@ Feature: Roles management And I set fields | label | value | | Name | Test Role | - And I click on the edit action bar button "Create" + And I perform the "Create" action Then I should be on "Test Role" Role page And Policies list is empty And Assignments list is empty @@ -38,7 +38,7 @@ Feature: Roles management And I set fields | label | value | | Name | Test Role edited | - And I click on the edit action bar button "Discard changes" + And I perform the "Discard changes" action Then I should be on "Roles" page And there's a "Test Role" Role on Roles list And there's no "Test Role edited" Role on Roles list @@ -52,7 +52,7 @@ Feature: Roles management And I set fields | label | value | | Name | Test Role edited | - And I click on the edit action bar button "Save" + And I perform the "Save" action from the "Save and close" group Then I should be on "Test Role edited" Role page And Policies list is empty And Assignments list is empty @@ -71,7 +71,7 @@ Feature: Roles management | Users/Editors | | Users | And I select "Media" from Sections as role assignment limitation - And I click on the edit action bar button "Cancel" + And I perform the "Cancel" action Then I should be on "Test Role edited" Role page And Policies list is empty And Assignments list is empty @@ -90,7 +90,7 @@ Feature: Roles management | path | | Users/Editors | And I select limitation "Media/Images" for assignment through UDW - And I click on the edit action bar button "Save" + And I perform the "Save" action from the "Save and close" group Then I should be on "Test Role edited" Role page And Policies list is empty And there are assignments on the "Test Role edited" assignments list @@ -107,7 +107,7 @@ Feature: Roles management And I assign groups to role | path | | Users | - And I click on the edit action bar button "Save" + And I perform the "Save" action from the "Save and close" group Then I should be on "Test Role edited" Role page And Policies list is empty And there are assignments on the "Test Role edited" assignments list @@ -138,7 +138,7 @@ Feature: Roles management And I open "Test Role edited" Role page in admin SiteAccess When I start creating a new Policy And I select policy "Content Type / All functions" - And I click on the edit action bar button "Discard changes" + And I perform the "Discard changes" action Then I should be on "Test Role edited" Role page And Policies list is empty And there are assignments on the "Test Role edited" assignments list @@ -151,12 +151,12 @@ Feature: Roles management And I open "Test Role edited" Role page in admin SiteAccess When I start creating a new Policy And I select policy "Content / Read" - And I click on the edit action bar button "Create" + And I perform the "Create" action And success notification that "Now you can set Limitations for the Policy." appears And I select limitation for "Content Type" | option | | File | - And I click on the edit action bar button "Update" + And I perform the "Update" action Then I should be on "Test Role edited" Role page And there is a policy "Content/Read" with "Content Type: File" limitation on the "Test Role edited" policies list And there are assignments on the "Test Role edited" assignments list @@ -169,7 +169,7 @@ Feature: Roles management And I open "Test Role edited" Role page in admin SiteAccess When I start creating a new Policy And I select policy "User / Password" - And I click on the edit action bar button "Create" + And I perform the "Create" action Then I should be on "Test Role edited" Role page And there is a policy "User/Password" with "None" limitation on the "Test Role edited" policies list And there are assignments on the "Test Role edited" assignments list @@ -189,7 +189,7 @@ Feature: Roles management And I select limitation for "State" | option | | Lock:Locked | - And I click on the edit action bar button "Update" + And I perform the "Update" action Then I should be on "Test Role edited" Role page And there are policies on the "Test Role edited" policies list | policy | limitation | diff --git a/features/standard/Sections.feature b/features/standard/Sections.feature index 32b931536d..1a069b44b9 100644 --- a/features/standard/Sections.feature +++ b/features/standard/Sections.feature @@ -15,7 +15,7 @@ Feature: Sections management | label | value | | Name | Test Section | | Identifier | TestSectionIdentifier | - And I click on the edit action bar button "Discard changes" + And I perform the "Discard changes" action Then I should be on "Sections" page And there's no "Test Section" on Sections list @@ -27,7 +27,7 @@ Feature: Sections management | label | value | | Name | Test Section | | Identifier | TestSectionIdentifier | - And I click on the edit action bar button "Create" + And I perform the "Create" action Then I should be on "Test Section" Section page And Content items list in is empty for Section And Section has proper attributes @@ -71,7 +71,7 @@ Feature: Sections management And I set fields | label | value | | Name | Test Section edited | - And I click on the edit action bar button "Discard changes" + And I perform the "Discard changes" action Then I should be on "Sections" page And there's a "Test Section" on Sections list And there's no "Test Section edited" on Sections list @@ -84,7 +84,7 @@ Feature: Sections management And I set fields | label | value | | Name | Test Section edited | - And I click on the edit action bar button "Save" + And I perform the "Save" action from the "Save and close" group Then I should be on "Test Section edited" Section page And notification that "Section" "Test Section edited" is updated appears @@ -95,7 +95,7 @@ Feature: Sections management And I set fields | label | value | | Name | Test Section edited2 | - And I click on the edit action bar button "Discard changes" + And I perform the "Discard changes" action Then I should be on "Sections" page And there's a "Test Section edited" on Sections list And there's no "Test Section edited2" on Sections list @@ -107,7 +107,7 @@ Feature: Sections management And I set fields | label | value | | Name | Test Section edited2 | - And I click on the edit action bar button "Save" + And I perform the "Save" action from the "Save and close" group Then I should be on "Test Section edited2" Section page And notification that "Section" "Test Section edited2" is updated appears @@ -147,7 +147,7 @@ Feature: Sections management | label | value | | Name | Test Section | | Identifier | TestSectionIdentifier2 | - And I click on the edit action bar button "Create" + And I perform the "Create" action And notification that "Section" "Test Section" is created appears When I delete the section Then notification that "Section" "Test Section" is removed appears diff --git a/features/standard/UserCreation.feature b/features/standard/UserCreation.feature index daebadc67d..4bfe8d89d9 100644 --- a/features/standard/UserCreation.feature +++ b/features/standard/UserCreation.feature @@ -18,7 +18,7 @@ Feature: User management And I set content fields for user | label | Username | Password | Confirm password | Email | Enabled | | User account | testuser | Test1234pw | Test1234pw | test@test.com | Yes | - And I click on the edit action bar button "Create" + And I perform the "Create" action Then I should be on Content view Page for "Users/testuser lastname" And content attributes equal | label | value | @@ -31,7 +31,7 @@ Feature: User management @javascript Scenario: Editing an existing user Given I'm on Content view Page for "Users/testuser lastname" - When I click on the edit action bar button "Edit" + When I perform the "Edit" action And I set content fields for user | label | value | | First name | testuseredited | @@ -39,7 +39,7 @@ Feature: User management And I set content fields for user | label | Username | Password | Confirm password | Email | | User account | testuser | Test123456 | Test123456 | test@test.org | - And I click on the edit action bar button "Update" + And I perform the "Update" action Then I should be on Content view Page for "Users/testuseredited lastnameedited" And content attributes equal | label | value | diff --git a/features/standard/fields/contentQuery.feature b/features/standard/fields/contentQuery.feature index a8317b3fb2..dce2366286 100644 --- a/features/standard/fields/contentQuery.feature +++ b/features/standard/fields/contentQuery.feature @@ -20,7 +20,7 @@ Feature: Content fields setting and editing And I set content fields | label | | | Name | | - And I click on the edit action bar button "Publish" + And I perform the "Publish" action Then success notification that "Content published." appears And I should be on Content view Page for "ContentQueryFieldContainer/" And content attributes equal @@ -34,11 +34,11 @@ Feature: Content fields setting and editing Scenario: Edit content item with Content Query Given I am logged as admin And I'm on Content view Page for "ContentQueryFieldContainer/Content query" - When I click on the edit action bar button "Edit" + When I perform the "Edit" action And I set content fields | label | | | Name | New Content query | - And I click on the edit action bar button "Publish" + And I perform the "Publish" action Then success notification that "Content published." appears And I should be on Content view Page for "ContentQueryFieldContainer/New Content query" And content attributes equal diff --git a/features/standard/fields/date.feature b/features/standard/fields/date.feature index 0acef7aa34..e05dd95dc7 100644 --- a/features/standard/fields/date.feature +++ b/features/standard/fields/date.feature @@ -20,7 +20,7 @@ Feature: Content fields setting and editing | label | | | | | Field | | | | | Name | | | | - And I click on the edit action bar button "Publish" + And I perform the "Publish" action Then success notification that "Content published." appears And I should be on Content view Page for "DateFieldsContainer/" And content attributes equal @@ -37,11 +37,11 @@ Feature: Content fields setting and editing Scenario Outline: Edit content item with given field Given I am logged as admin And I'm on Content view Page for "DateFieldsContainer/" - When I click on the edit action bar button "Edit" + When I perform the "Edit" action And I set content fields | label | | | | | Field | | | | - And I click on the edit action bar button "Publish" + And I perform the "Publish" action Then success notification that "Content published." appears And I should be on Content view Page for "DateFieldsContainer/" And content attributes equal diff --git a/features/standard/fields/map.feature b/features/standard/fields/map.feature index 984ef747ab..ade81e512d 100644 --- a/features/standard/fields/map.feature +++ b/features/standard/fields/map.feature @@ -20,7 +20,7 @@ Feature: Content fields setting and editing | label | | | | | Field | | | | | Name | | | | - And I click on the edit action bar button "Publish" + And I perform the "Publish" action Then success notification that "Content published." appears And I should be on Content view Page for "MapFieldsContainer/" And content attributes equal @@ -36,11 +36,11 @@ Feature: Content fields setting and editing Scenario Outline: Edit content item with given field Given I am logged as admin And I'm on Content view Page for "MapFieldsContainer/" - When I click on the edit action bar button "Edit" + When I perform the "Edit" action And I set content fields | label | | | | | Field | | | | - And I click on the edit action bar button "Publish" + And I perform the "Publish" action Then success notification that "Content published." appears And I should be on Content view Page for "MapFieldsContainer/" And content attributes equal diff --git a/features/standard/fields/media.feature b/features/standard/fields/media.feature index e446f7c8ca..96b60df37e 100644 --- a/features/standard/fields/media.feature +++ b/features/standard/fields/media.feature @@ -19,7 +19,7 @@ Feature: Content fields setting and editing And I'm on Content view Page for MediaFieldsContainer When I start creating a new content 'Image Asset CT2' And I select "Media/Images/ImageAssetImage" from Image Asset Repository for "ImageAField" field - And I click on the edit action bar button "Publish" + And I perform the "Publish" action Then success notification that "Content published." appears And I should be on Content view Page for "MediaFieldsContainer/ImageAssetImage" And content attributes equal @@ -39,7 +39,7 @@ Feature: Content fields setting and editing | label | | | | | Field | | | | | Name | | | | - And I click on the edit action bar button "Publish" + And I perform the "Publish" action Then success notification that "Content published." appears And I should be on Content view Page for "MediaFieldsContainer/" And content attributes equal @@ -57,11 +57,11 @@ Feature: Content fields setting and editing Scenario Outline: Edit content item with given field Given I am logged as admin And I'm on Content view Page for "MediaFieldsContainer/" - When I click on the edit action bar button "Edit" + When I perform the "Edit" action And I set content fields | label | | | | | Field | | | | - And I click on the edit action bar button "Publish" + And I perform the "Publish" action Then success notification that "Content published." appears And I should be on Content view Page for "MediaFieldsContainer/" And content attributes equal diff --git a/features/standard/fields/other.feature b/features/standard/fields/other.feature index 45c8096564..85b61a7302 100644 --- a/features/standard/fields/other.feature +++ b/features/standard/fields/other.feature @@ -20,7 +20,7 @@ Feature: Content fields setting and editing | label | | | Field | | | Name | | - And I click on the edit action bar button "Publish" + And I perform the "Publish" action Then success notification that "Content published." appears And I should be on Content view Page for "OtherFieldsContainer/" And content attributes equal @@ -42,11 +42,11 @@ Feature: Content fields setting and editing Scenario Outline: Edit content item with given field Given I am logged as admin And I'm on Content view Page for "OtherFieldsContainer/" - When I click on the edit action bar button "Edit" + When I perform the "Edit" action And I set content fields | label | | | Field | | - And I click on the edit action bar button "Publish" + And I perform the "Publish" action Then success notification that "Content published." appears And I should be on Content view Page for "OtherFieldsContainer/" And content attributes equal diff --git a/features/standard/fields/relations.feature b/features/standard/fields/relations.feature index 736980ec71..d33cf9323e 100644 --- a/features/standard/fields/relations.feature +++ b/features/standard/fields/relations.feature @@ -20,7 +20,7 @@ Feature: Content fields setting and editing | label | | | | | Field | | | | | Name | | | | - And I click on the edit action bar button "Publish" + And I perform the "Publish" action Then success notification that "Content published." appears And I should be on Content view Page for "RelationFieldsContainer/" And content attributes equal @@ -36,11 +36,11 @@ Feature: Content fields setting and editing Scenario Outline: Edit content item with given field Given I am logged as admin And I'm on Content view Page for "RelationFieldsContainer/" - When I click on the edit action bar button "Edit" + When I perform the "Edit" action And I set content fields | label | | | | | Field | | | | - And I click on the edit action bar button "Publish" + And I perform the "Publish" action Then success notification that "Content published." appears And I should be on Content view Page for "RelationFieldsContainer/" And content attributes equal diff --git a/features/standard/fields/text.feature b/features/standard/fields/text.feature index 8d0c6d4857..bb969b9137 100644 --- a/features/standard/fields/text.feature +++ b/features/standard/fields/text.feature @@ -20,7 +20,7 @@ Feature: Content fields setting and editing | label | | | | | Field | | | | | Name | | | | - And I click on the edit action bar button "Publish" + And I perform the "Publish" action Then success notification that "Content published." appears And I should be on Content view Page for "TextFieldsContainer/" And content attributes equal @@ -39,11 +39,11 @@ Feature: Content fields setting and editing Scenario Outline: Edit content item with given field Given I am logged as admin And I'm on Content view Page for "TextFieldsContainer/" - When I click on the edit action bar button "Edit" + When I perform the "Edit" action And I set content fields | label | | | | | Field | | | | - And I click on the edit action bar button "Publish" + And I perform the "Publish" action Then success notification that "Content published." appears And I should be on Content view Page for "TextFieldsContainer/" And content attributes equal diff --git a/src/lib/Behat/BrowserContext/ContentActionsMenuContext.php b/src/lib/Behat/BrowserContext/ContentActionsMenuContext.php index 698541625a..9aed9054de 100644 --- a/src/lib/Behat/BrowserContext/ContentActionsMenuContext.php +++ b/src/lib/Behat/BrowserContext/ContentActionsMenuContext.php @@ -24,11 +24,13 @@ public function __construct(ContentActionsMenu $contentActionsMenu) } /** - * @Given I click (on) the edit action bar button :button + * @Given I click (on) the edit action bar button :buttonName + * @Given I perform the :buttonName action + * @Given I perform the :buttonName action from the :groupName group */ - public function clickEditActionBar(string $button): void + public function clickEditActionBar(string $buttonName, string $groupName = null): void { - $this->contentActionsMenu->clickButton($button); + $this->contentActionsMenu->clickButton($buttonName, $groupName); } /** diff --git a/src/lib/Behat/Component/ContentActionsMenu.php b/src/lib/Behat/Component/ContentActionsMenu.php index 94662a76ed..71754cc689 100644 --- a/src/lib/Behat/Component/ContentActionsMenu.php +++ b/src/lib/Behat/Component/ContentActionsMenu.php @@ -14,47 +14,64 @@ class ContentActionsMenu extends Component { - public function clickButton(string $buttonName): void + use \Ibexa\Behat\Core\Debug\InteractiveDebuggerTrait; + + public function clickButton(string $buttonName, ?string $groupName = null): void + { +// $this->setInteractiveBreakpoint(get_defined_vars()); + + if ($groupName === null) { + $this->clickStandaloneButton($buttonName); + + return; + } + + $this->clickButtonInGroup($groupName, $buttonName); + } + + private function clickStandaloneButton(string $buttonName): void { $buttons = $this->getHTMLPage() ->findAll($this->getLocator('menuButton')) ->filterBy(new ElementTextCriterion($buttonName)); - // TODO: Remove parts of this logic once redeisgn is fully done if ($buttons->any()) { - $button = $buttons->first(); - $button->mouseOver(); - - if ($button->findAll($this->getLocator('label'))->any()) { - $button->find($this->getLocator('label'))->click(); - - return; - } - - $button->click(); + $buttons->single()->click(); return; } - $contextMenuSplitBtnsTogglers = $this->getHTMLPage() - ->findAll($this->getLocator('menuSplitToggler')); + $this->getHTMLPage()->find($this->getLocator('moreButton'))->click(); + $this->getHTMLPage() + ->findAll($this->getLocator('expandedMenuButton')) + ->getByCriterion(new ElementTextCriterion($buttonName))->click(); + } + + private function clickButtonInGroup(string $groupName, string $buttonName): void + { + $group = $this->getHTMLPage() + ->findAll($this->getLocator('splitButton')) + ->filterBy(new ElementTextCriterion($groupName)); - foreach ($contextMenuSplitBtnsTogglers->getIterator() as $splitBtnToggler) { - $splitBtnToggler->click(); + if ($group->any()) { + $group->single()->find($this->getLocator('toggle'))->click(); - $matchingSubButtons = $this->getHTMLPage() - ->findAll($this->getLocator('menuSplitSubmenuButton')) - ->filterBy(new ElementTextCriterion($buttonName)); +// $this->setInteractiveBreakpoint(get_defined_vars()); + $this->getHTMLPage()->findAll($this->getLocator('button')) + ->getByCriterion(new ElementTextCriterion($buttonName)) + ->click(); - if ($matchingSubButtons->any()) { - $matchingSubButtons->first()->click(); - } + return; } $this->getHTMLPage()->find($this->getLocator('moreButton'))->click(); - $this->getHTMLPage() ->findAll($this->getLocator('expandedMenuButton')) + ->getByCriterion(new ElementTextCriterion($groupName)) + ->mouseOver(); + + $this->getHTMLPage() + ->findAll($this->getLocator('menuButton')) ->getByCriterion(new ElementTextCriterion($buttonName)) ->click(); } @@ -71,10 +88,7 @@ public function isButtonActive(string $buttonName): bool public function isButtonVisible(string $buttonName): bool { - $moreButton = $this->getHTMLPage()->findAll($this->getLocator('moreButton')); - if ($moreButton->any()) { - $moreButton->single()->click(); - } + $this->showMoreButtonsIfNeeded(); return $this->getHTMLPage() ->findAll($this->getLocator('menuButton')) @@ -82,6 +96,14 @@ public function isButtonVisible(string $buttonName): bool ->any(); } + private function showMoreButtonsIfNeeded(): void + { + $moreButton = $this->getHTMLPage()->findAll($this->getLocator('moreButton')); + if ($moreButton->any()) { + $moreButton->single()->click(); + } + } + public function verifyIsLoaded(): void { $this->getHTMLPage() @@ -93,12 +115,13 @@ public function verifyIsLoaded(): void protected function specifyLocators(): array { return [ - new VisibleCSSLocator('menuButton', '.ibexa-context-menu .ibexa-btn, .ibexa-context-menu__item .ibexa-popup-menu__item, .ibexa-context-menu .btn'), // TO DO: set one selector after redesign - new VisibleCSSLocator('menuSplitToggler', '.ibexa-context-menu .ibexa-split-btn__toggle-btn'), - new VisibleCSSLocator('menuSplitSubmenuButton', '.ibexa-popup-menu:not(.ibexa-popup-menu--hidden) .ibexa-popup-menu__item-content'), new VisibleCSSLocator('label', '.ibexa-btn__label'), + new VisibleCSSLocator('menuButton', '.ibexa-context-menu .ibexa-btn'), + new VisibleCSSLocator('button', '.ibexa-popup-menu__item-content'), + new VisibleCSSLocator('toggle', '.ibexa-split-btn__toggle-btn '), + new VisibleCSSLocator('splitButton', '.ibexa-split-btn'), new VisibleCSSLocator('moreButton', '.ibexa-context-menu__item--more'), - new VisibleCSSLocator('expandedMenuButton', '.ibexa-context-menu__item .ibexa-popup-menu__item-content'), + new VisibleCSSLocator('expandedMenuButton', '.ibexa-popup-menu .ibexa-multilevel-popup-menu__item-content'), ]; } } From d684172c3035fad20bd56e19d5d0493d2f65181c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Thu, 7 Sep 2023 17:16:42 +0200 Subject: [PATCH 15/40] More fixes --- features/standard/ContentDraft.feature | 2 +- features/standard/Languages.feature | 12 ++++++------ features/standard/ObjectStates.feature | 10 +++++----- features/standard/Sections.feature | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/features/standard/ContentDraft.feature b/features/standard/ContentDraft.feature index ff78d16c3d..21c4868e96 100644 --- a/features/standard/ContentDraft.feature +++ b/features/standard/ContentDraft.feature @@ -7,7 +7,7 @@ Feature: Content items creation Background: Given I am logged as admin - @javascript @test + @javascript Scenario: Content draft can be saved Given I'm on Content view Page for root When I start creating a new content "Article" diff --git a/features/standard/Languages.feature b/features/standard/Languages.feature index 0430d26519..7eba628648 100644 --- a/features/standard/Languages.feature +++ b/features/standard/Languages.feature @@ -15,7 +15,7 @@ Feature: Languages management | label | value | | Name | Deutsch | | Language code | de-DE | - And I perform the "Cancel" action + And I perform the "Discard" action Then I should be on "Languages" page And there's no "Deutsch" Language on Languages list @@ -26,7 +26,7 @@ Feature: Languages management | label | value | | Name | Deutsch | | Language code | de-DE | - And I perform the "Add" action + And I perform the "Save and close" action Then I should be on "Deutsch" Language page And Language has proper attributes | Name | Language code | Enabled | @@ -39,7 +39,7 @@ Feature: Languages management | label | value | | Name | Deutsch Second | | Language code | de-DE | - And I perform the "Add" action + And I perform the "Save and close" action Then error notification that "language with the specified language code already exists" appears @javascript @@ -49,7 +49,7 @@ Feature: Languages management And I set fields | label | value | | Name | Edited Deutsch | - And I perform the "Discard changes" action + And I perform the "Discard" action Then I should be on "Languages" page And there's a "Deutsch" Language on Languages list And there's no "Edited Deutsch" Language on Languages list @@ -62,7 +62,7 @@ Feature: Languages management | label | value | | Name | Edited Deutsch | | Enabled | false | - And I perform the "Save" action from the "Save and close" group + And I perform the "Save and close" action Then I should be on "Edited Deutsch" Language page And notification that "Language" "Deutsch" is updated appears And Language has proper attributes @@ -79,7 +79,7 @@ Feature: Languages management And I set fields | label | value | | Enabled | true | - And I perform the "Save" action from the "Save and close" group + And I perform the "Save and close" action Then I should be on "Edited Deutsch" Language page And notification that "Language" "Edited Deutsch" is updated appears And Language has proper attributes diff --git a/features/standard/ObjectStates.feature b/features/standard/ObjectStates.feature index a83e5fd0e6..6a29200acf 100644 --- a/features/standard/ObjectStates.feature +++ b/features/standard/ObjectStates.feature @@ -1,4 +1,4 @@ -@IbexaOSS @IbexaHeadless @IbexaExperience @IbexaCommerce +@IbexaOSS @IbexaHeadless @IbexaExperience @IbexaCommerce @test Feature: Object States management As an administrator In order to customize my project @@ -15,7 +15,7 @@ Feature: Object States management | label | value | | Name | Test Object State Group | | Identifier | TestObjectStateGroupIdentifier | - And I perform the "Discard changes" action + And I perform the "Discard" action Then I should be on "Object state groups" page And there's no "Test Object State Group" Object State group on Object State groups list @@ -27,7 +27,7 @@ Feature: Object States management | label | value | | Name | Test Object State Group | | Identifier | TestObjectStateGroupIdentifier | - And I perform the "Create" action + And I perform the "Save and close" action Then I should be on "Test Object State Group" Object State group page And "Test Object State Group" Object State group has no Object States And Object State group has proper attributes @@ -104,7 +104,7 @@ Feature: Object States management | label | value | | Name | Test Object State | | Identifier | TestObjectStateIdentifier | - And I perform the "Create" action + And I perform the "Save and close" action Then I should be on "Test Object State" Object State page And Object State has proper attributes | label | value | @@ -174,7 +174,7 @@ Feature: Object States management | label | value | | Name | Test Object State 2 | | Identifier | TestObjectStateIdentifier2 | - And I perform the "Create" action + And I perform the "Save and close" action Then I should be on "Test Object State 2" Object State page And Object State has proper attributes | label | value | diff --git a/features/standard/Sections.feature b/features/standard/Sections.feature index 1a069b44b9..1a71a2e7c7 100644 --- a/features/standard/Sections.feature +++ b/features/standard/Sections.feature @@ -15,7 +15,7 @@ Feature: Sections management | label | value | | Name | Test Section | | Identifier | TestSectionIdentifier | - And I perform the "Discard changes" action + And I perform the "Discard" action Then I should be on "Sections" page And there's no "Test Section" on Sections list @@ -27,7 +27,7 @@ Feature: Sections management | label | value | | Name | Test Section | | Identifier | TestSectionIdentifier | - And I perform the "Create" action + And I perform the "Save and close" action Then I should be on "Test Section" Section page And Content items list in is empty for Section And Section has proper attributes From ee6f047928007df5bfde3528c05ac5b008badc2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Thu, 7 Sep 2023 17:16:43 +0200 Subject: [PATCH 16/40] TMP --- features/standard/Roles.feature | 446 ++++++++++++++++---------------- 1 file changed, 223 insertions(+), 223 deletions(-) diff --git a/features/standard/Roles.feature b/features/standard/Roles.feature index fc27c5f7b4..434515c503 100644 --- a/features/standard/Roles.feature +++ b/features/standard/Roles.feature @@ -1,238 +1,238 @@ -@IbexaOSS @IbexaHeadless @IbexaExperience @IbexaCommerce -Feature: Roles management - As an administrator - In order to customize my Ibexa installation - I want to manage users Roles. +# @IbexaOSS @IbexaHeadless @IbexaExperience @IbexaCommerce +# Feature: Roles management +# As an administrator +# In order to customize my Ibexa installation +# I want to manage users Roles. - @javascript - Scenario: Changes can be discarded while creating Role - Given I am logged as admin - And I open "Roles" page in admin SiteAccess - When I create a new Role - And I set fields - | label | value | - | Name | Test Role | - And I perform the "Discard changes" action - Then I should be on "Roles" page - And there's no "Test Role" Role on Roles list +# @javascript +# Scenario: Changes can be discarded while creating Role +# Given I am logged as admin +# And I open "Roles" page in admin SiteAccess +# When I create a new Role +# And I set fields +# | label | value | +# | Name | Test Role | +# And I perform the "Discard changes" action +# Then I should be on "Roles" page +# And there's no "Test Role" Role on Roles list - @javascript - Scenario: New Role can be created - Given I am logged as admin - And I open "Roles" page in admin SiteAccess - When I create a new Role - And I set fields - | label | value | - | Name | Test Role | - And I perform the "Create" action - Then I should be on "Test Role" Role page - And Policies list is empty - And Assignments list is empty +# @javascript +# Scenario: New Role can be created +# Given I am logged as admin +# And I open "Roles" page in admin SiteAccess +# When I create a new Role +# And I set fields +# | label | value | +# | Name | Test Role | +# And I perform the "Create" action +# Then I should be on "Test Role" Role page +# And Policies list is empty +# And Assignments list is empty - @javascript - Scenario: Changes can be discarded while editing Role - Given I am logged as admin - And I open "Roles" page in admin SiteAccess - And there's a "Test Role" Role on Roles list - When I edit "Test Role" from Roles list - And I set fields - | label | value | - | Name | Test Role edited | - And I perform the "Discard changes" action - Then I should be on "Roles" page - And there's a "Test Role" Role on Roles list - And there's no "Test Role edited" Role on Roles list +# @javascript +# Scenario: Changes can be discarded while editing Role +# Given I am logged as admin +# And I open "Roles" page in admin SiteAccess +# And there's a "Test Role" Role on Roles list +# When I edit "Test Role" from Roles list +# And I set fields +# | label | value | +# | Name | Test Role edited | +# And I perform the "Discard changes" action +# Then I should be on "Roles" page +# And there's a "Test Role" Role on Roles list +# And there's no "Test Role edited" Role on Roles list - @javascript - Scenario: Role can be edited - Given I am logged as admin - And I open "Roles" page in admin SiteAccess - And there's a "Test Role" Role on Roles list - When I edit "Test Role" from Roles list - And I set fields - | label | value | - | Name | Test Role edited | - And I perform the "Save" action from the "Save and close" group - Then I should be on "Test Role edited" Role page - And Policies list is empty - And Assignments list is empty +# @javascript +# Scenario: Role can be edited +# Given I am logged as admin +# And I open "Roles" page in admin SiteAccess +# And there's a "Test Role" Role on Roles list +# When I edit "Test Role" from Roles list +# And I set fields +# | label | value | +# | Name | Test Role edited | +# And I perform the "Save" action from the "Save and close" group +# Then I should be on "Test Role edited" Role page +# And Policies list is empty +# And Assignments list is empty - @javascript - Scenario: User assignation can be discarded - Given I am logged as admin - And I open "Roles" page in admin SiteAccess - And there's a "Test Role edited" Role on Roles list - When I start assigning to "Test Role edited" from Roles page - And I assign users to role - | path | - | Users/Administrator users/Administrator User | - And I assign groups to role - | path | - | Users/Editors | - | Users | - And I select "Media" from Sections as role assignment limitation - And I perform the "Cancel" action - Then I should be on "Test Role edited" Role page - And Policies list is empty - And Assignments list is empty +# @javascript +# Scenario: User assignation can be discarded +# Given I am logged as admin +# And I open "Roles" page in admin SiteAccess +# And there's a "Test Role edited" Role on Roles list +# When I start assigning to "Test Role edited" from Roles page +# And I assign users to role +# | path | +# | Users/Administrator users/Administrator User | +# And I assign groups to role +# | path | +# | Users/Editors | +# | Users | +# And I select "Media" from Sections as role assignment limitation +# And I perform the "Cancel" action +# Then I should be on "Test Role edited" Role page +# And Policies list is empty +# And Assignments list is empty - @javascript - Scenario: User can be assigned to role from the Roles list - Given I am logged as admin - And I open "Roles" page in admin SiteAccess - And there's a "Test Role edited" Role on Roles list - When I start assigning to "Test Role edited" from Roles page - And I assign users to role - | path | - | Users/Anonymous users/Anonymous User | - | Users/Administrator users/Administrator User | - And I assign groups to role - | path | - | Users/Editors | - And I select limitation "Media/Images" for assignment through UDW - And I perform the "Save" action from the "Save and close" group - Then I should be on "Test Role edited" Role page - And Policies list is empty - And there are assignments on the "Test Role edited" assignments list - | User/Group | Limitation | - | Administrator User | Subtree: /Media/Images | - | Anonymous User | Subtree: /Media/Images | - | Editors | Subtree: /Media/Images | +# @javascript +# Scenario: User can be assigned to role from the Roles list +# Given I am logged as admin +# And I open "Roles" page in admin SiteAccess +# And there's a "Test Role edited" Role on Roles list +# When I start assigning to "Test Role edited" from Roles page +# And I assign users to role +# | path | +# | Users/Anonymous users/Anonymous User | +# | Users/Administrator users/Administrator User | +# And I assign groups to role +# | path | +# | Users/Editors | +# And I select limitation "Media/Images" for assignment through UDW +# And I perform the "Save" action from the "Save and close" group +# Then I should be on "Test Role edited" Role page +# And Policies list is empty +# And there are assignments on the "Test Role edited" assignments list +# | User/Group | Limitation | +# | Administrator User | Subtree: /Media/Images | +# | Anonymous User | Subtree: /Media/Images | +# | Editors | Subtree: /Media/Images | - @javascript - Scenario: User can be assigned to role from the Role details view - Given I am logged as admin - And I open "Test Role edited" Role page in admin SiteAccess - When I start assigning users and groups from Role page - And I assign groups to role - | path | - | Users | - And I perform the "Save" action from the "Save and close" group - Then I should be on "Test Role edited" Role page - And Policies list is empty - And there are assignments on the "Test Role edited" assignments list - | User/Group | Limitation | - | Administrator User | Subtree: /Media/Images | - | Editors | Subtree: /Media/Images | - | Anonymous User | Subtree: /Media/Images | - | Users | None | +# @javascript +# Scenario: User can be assigned to role from the Role details view +# Given I am logged as admin +# And I open "Test Role edited" Role page in admin SiteAccess +# When I start assigning users and groups from Role page +# And I assign groups to role +# | path | +# | Users | +# And I perform the "Save" action from the "Save and close" group +# Then I should be on "Test Role edited" Role page +# And Policies list is empty +# And there are assignments on the "Test Role edited" assignments list +# | User/Group | Limitation | +# | Administrator User | Subtree: /Media/Images | +# | Editors | Subtree: /Media/Images | +# | Anonymous User | Subtree: /Media/Images | +# | Users | None | - @javascript - Scenario: Assignment can be deleted from role - Given I am logged as admin - And I open "Test Role edited" Role page in admin SiteAccess - When I delete assignment from "Test Role edited" role - | item | - | Administrator User | - | Editors | - | Users | - Then I should be on "Test Role edited" Role page - And Policies list is empty - And there are assignments on the "Test Role edited" assignments list - | User/Group | Limitation | - | Anonymous User | Subtree: /Media/Images | +# @javascript +# Scenario: Assignment can be deleted from role +# Given I am logged as admin +# And I open "Test Role edited" Role page in admin SiteAccess +# When I delete assignment from "Test Role edited" role +# | item | +# | Administrator User | +# | Editors | +# | Users | +# Then I should be on "Test Role edited" Role page +# And Policies list is empty +# And there are assignments on the "Test Role edited" assignments list +# | User/Group | Limitation | +# | Anonymous User | Subtree: /Media/Images | - @javascript - Scenario: Adding policy can be discarded - Given I am logged as admin - And I open "Test Role edited" Role page in admin SiteAccess - When I start creating a new Policy - And I select policy "Content Type / All functions" - And I perform the "Discard changes" action - Then I should be on "Test Role edited" Role page - And Policies list is empty - And there are assignments on the "Test Role edited" assignments list - | User/Group | Limitation | - | Anonymous User | Subtree: /Media/Images | +# @javascript +# Scenario: Adding policy can be discarded +# Given I am logged as admin +# And I open "Test Role edited" Role page in admin SiteAccess +# When I start creating a new Policy +# And I select policy "Content Type / All functions" +# And I perform the "Discard changes" action +# Then I should be on "Test Role edited" Role page +# And Policies list is empty +# And there are assignments on the "Test Role edited" assignments list +# | User/Group | Limitation | +# | Anonymous User | Subtree: /Media/Images | - @javascript - Scenario: Policies can be added to role - Given I am logged as admin - And I open "Test Role edited" Role page in admin SiteAccess - When I start creating a new Policy - And I select policy "Content / Read" - And I perform the "Create" action - And success notification that "Now you can set Limitations for the Policy." appears - And I select limitation for "Content Type" - | option | - | File | - And I perform the "Update" action - Then I should be on "Test Role edited" Role page - And there is a policy "Content/Read" with "Content Type: File" limitation on the "Test Role edited" policies list - And there are assignments on the "Test Role edited" assignments list - | User/Group | Limitation | - | Anonymous User | Subtree: /Media/Images | +# @javascript +# Scenario: Policies can be added to role +# Given I am logged as admin +# And I open "Test Role edited" Role page in admin SiteAccess +# When I start creating a new Policy +# And I select policy "Content / Read" +# And I perform the "Create" action +# And success notification that "Now you can set Limitations for the Policy." appears +# And I select limitation for "Content Type" +# | option | +# | File | +# And I perform the "Update" action +# Then I should be on "Test Role edited" Role page +# And there is a policy "Content/Read" with "Content Type: File" limitation on the "Test Role edited" policies list +# And there are assignments on the "Test Role edited" assignments list +# | User/Group | Limitation | +# | Anonymous User | Subtree: /Media/Images | - @javascript - Scenario: Policies without limitations can be added to role - Given I am logged as admin - And I open "Test Role edited" Role page in admin SiteAccess - When I start creating a new Policy - And I select policy "User / Password" - And I perform the "Create" action - Then I should be on "Test Role edited" Role page - And there is a policy "User/Password" with "None" limitation on the "Test Role edited" policies list - And there are assignments on the "Test Role edited" assignments list - | User/Group | Limitation | - | Anonymous User | Subtree: /Media/Images | +# @javascript +# Scenario: Policies without limitations can be added to role +# Given I am logged as admin +# And I open "Test Role edited" Role page in admin SiteAccess +# When I start creating a new Policy +# And I select policy "User / Password" +# And I perform the "Create" action +# Then I should be on "Test Role edited" Role page +# And there is a policy "User/Password" with "None" limitation on the "Test Role edited" policies list +# And there are assignments on the "Test Role edited" assignments list +# | User/Group | Limitation | +# | Anonymous User | Subtree: /Media/Images | - @javascript - Scenario: Policies can be edited - Given I am logged as admin - And I open "Test Role edited" Role page in admin SiteAccess - When I start editing the policy "Content" "Read" - And I select limitation for "Content Type" - | option | - | Article | - | Folder | - And I select subtree limitation "Users/Anonymous users" for policy through UDW - And I select limitation for "State" - | option | - | Lock:Locked | - And I perform the "Update" action - Then I should be on "Test Role edited" Role page - And there are policies on the "Test Role edited" policies list - | policy | limitation | - | Content/Read | Content Type: Article, Folder | - | Content/Read | Subtree: /Users/Anonymous users | - | Content/Read | State: Lock:Locked | - And there are assignments on the "Test Role edited" assignments list - | User/Group | Limitation | - | Anonymous User | Subtree: /Media/Images | +# @javascript +# Scenario: Policies can be edited +# Given I am logged as admin +# And I open "Test Role edited" Role page in admin SiteAccess +# When I start editing the policy "Content" "Read" +# And I select limitation for "Content Type" +# | option | +# | Article | +# | Folder | +# And I select subtree limitation "Users/Anonymous users" for policy through UDW +# And I select limitation for "State" +# | option | +# | Lock:Locked | +# And I perform the "Update" action +# Then I should be on "Test Role edited" Role page +# And there are policies on the "Test Role edited" policies list +# | policy | limitation | +# | Content/Read | Content Type: Article, Folder | +# | Content/Read | Subtree: /Users/Anonymous users | +# | Content/Read | State: Lock:Locked | +# And there are assignments on the "Test Role edited" assignments list +# | User/Group | Limitation | +# | Anonymous User | Subtree: /Media/Images | - @javascript - Scenario: Policy can be deleted - Given I am logged as admin - And I open "Test Role edited" Role page in admin SiteAccess - When I delete policy from "Test Role edited" role - | item | - | Content | - Then success notification that "Removed Policies from Role 'Test Role edited'." appears - And there is no policy "Content/Read" with "Content Type: File" limitation on the "Test Role edited" policies list - And there are assignments on the "Test Role edited" assignments list - | User/Group | Limitation | - | Anonymous User | Subtree: /Media/Images | +# @javascript +# Scenario: Policy can be deleted +# Given I am logged as admin +# And I open "Test Role edited" Role page in admin SiteAccess +# When I delete policy from "Test Role edited" role +# | item | +# | Content | +# Then success notification that "Removed Policies from Role 'Test Role edited'." appears +# And there is no policy "Content/Read" with "Content Type: File" limitation on the "Test Role edited" policies list +# And there are assignments on the "Test Role edited" assignments list +# | User/Group | Limitation | +# | Anonymous User | Subtree: /Media/Images | - @javascript - Scenario: Role can be deleted - Given I am logged as admin - And I open "Roles" page in admin SiteAccess - And there's a "Test Role edited" Role on Roles list - When I delete Role "Test Role edited" - Then notification that "Role" "Test Role edited" is removed appears - And there's no "Test Role edited" Role on Roles list +# @javascript +# Scenario: Role can be deleted +# Given I am logged as admin +# And I open "Roles" page in admin SiteAccess +# And there's a "Test Role edited" Role on Roles list +# When I delete Role "Test Role edited" +# Then notification that "Role" "Test Role edited" is removed appears +# And there's no "Test Role edited" Role on Roles list - @javascript - Scenario: I can access role that has limitation to deleted location - Given I am using the API as "admin" - And I create "folder" Content items in root in "eng-GB" - | name | short_name | - | DeletedLocation | DeletedLocation | - And I create a role "DeletedLocationRole" - And I add policy "content" "read" to "DeletedLocationRole" with limitations - | limitationType | limitationValue | - | Location | /DeletedLocation | - And I send "/DeletedLocation" to the Trash - When I am logged as admin - And I open "DeletedLocationRole" Role page in admin SiteAccess - Then I should be on "DeletedLocationRole" Role page +# @javascript +# Scenario: I can access role that has limitation to deleted location +# Given I am using the API as "admin" +# And I create "folder" Content items in root in "eng-GB" +# | name | short_name | +# | DeletedLocation | DeletedLocation | +# And I create a role "DeletedLocationRole" +# And I add policy "content" "read" to "DeletedLocationRole" with limitations +# | limitationType | limitationValue | +# | Location | /DeletedLocation | +# And I send "/DeletedLocation" to the Trash +# When I am logged as admin +# And I open "DeletedLocationRole" Role page in admin SiteAccess +# Then I should be on "DeletedLocationRole" Role page From a97cd30906c7f2280874ba197a47c5bae5dc683f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Thu, 7 Sep 2023 17:33:41 +0200 Subject: [PATCH 17/40] Fixes --- features/standard/Autosave.feature | 2 +- features/standard/ContentType.feature | 8 ++++---- features/standard/ContentTypeGroup.feature | 8 ++++---- src/lib/Behat/Component/ContentActionsMenu.php | 17 +++++++++++++++-- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/features/standard/Autosave.feature b/features/standard/Autosave.feature index 149bd6c463..d28bbdae52 100644 --- a/features/standard/Autosave.feature +++ b/features/standard/Autosave.feature @@ -39,7 +39,7 @@ Feature: Content Items creation And I'm on Content view Page for root And I go to user settings And I disable autosave - And I perform the "Save" action from the "Save and close" group + And I perform the "Save" action And I'm on Content view Page for root When I start creating a new content "Article" And I set content fields diff --git a/features/standard/ContentType.feature b/features/standard/ContentType.feature index c30ee8a735..0daa7ce5a7 100644 --- a/features/standard/ContentType.feature +++ b/features/standard/ContentType.feature @@ -15,7 +15,7 @@ Feature: Content types management | label | value | | Name | Test Content Type | | Identifier | TestContentTypeIdentifier | - And I perform the "Cancel" action + And I perform the "Discard" action Then I should be on Content Type group page for "Content" group And there's no "Test Content Type" on Content Types list @@ -31,7 +31,7 @@ Feature: Content types management And I select "Content" category to Content Type definition And I add field "Country" to Content Type definition And I set "Name" to "Country field" for "Country" field - And I perform the "Create" action + And I perform the "Save and close" action Then notification that "Content Type" "New Content Type" is updated appears Then I should be on Content Type page for "Test Content Type" And Content Type has proper Global properties @@ -54,7 +54,7 @@ Feature: Content types management And I set fields | label | value | | Name | Test Content Type edited | - And I perform the "Cancel" action + And I perform the "Discard" action Then I should be on Content Type group page for "Content" group And there's a "TestDiscard CT" on Content Types list And there's no "Test Content Type edited" on Content Types list @@ -71,7 +71,7 @@ Feature: Content types management | Name | Test Content Type edited | And I add field "Date" to Content Type definition And I set "Name" to "DateField" for "Date" field - And I perform the "Save" action from the "Save and close" group + And I perform the "Save and close" action Then success notification that "Content Type 'TestEdit CT' updated." appears Then I should be on Content Type page for "Test Content Type edited" And Content Type has proper Global properties diff --git a/features/standard/ContentTypeGroup.feature b/features/standard/ContentTypeGroup.feature index c5c0043d64..14c5e2f5d5 100644 --- a/features/standard/ContentTypeGroup.feature +++ b/features/standard/ContentTypeGroup.feature @@ -14,7 +14,7 @@ Feature: Content type groups management And I set fields | label | value | | Name | Test Content Type Group | - And I perform the "Discard changes" action + And I perform the "Discard" action Then I should be on "Content Type groups" page And there's no "Test Content Type Group" Content Type group on Content Type groups list @@ -25,7 +25,7 @@ Feature: Content type groups management And I set fields | label | value | | Name | Test Content Type Group | - And I perform the "Create" action + And I perform the "Save and close" action Then I should be on Content Type group page for "Test Content Type Group" group And there're no Content Types for that group @@ -37,7 +37,7 @@ Feature: Content type groups management And I set fields | label | value | | Name | Test Content Type Group edited | - And I perform the "Discard changes" action + And I perform the "Discard" action Then I should be on "Content Type groups" page And there's a "Test Content Type Group" Content Type group on Content Type groups list And there's no "Test Content Type Group edited" Content Type group on Content Type groups list @@ -50,7 +50,7 @@ Feature: Content type groups management And I set fields | label | value | | Name | Test Content Type Group edited | - And I perform the "Save" action from the "Save and close" group + And I perform the "Save and close" action Then I should be on Content Type group page for "Test Content Type Group edited" group And success notification that "Updated Content Type group 'Test Content Type Group'." appears diff --git a/src/lib/Behat/Component/ContentActionsMenu.php b/src/lib/Behat/Component/ContentActionsMenu.php index 71754cc689..db6a730953 100644 --- a/src/lib/Behat/Component/ContentActionsMenu.php +++ b/src/lib/Behat/Component/ContentActionsMenu.php @@ -10,6 +10,7 @@ use Ibexa\Behat\Browser\Component\Component; use Ibexa\Behat\Browser\Element\Criterion\ElementTextCriterion; +use Ibexa\Behat\Browser\Exception\TimeoutException; use Ibexa\Behat\Browser\Locator\VisibleCSSLocator; class ContentActionsMenu extends Component @@ -41,7 +42,13 @@ private function clickStandaloneButton(string $buttonName): void return; } - $this->getHTMLPage()->find($this->getLocator('moreButton'))->click(); + try { + $this->getHTMLPage()->find($this->getLocator('moreButton'))->click(); + } catch (TimeoutException $e) { + $this->getHTMLPage() + ->findAll($this->getLocator('menuButton')) + ->getByCriterion(new ElementTextCriterion($buttonName)); + } $this->getHTMLPage() ->findAll($this->getLocator('expandedMenuButton')) ->getByCriterion(new ElementTextCriterion($buttonName))->click(); @@ -64,7 +71,13 @@ private function clickButtonInGroup(string $groupName, string $buttonName): void return; } - $this->getHTMLPage()->find($this->getLocator('moreButton'))->click(); + try { + $this->getHTMLPage()->find($this->getLocator('moreButton'))->click(); + } catch (TimeoutException $e) { + $this->getHTMLPage() + ->findAll($this->getLocator('menuButton')) + ->getByCriterion(new ElementTextCriterion($buttonName)); + } $this->getHTMLPage() ->findAll($this->getLocator('expandedMenuButton')) ->getByCriterion(new ElementTextCriterion($groupName)) From 86f339d483a4f0f4bfc17d868fe0dfac21a482ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Thu, 7 Sep 2023 19:13:49 +0200 Subject: [PATCH 18/40] Fix --- features/standard/ObjectStates.feature | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/features/standard/ObjectStates.feature b/features/standard/ObjectStates.feature index 6a29200acf..7e354491b0 100644 --- a/features/standard/ObjectStates.feature +++ b/features/standard/ObjectStates.feature @@ -57,7 +57,7 @@ Feature: Object States management And I set fields | label | value | | Name | Test Object State Group edited | - And I perform the "Save" action from the "Save and close" group + And I perform the "Save and close" action Then notification that "Object state group" "Test Object State Group edited" is updated appears And I should be on "Test Object State Group edited" Object State group page @@ -80,7 +80,7 @@ Feature: Object States management And I set fields | label | value | | Name | Test Object State Group edited2 | - And I perform the "Save" action from the "Save and close" group + And I perform the "Save and close" action Then notification that "Object state group" "Test Object State Group edited2" is updated appears And I should be on "Test Object State Group edited2" Object State group page @@ -131,7 +131,7 @@ Feature: Object States management And I set fields | label | value | | Name | Test Object State edited | - And I perform the "Save" action from the "Save and close" group + And I perform the "Save and close" action Then notification that "Object state" "Test Object State edited" is updated appears And I should be on "Test Object State edited" Object State page And Object State has proper attributes @@ -158,7 +158,7 @@ Feature: Object States management And I set fields | label | value | | Name | Test Object State edited2 | - And I perform the "Save" action from the "Save and close" group + And I perform the "Save and close" action Then notification that "Object state" "Test Object State edited2" is updated appears And I should be on "Test Object State edited2" Object State page And Object State has proper attributes From 97bffe785bf2c39b3172acf8497495f8d991e661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Thu, 7 Sep 2023 19:14:39 +0200 Subject: [PATCH 19/40] Fix --- features/standard/Sections.feature | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/features/standard/Sections.feature b/features/standard/Sections.feature index 1a71a2e7c7..84e5e9c7ac 100644 --- a/features/standard/Sections.feature +++ b/features/standard/Sections.feature @@ -84,7 +84,7 @@ Feature: Sections management And I set fields | label | value | | Name | Test Section edited | - And I perform the "Save" action from the "Save and close" group + And I perform the "Save and close" action Then I should be on "Test Section edited" Section page And notification that "Section" "Test Section edited" is updated appears @@ -107,7 +107,7 @@ Feature: Sections management And I set fields | label | value | | Name | Test Section edited2 | - And I perform the "Save" action from the "Save and close" group + And I perform the "Save and close" action Then I should be on "Test Section edited2" Section page And notification that "Section" "Test Section edited2" is updated appears @@ -147,7 +147,7 @@ Feature: Sections management | label | value | | Name | Test Section | | Identifier | TestSectionIdentifier2 | - And I perform the "Create" action + And I perform the "Save and close" action And notification that "Section" "Test Section" is created appears When I delete the section Then notification that "Section" "Test Section" is removed appears From 8a8fa75e38a2de4755abadbf0c1848c4f4483cc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Thu, 7 Sep 2023 19:22:51 +0200 Subject: [PATCH 20/40] Fixes --- features/standard/ContentType.feature | 2 +- features/standard/ContentTypeGroup.feature | 2 +- features/standard/Languages.feature | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/features/standard/ContentType.feature b/features/standard/ContentType.feature index 0daa7ce5a7..eec74fafe3 100644 --- a/features/standard/ContentType.feature +++ b/features/standard/ContentType.feature @@ -54,7 +54,7 @@ Feature: Content types management And I set fields | label | value | | Name | Test Content Type edited | - And I perform the "Discard" action + And I perform the "Delete draft" action Then I should be on Content Type group page for "Content" group And there's a "TestDiscard CT" on Content Types list And there's no "Test Content Type edited" on Content Types list diff --git a/features/standard/ContentTypeGroup.feature b/features/standard/ContentTypeGroup.feature index 14c5e2f5d5..cd0c170eb7 100644 --- a/features/standard/ContentTypeGroup.feature +++ b/features/standard/ContentTypeGroup.feature @@ -37,7 +37,7 @@ Feature: Content type groups management And I set fields | label | value | | Name | Test Content Type Group edited | - And I perform the "Discard" action + And I perform the "Discard changes" action Then I should be on "Content Type groups" page And there's a "Test Content Type Group" Content Type group on Content Type groups list And there's no "Test Content Type Group edited" Content Type group on Content Type groups list diff --git a/features/standard/Languages.feature b/features/standard/Languages.feature index 7eba628648..e22e51d3db 100644 --- a/features/standard/Languages.feature +++ b/features/standard/Languages.feature @@ -49,7 +49,7 @@ Feature: Languages management And I set fields | label | value | | Name | Edited Deutsch | - And I perform the "Discard" action + And I perform the "Discard changes" action Then I should be on "Languages" page And there's a "Deutsch" Language on Languages list And there's no "Edited Deutsch" Language on Languages list From 56edaf87dd9dd23300cf43cdb813d89db14c72ba Mon Sep 17 00:00:00 2001 From: tischsoic Date: Fri, 8 Sep 2023 09:54:11 +0200 Subject: [PATCH 21/40] generated translations only --- .../ibexa_content_forms_role.en.xliff | 15 ++++++++++----- .../translations/ibexa_content_type.en.xliff | 9 +++++++-- .../translations/ibexa_dashboard.en.xliff | 5 ----- .../Resources/translations/ibexa_menu.en.xliff | 10 ---------- .../translations/ibexa_url_wildcard.en.xliff | 10 ++++++++++ 5 files changed, 27 insertions(+), 22 deletions(-) diff --git a/src/bundle/Resources/translations/ibexa_content_forms_role.en.xliff b/src/bundle/Resources/translations/ibexa_content_forms_role.en.xliff index 88b2620498..d135857ff0 100644 --- a/src/bundle/Resources/translations/ibexa_content_forms_role.en.xliff +++ b/src/bundle/Resources/translations/ibexa_content_forms_role.en.xliff @@ -31,16 +31,21 @@ Create key: policy_create.save - - Update - Update - key: policy_create.update - Delete Delete key: policy_delete.delete + + Save + Save + key: policy_update.save + + + Save and close + Save and close + key: policy_update.save_and_close + Select Locations Select Locations diff --git a/src/bundle/Resources/translations/ibexa_content_type.en.xliff b/src/bundle/Resources/translations/ibexa_content_type.en.xliff index fa4772ad4f..f3b4c115ab 100644 --- a/src/bundle/Resources/translations/ibexa_content_type.en.xliff +++ b/src/bundle/Resources/translations/ibexa_content_type.en.xliff @@ -426,9 +426,14 @@ Name key: content_type_group.update.name + + Save + Save + key: content_type_group.update.save + - Update - Update + Save and close + Save and close key: content_type_group.update.submit diff --git a/src/bundle/Resources/translations/ibexa_dashboard.en.xliff b/src/bundle/Resources/translations/ibexa_dashboard.en.xliff index 8f1ddd71f8..5d167fe9ea 100644 --- a/src/bundle/Resources/translations/ibexa_dashboard.en.xliff +++ b/src/bundle/Resources/translations/ibexa_dashboard.en.xliff @@ -6,11 +6,6 @@ The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message. - - Dashboard - Dashboard - key: dashboard.breadcrumbs.dashboard - Create content Create content diff --git a/src/bundle/Resources/translations/ibexa_menu.en.xliff b/src/bundle/Resources/translations/ibexa_menu.en.xliff index b86041c34e..2c0b3f6c32 100644 --- a/src/bundle/Resources/translations/ibexa_menu.en.xliff +++ b/src/bundle/Resources/translations/ibexa_menu.en.xliff @@ -46,11 +46,6 @@ Move key: content__sidebar_right__move - - Preview - Preview - key: content__sidebar_right__preview - Reveal Reveal @@ -291,11 +286,6 @@ Dashboard key: main__dashboard - - Drafts - Drafts - key: main__drafts - Trash Trash diff --git a/src/bundle/Resources/translations/ibexa_url_wildcard.en.xliff b/src/bundle/Resources/translations/ibexa_url_wildcard.en.xliff index e10cb7ea0c..beac85605c 100644 --- a/src/bundle/Resources/translations/ibexa_url_wildcard.en.xliff +++ b/src/bundle/Resources/translations/ibexa_url_wildcard.en.xliff @@ -111,6 +111,16 @@ URL wildcard key: url_wildcard.modal.create.url.wildcard + + Save + Save + key: url_wildcard.save + + + Save and close + Save and close + key: url_wildcard.save_and_close + Search for URL wildcards Search for URL wildcards From 9ec09ff0399618f3a5420e95d42d16bfe96e9ed9 Mon Sep 17 00:00:00 2001 From: tischsoic Date: Fri, 8 Sep 2023 11:22:02 +0200 Subject: [PATCH 22/40] fix missing save_and_close button in role create form --- src/bundle/Resources/translations/forms.en.xliff | 5 +++++ src/lib/Form/Type/Role/RoleCreateType.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/bundle/Resources/translations/forms.en.xliff b/src/bundle/Resources/translations/forms.en.xliff index 2d537ba51e..26e5ea7651 100644 --- a/src/bundle/Resources/translations/forms.en.xliff +++ b/src/bundle/Resources/translations/forms.en.xliff @@ -241,6 +241,11 @@ Save key: role_create.save + + Save and close + Save and close + key: role_create.save_and_close + Delete Delete diff --git a/src/lib/Form/Type/Role/RoleCreateType.php b/src/lib/Form/Type/Role/RoleCreateType.php index c2f855326d..f99f776da0 100644 --- a/src/lib/Form/Type/Role/RoleCreateType.php +++ b/src/lib/Form/Type/Role/RoleCreateType.php @@ -31,6 +31,11 @@ public function buildForm(FormBuilderInterface $builder, array $options) self::BTN_SAVE, SubmitType::class, ['label' => /** @Desc("Save") */ 'role_create.save'] + ) + ->add( + 'save_and_close', + SubmitType::class, + ['label' => /** @Desc("Save and close") */ 'role_create.save_and_close'] ); } From 9fb0c10c987faed7c131d8689e046526e62b6c0d Mon Sep 17 00:00:00 2001 From: tischsoic Date: Sat, 9 Sep 2023 21:07:44 +0200 Subject: [PATCH 23/40] fix phpstan on this branch --- phpstan-baseline.neon | 41 ++----------------- src/bundle/Controller/RoleController.php | 1 + .../Processor/ContentEditFormProcessor.php | 4 +- .../ContentType/ContentTypeFormProcessor.php | 2 +- 4 files changed, 7 insertions(+), 41 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index d823af36bf..2b765aacb7 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -452,7 +452,7 @@ parameters: - message: "#^Access to protected property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\URL\\\\URL\\:\\:\\$id\\.$#" - count: 1 + count: 2 path: src/bundle/Controller/LinkManagerController.php - @@ -775,14 +775,9 @@ parameters: count: 1 path: src/bundle/Controller/RoleAssignmentController.php - - - message: "#^Cannot access property \\$id on Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\User\\\\Role\\|null\\.$#" - count: 1 - path: src/bundle/Controller/RoleController.php - - message: "#^Cannot access property \\$identifier on Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\User\\\\Role\\|null\\.$#" - count: 2 + count: 1 path: src/bundle/Controller/RoleController.php - @@ -805,11 +800,6 @@ parameters: count: 1 path: src/bundle/Controller/RoleController.php - - - message: "#^Parameter \\#1 \\$role of method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\RoleService\\:\\:createRoleDraft\\(\\) expects Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\User\\\\Role, Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\User\\\\Role\\|null given\\.$#" - count: 1 - path: src/bundle/Controller/RoleController.php - - message: "#^Parameter \\#1 \\$role of method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\RoleService\\:\\:deleteRole\\(\\) expects Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\User\\\\Role, Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\User\\\\Role\\|null given\\.$#" count: 1 @@ -940,11 +930,6 @@ parameters: count: 1 path: src/bundle/Controller/URLWildcardController.php - - - message: "#^Parameter \\#2 \\$handler of method Ibexa\\\\AdminUi\\\\Form\\\\SubmitHandler\\:\\:handle\\(\\) expects callable\\(mixed\\)\\: \\(Symfony\\\\Component\\\\HttpFoundation\\\\Response\\|null\\), Closure\\(Ibexa\\\\AdminUi\\\\Form\\\\Data\\\\URLWildcard\\\\URLWildcardData\\)\\: void given\\.$#" - count: 1 - path: src/bundle/Controller/URLWildcardController.php - - message: "#^Parameter \\#2 \\$handler of method Ibexa\\\\AdminUi\\\\Form\\\\SubmitHandler\\:\\:handle\\(\\) expects callable\\(mixed\\)\\: \\(Symfony\\\\Component\\\\HttpFoundation\\\\Response\\|null\\), Closure\\(Ibexa\\\\AdminUi\\\\Form\\\\Data\\\\URLWildcard\\\\URLWildcardDeleteData\\)\\: void given\\.$#" count: 1 @@ -8012,7 +7997,7 @@ parameters: - message: "#^Cannot access property \\$vars on Symfony\\\\Component\\\\Form\\\\FormView\\|null\\.$#" - count: 2 + count: 3 path: src/lib/Menu/Admin/ContentType/AbstractContentTypeRightSidebarBuilder.php - @@ -8060,11 +8045,6 @@ parameters: count: 1 path: src/lib/Menu/Admin/Language/LanguageEditRightSidebarBuilder.php - - - message: "#^Variable \\$language in PHPDoc tag @var does not match assigned variable \\$saveId\\.$#" - count: 1 - path: src/lib/Menu/Admin/Language/LanguageEditRightSidebarBuilder.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Menu\\\\Admin\\\\ObjectState\\\\ObjectStateCreateRightSidebarBuilder\\:\\:createStructure\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" count: 1 @@ -8120,11 +8100,6 @@ parameters: count: 1 path: src/lib/Menu/Admin/Role/PolicyEditRightSidebarBuilder.php - - - message: "#^Variable \\$section in PHPDoc tag @var does not match assigned variable \\$saveId\\.$#" - count: 1 - path: src/lib/Menu/Admin/Role/PolicyEditRightSidebarBuilder.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Menu\\\\Admin\\\\Role\\\\RoleAssignmentCreateRightSidebarBuilder\\:\\:createStructure\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" count: 1 @@ -8300,16 +8275,6 @@ parameters: count: 1 path: src/lib/Menu/TrashRightSidebarBuilder.php - - - message: "#^Access to protected property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\URL\\\\URL\\:\\:\\$id\\.$#" - count: 1 - path: src/lib/Menu/URLEditRightSidebarBuilder.php - - - - message: "#^Call to sprintf contains 0 placeholders, 1 value given\\.$#" - count: 1 - path: src/lib/Menu/URLEditRightSidebarBuilder.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Menu\\\\URLEditRightSidebarBuilder\\:\\:createStructure\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" count: 1 diff --git a/src/bundle/Controller/RoleController.php b/src/bundle/Controller/RoleController.php index 5b8f805f86..93533872de 100644 --- a/src/bundle/Controller/RoleController.php +++ b/src/bundle/Controller/RoleController.php @@ -228,6 +228,7 @@ public function updateAction(Request $request, Role $role): Response if ($form->isSubmitted()) { $result = $this->submitHandler->handle($form, function (RoleUpdateData $data) use ($form) { + /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role $role */ $role = $data->getRole(); $roleUpdateStruct = $this->roleUpdateMapper->reverseMap($data); diff --git a/src/lib/Form/Processor/ContentEditFormProcessor.php b/src/lib/Form/Processor/ContentEditFormProcessor.php index eb25f811c9..eb42344988 100644 --- a/src/lib/Form/Processor/ContentEditFormProcessor.php +++ b/src/lib/Form/Processor/ContentEditFormProcessor.php @@ -27,7 +27,7 @@ public function __construct( /** * {@inheritdoc} */ - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ ContentFormEvents::CONTENT_SAVE_DRAFT_AND_CLOSE => ['redirectToDraftsView', 5], @@ -37,7 +37,7 @@ public static function getSubscribedEvents() /** * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException */ - public function redirectToDraftsView(FormActionEvent $event) + public function redirectToDraftsView(FormActionEvent $event): void { $form = $event->getForm(); $formConfig = $form->getConfig(); diff --git a/src/lib/Form/Processor/ContentType/ContentTypeFormProcessor.php b/src/lib/Form/Processor/ContentType/ContentTypeFormProcessor.php index 797d9da09e..c34475dc2d 100644 --- a/src/lib/Form/Processor/ContentType/ContentTypeFormProcessor.php +++ b/src/lib/Form/Processor/ContentType/ContentTypeFormProcessor.php @@ -169,7 +169,7 @@ public function processPublishContentType(FormActionEvent $event) } } - public function processPublishAndEditContentType(FormActionEvent $event) + public function processPublishAndEditContentType(FormActionEvent $event): void { $eventData = $event->getData(); /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft */ From 9632a1ac46dcbb5980d59ccb97959f8cf72cfc1f Mon Sep 17 00:00:00 2001 From: tischsoic Date: Sun, 10 Sep 2023 22:11:14 +0200 Subject: [PATCH 24/40] delete close_href --- .../Resources/views/themes/admin/content/edit_base.html.twig | 4 ---- .../admin/content_type/content_type_group/base.html.twig | 4 ---- .../views/themes/admin/content_type/edit_base.html.twig | 3 --- .../Resources/views/themes/admin/language/base.html.twig | 4 ---- .../Resources/views/themes/admin/link_manager/edit.html.twig | 4 ---- .../Resources/views/themes/admin/object_state/base.html.twig | 4 ---- .../admin/object_state/object_state_group/base.html.twig | 4 ---- .../Resources/views/themes/admin/section/base.html.twig | 4 ---- .../Resources/views/themes/admin/user/policy/base.html.twig | 4 ---- .../Resources/views/themes/admin/user/role/base.html.twig | 4 ---- .../views/themes/admin/user/role_assignment/base.html.twig | 1 - 11 files changed, 40 deletions(-) diff --git a/src/bundle/Resources/views/themes/admin/content/edit_base.html.twig b/src/bundle/Resources/views/themes/admin/content/edit_base.html.twig index d16fbcd4ea..bda41b6b6a 100644 --- a/src/bundle/Resources/views/themes/admin/content/edit_base.html.twig +++ b/src/bundle/Resources/views/themes/admin/content/edit_base.html.twig @@ -16,10 +16,6 @@ {% block left_sidebar %} {% if without_close_button is not defined or without_close_button != true %} {% set referrer_location = content is defined and is_published ? location : parent_location %} - - {% set anchor_params = anchor_params|merge({ - close_href: close_href|default(path('ibexa.content.view', { 'contentId': referrer_location.contentId, 'locationId': referrer_location.id })) - }) %} {% endif %} {% block anchor_menu %} diff --git a/src/bundle/Resources/views/themes/admin/content_type/content_type_group/base.html.twig b/src/bundle/Resources/views/themes/admin/content_type/content_type_group/base.html.twig index e100b98ea6..6d81a40315 100644 --- a/src/bundle/Resources/views/themes/admin/content_type/content_type_group/base.html.twig +++ b/src/bundle/Resources/views/themes/admin/content_type/content_type_group/base.html.twig @@ -4,10 +4,6 @@ {% block main_container_class %}ibexa-main-container--edit-container ibexa-main-container--without-anchor-menu-items{% endblock %} -{% set anchor_params = { - close_href: path('ibexa.content_type_group.list'), -} %} - {% block header %} {% block header_admin %}{% endblock %} {% endblock %} diff --git a/src/bundle/Resources/views/themes/admin/content_type/edit_base.html.twig b/src/bundle/Resources/views/themes/admin/content_type/edit_base.html.twig index 304f3f718f..e7740f9f61 100644 --- a/src/bundle/Resources/views/themes/admin/content_type/edit_base.html.twig +++ b/src/bundle/Resources/views/themes/admin/content_type/edit_base.html.twig @@ -4,9 +4,6 @@ {% form_theme form _self '@ibexadesign/ui/form_fields.html.twig' %} {% set anchor_params = { - close_href: path('ibexa.content_type_group.view', { - contentTypeGroupId: content_type_group.id - }), items: [ 'content_type.view.edit.global_properties'|trans|desc('Global properties'), 'content_type.view.edit.content_field_definitions'|trans|desc('Field definitions') diff --git a/src/bundle/Resources/views/themes/admin/language/base.html.twig b/src/bundle/Resources/views/themes/admin/language/base.html.twig index 555b495146..78c23b556f 100644 --- a/src/bundle/Resources/views/themes/admin/language/base.html.twig +++ b/src/bundle/Resources/views/themes/admin/language/base.html.twig @@ -4,10 +4,6 @@ {% block main_container_class %}ibexa-main-container--edit-container ibexa-main-container--without-anchor-menu-items{% endblock %} -{% set anchor_params = { - close_href: path('ibexa.language.list'), -} %} - {% block header %} {% block header_admin %}{% endblock %} {% endblock %} diff --git a/src/bundle/Resources/views/themes/admin/link_manager/edit.html.twig b/src/bundle/Resources/views/themes/admin/link_manager/edit.html.twig index 5bebed6df7..33ff0d37c1 100644 --- a/src/bundle/Resources/views/themes/admin/link_manager/edit.html.twig +++ b/src/bundle/Resources/views/themes/admin/link_manager/edit.html.twig @@ -4,10 +4,6 @@ {% trans_default_domain 'ibexa_linkmanager' %} -{% set anchor_params = { - close_href: path('ibexa.url_management'), -} %} - {% block header %} {% set url_create_sidebar_right = knp_menu_get('ezplatform_admin_ui.menu.url_edit.sidebar_right', [], { save_and_close_selector: '#' ~ form.saveAndClose.vars.id, diff --git a/src/bundle/Resources/views/themes/admin/object_state/base.html.twig b/src/bundle/Resources/views/themes/admin/object_state/base.html.twig index 1dfbb4f342..928b07c99b 100644 --- a/src/bundle/Resources/views/themes/admin/object_state/base.html.twig +++ b/src/bundle/Resources/views/themes/admin/object_state/base.html.twig @@ -2,10 +2,6 @@ {% trans_default_domain 'ibexa_object_state' %} -{% set anchor_params = { - close_href: path('ibexa.object_state.groups.list'), -} %} - {% block header %} {% block header_admin %}{% endblock %} {% endblock %} diff --git a/src/bundle/Resources/views/themes/admin/object_state/object_state_group/base.html.twig b/src/bundle/Resources/views/themes/admin/object_state/object_state_group/base.html.twig index 1dfbb4f342..928b07c99b 100644 --- a/src/bundle/Resources/views/themes/admin/object_state/object_state_group/base.html.twig +++ b/src/bundle/Resources/views/themes/admin/object_state/object_state_group/base.html.twig @@ -2,10 +2,6 @@ {% trans_default_domain 'ibexa_object_state' %} -{% set anchor_params = { - close_href: path('ibexa.object_state.groups.list'), -} %} - {% block header %} {% block header_admin %}{% endblock %} {% endblock %} diff --git a/src/bundle/Resources/views/themes/admin/section/base.html.twig b/src/bundle/Resources/views/themes/admin/section/base.html.twig index 78c1e9c036..fc42e4cd31 100644 --- a/src/bundle/Resources/views/themes/admin/section/base.html.twig +++ b/src/bundle/Resources/views/themes/admin/section/base.html.twig @@ -2,10 +2,6 @@ {% trans_default_domain 'ibexa_section' %} -{% set anchor_params = { - close_href: path('ibexa.section.list'), -} %} - {% set is_narrow_content = true %} {% block header %} diff --git a/src/bundle/Resources/views/themes/admin/user/policy/base.html.twig b/src/bundle/Resources/views/themes/admin/user/policy/base.html.twig index 7496631a91..7f505be97b 100644 --- a/src/bundle/Resources/views/themes/admin/user/policy/base.html.twig +++ b/src/bundle/Resources/views/themes/admin/user/policy/base.html.twig @@ -2,10 +2,6 @@ {% trans_default_domain 'ibexa_role' %} -{% set anchor_params = { - close_href: path('ibexa.role.view', {roleId: role.id}), -} %} - {% block header %} {% block header_admin %}{% endblock %} {% endblock %} diff --git a/src/bundle/Resources/views/themes/admin/user/role/base.html.twig b/src/bundle/Resources/views/themes/admin/user/role/base.html.twig index 0cc1ceaede..7f505be97b 100644 --- a/src/bundle/Resources/views/themes/admin/user/role/base.html.twig +++ b/src/bundle/Resources/views/themes/admin/user/role/base.html.twig @@ -2,10 +2,6 @@ {% trans_default_domain 'ibexa_role' %} -{% set anchor_params = { - close_href: path('ibexa.role.list'), -} %} - {% block header %} {% block header_admin %}{% endblock %} {% endblock %} diff --git a/src/bundle/Resources/views/themes/admin/user/role_assignment/base.html.twig b/src/bundle/Resources/views/themes/admin/user/role_assignment/base.html.twig index 524d08a967..e394699d0a 100644 --- a/src/bundle/Resources/views/themes/admin/user/role_assignment/base.html.twig +++ b/src/bundle/Resources/views/themes/admin/user/role_assignment/base.html.twig @@ -3,7 +3,6 @@ {% trans_default_domain 'ibexa_role' %} {% set anchor_params = { - close_href: path('ibexa.role.list'), items: [ 'role.users_and_groups'|trans|desc('Users and Groups'), 'role.limitations'|trans|desc('Limitations') From 897955fb82480b54c76d36a2e869b5cfbb0ebd6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Mon, 11 Sep 2023 11:59:13 +0200 Subject: [PATCH 25/40] Removed the close button --- features/standard/Autosave.feature | 2 -- features/standard/ContentDraft.feature | 4 ++-- src/lib/Behat/BrowserContext/ContentUpdateContext.php | 8 -------- src/lib/Behat/Component/ContentActionsMenu.php | 5 ----- src/lib/Behat/Page/ContentUpdateItemPage.php | 9 --------- 5 files changed, 2 insertions(+), 26 deletions(-) diff --git a/features/standard/Autosave.feature b/features/standard/Autosave.feature index d28bbdae52..bdbb04aab3 100644 --- a/features/standard/Autosave.feature +++ b/features/standard/Autosave.feature @@ -22,7 +22,6 @@ Feature: Content Items creation | Title | Test Article Autosave draft | | Short title | Test Article Autosave draft | And I wait for Content Item to be autosaved - And I click on the close button And I open the "Dashboard" page in admin SiteAccess Then there's draft "Test Article Autosave draft" on Dashboard list @@ -47,6 +46,5 @@ Feature: Content Items creation | Title | Test Article Autosave Off draft | | Short title | Test Article Autosave Off draft | And I check if "Autosave is off" notification is displayed - And I click on the close button And I open the "Dashboard" page in admin SiteAccess Then there's no draft "Test Article Autosave Off draft" on Dashboard list diff --git a/features/standard/ContentDraft.feature b/features/standard/ContentDraft.feature index 21c4868e96..5b70608e53 100644 --- a/features/standard/ContentDraft.feature +++ b/features/standard/ContentDraft.feature @@ -58,8 +58,8 @@ Feature: Content items creation And there's draft "TestDraftDashboardEdit" on Dashboard list And I start editing content draft "TestDraftDashboardEdit" And I should be on Content update page for "TestDraftDashboardEdit" - When I click on the close button - And I should be on Content view Page for root + When I perform the "Delete draft" action + Then I should be on Content view Page for root @javascript @APIUser:admin Scenario: Content draft can be created and published through draft list modal diff --git a/src/lib/Behat/BrowserContext/ContentUpdateContext.php b/src/lib/Behat/BrowserContext/ContentUpdateContext.php index 94123f1004..89277411f3 100644 --- a/src/lib/Behat/BrowserContext/ContentUpdateContext.php +++ b/src/lib/Behat/BrowserContext/ContentUpdateContext.php @@ -105,14 +105,6 @@ public function verifyFieldsAreSet(TableNode $table): void } } - /** - * @When I click on the close button - */ - public function iClickCloseButton(): void - { - $this->contentUpdateItemPage->close(); - } - /** * @When I switch to :tabName field group */ diff --git a/src/lib/Behat/Component/ContentActionsMenu.php b/src/lib/Behat/Component/ContentActionsMenu.php index db6a730953..8d1d9b602c 100644 --- a/src/lib/Behat/Component/ContentActionsMenu.php +++ b/src/lib/Behat/Component/ContentActionsMenu.php @@ -15,12 +15,8 @@ class ContentActionsMenu extends Component { - use \Ibexa\Behat\Core\Debug\InteractiveDebuggerTrait; - public function clickButton(string $buttonName, ?string $groupName = null): void { -// $this->setInteractiveBreakpoint(get_defined_vars()); - if ($groupName === null) { $this->clickStandaloneButton($buttonName); @@ -63,7 +59,6 @@ private function clickButtonInGroup(string $groupName, string $buttonName): void if ($group->any()) { $group->single()->find($this->getLocator('toggle'))->click(); -// $this->setInteractiveBreakpoint(get_defined_vars()); $this->getHTMLPage()->findAll($this->getLocator('button')) ->getByCriterion(new ElementTextCriterion($buttonName)) ->click(); diff --git a/src/lib/Behat/Page/ContentUpdateItemPage.php b/src/lib/Behat/Page/ContentUpdateItemPage.php index 7a89cbdbbc..6a4dc88c3a 100644 --- a/src/lib/Behat/Page/ContentUpdateItemPage.php +++ b/src/lib/Behat/Page/ContentUpdateItemPage.php @@ -13,7 +13,6 @@ use Ibexa\AdminUi\Behat\Component\Fields\FieldTypeComponent; use Ibexa\AdminUi\Behat\Component\Notification; use Ibexa\Behat\API\Facade\ContentFacade; -use Ibexa\Behat\Browser\Element\Condition\ElementExistsCondition; use Ibexa\Behat\Browser\Element\Condition\ElementHasTextCondition; use Ibexa\Behat\Browser\Element\Criterion\ElementTextCriterion; use Ibexa\Behat\Browser\Element\Criterion\ElementTextFragmentCriterion; @@ -94,13 +93,6 @@ public function fillFieldWithValue(string $label, array $value, ?int $fieldPosit $this->getField($label, $fieldPosition)->setValue($value); } - public function close(): void - { - $this->getHTMLPage()->setTimeout(3) - ->waitUntilCondition(new ElementExistsCondition($this->getHTMLPage(), $this->getLocator('closeButton'))); - $this->getHTMLPage()->find($this->getLocator('closeButton'))->click(); - } - public function verifyValidationMessage(string $fieldName, string $expectedMessage): void { $this->getField($fieldName)->verifyValidationMessage($expectedMessage); @@ -111,7 +103,6 @@ protected function specifyLocators(): array return [ new VisibleCSSLocator('pageTitle', '.ibexa-edit-header__title'), new VisibleCSSLocator('formElement', 'form.ibexa-form, .ibexa-edit-content'), - new VisibleCSSLocator('closeButton', '.ibexa-anchor-navigation-menu__close'), new VisibleCSSLocator('nthField', 'div.ibexa-field-edit:nth-of-type(%s)'), new VisibleCSSLocator('nthFieldWithSection', '[data-id="%s"] div.ibexa-field-edit:nth-of-type(%s)'), new VisibleCSSLocator('fieldGroupNthField', '[data-id="%s"] div.ibexa-field-edit:nth-of-type(%s)'), From bd26d2c3ddb1df2839393e313f6f474fbf3e169a Mon Sep 17 00:00:00 2001 From: tischsoic Date: Tue, 12 Sep 2023 09:40:25 +0200 Subject: [PATCH 26/40] fix rendering context menu items extra widgets --- .../views/themes/admin/ui/menu/context_menu.html.twig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/bundle/Resources/views/themes/admin/ui/menu/context_menu.html.twig b/src/bundle/Resources/views/themes/admin/ui/menu/context_menu.html.twig index 73ec190387..23e32fb83e 100644 --- a/src/bundle/Resources/views/themes/admin/ui/menu/context_menu.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/menu/context_menu.html.twig @@ -107,6 +107,12 @@ label, subitems, }) }} + + {% for item in item.children %} + {%- if item.extras.template is defined -%} + {% include item.extras.template with item.extras.template_parameters|default({}) %} + {%- endif -%} + {% endfor %} {% else %} {%- set default_classes = 'btn ibexa-btn' -%} From 0f41b078346e2f4251dc58766dcaef5bcc64f263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Thu, 14 Sep 2023 10:01:19 +0200 Subject: [PATCH 27/40] Brought back Roles feature --- features/standard/Roles.feature | 446 ++++++++++++++++---------------- 1 file changed, 223 insertions(+), 223 deletions(-) diff --git a/features/standard/Roles.feature b/features/standard/Roles.feature index 434515c503..fc27c5f7b4 100644 --- a/features/standard/Roles.feature +++ b/features/standard/Roles.feature @@ -1,238 +1,238 @@ -# @IbexaOSS @IbexaHeadless @IbexaExperience @IbexaCommerce -# Feature: Roles management -# As an administrator -# In order to customize my Ibexa installation -# I want to manage users Roles. +@IbexaOSS @IbexaHeadless @IbexaExperience @IbexaCommerce +Feature: Roles management + As an administrator + In order to customize my Ibexa installation + I want to manage users Roles. -# @javascript -# Scenario: Changes can be discarded while creating Role -# Given I am logged as admin -# And I open "Roles" page in admin SiteAccess -# When I create a new Role -# And I set fields -# | label | value | -# | Name | Test Role | -# And I perform the "Discard changes" action -# Then I should be on "Roles" page -# And there's no "Test Role" Role on Roles list + @javascript + Scenario: Changes can be discarded while creating Role + Given I am logged as admin + And I open "Roles" page in admin SiteAccess + When I create a new Role + And I set fields + | label | value | + | Name | Test Role | + And I perform the "Discard changes" action + Then I should be on "Roles" page + And there's no "Test Role" Role on Roles list -# @javascript -# Scenario: New Role can be created -# Given I am logged as admin -# And I open "Roles" page in admin SiteAccess -# When I create a new Role -# And I set fields -# | label | value | -# | Name | Test Role | -# And I perform the "Create" action -# Then I should be on "Test Role" Role page -# And Policies list is empty -# And Assignments list is empty + @javascript + Scenario: New Role can be created + Given I am logged as admin + And I open "Roles" page in admin SiteAccess + When I create a new Role + And I set fields + | label | value | + | Name | Test Role | + And I perform the "Create" action + Then I should be on "Test Role" Role page + And Policies list is empty + And Assignments list is empty -# @javascript -# Scenario: Changes can be discarded while editing Role -# Given I am logged as admin -# And I open "Roles" page in admin SiteAccess -# And there's a "Test Role" Role on Roles list -# When I edit "Test Role" from Roles list -# And I set fields -# | label | value | -# | Name | Test Role edited | -# And I perform the "Discard changes" action -# Then I should be on "Roles" page -# And there's a "Test Role" Role on Roles list -# And there's no "Test Role edited" Role on Roles list + @javascript + Scenario: Changes can be discarded while editing Role + Given I am logged as admin + And I open "Roles" page in admin SiteAccess + And there's a "Test Role" Role on Roles list + When I edit "Test Role" from Roles list + And I set fields + | label | value | + | Name | Test Role edited | + And I perform the "Discard changes" action + Then I should be on "Roles" page + And there's a "Test Role" Role on Roles list + And there's no "Test Role edited" Role on Roles list -# @javascript -# Scenario: Role can be edited -# Given I am logged as admin -# And I open "Roles" page in admin SiteAccess -# And there's a "Test Role" Role on Roles list -# When I edit "Test Role" from Roles list -# And I set fields -# | label | value | -# | Name | Test Role edited | -# And I perform the "Save" action from the "Save and close" group -# Then I should be on "Test Role edited" Role page -# And Policies list is empty -# And Assignments list is empty + @javascript + Scenario: Role can be edited + Given I am logged as admin + And I open "Roles" page in admin SiteAccess + And there's a "Test Role" Role on Roles list + When I edit "Test Role" from Roles list + And I set fields + | label | value | + | Name | Test Role edited | + And I perform the "Save" action from the "Save and close" group + Then I should be on "Test Role edited" Role page + And Policies list is empty + And Assignments list is empty -# @javascript -# Scenario: User assignation can be discarded -# Given I am logged as admin -# And I open "Roles" page in admin SiteAccess -# And there's a "Test Role edited" Role on Roles list -# When I start assigning to "Test Role edited" from Roles page -# And I assign users to role -# | path | -# | Users/Administrator users/Administrator User | -# And I assign groups to role -# | path | -# | Users/Editors | -# | Users | -# And I select "Media" from Sections as role assignment limitation -# And I perform the "Cancel" action -# Then I should be on "Test Role edited" Role page -# And Policies list is empty -# And Assignments list is empty + @javascript + Scenario: User assignation can be discarded + Given I am logged as admin + And I open "Roles" page in admin SiteAccess + And there's a "Test Role edited" Role on Roles list + When I start assigning to "Test Role edited" from Roles page + And I assign users to role + | path | + | Users/Administrator users/Administrator User | + And I assign groups to role + | path | + | Users/Editors | + | Users | + And I select "Media" from Sections as role assignment limitation + And I perform the "Cancel" action + Then I should be on "Test Role edited" Role page + And Policies list is empty + And Assignments list is empty -# @javascript -# Scenario: User can be assigned to role from the Roles list -# Given I am logged as admin -# And I open "Roles" page in admin SiteAccess -# And there's a "Test Role edited" Role on Roles list -# When I start assigning to "Test Role edited" from Roles page -# And I assign users to role -# | path | -# | Users/Anonymous users/Anonymous User | -# | Users/Administrator users/Administrator User | -# And I assign groups to role -# | path | -# | Users/Editors | -# And I select limitation "Media/Images" for assignment through UDW -# And I perform the "Save" action from the "Save and close" group -# Then I should be on "Test Role edited" Role page -# And Policies list is empty -# And there are assignments on the "Test Role edited" assignments list -# | User/Group | Limitation | -# | Administrator User | Subtree: /Media/Images | -# | Anonymous User | Subtree: /Media/Images | -# | Editors | Subtree: /Media/Images | + @javascript + Scenario: User can be assigned to role from the Roles list + Given I am logged as admin + And I open "Roles" page in admin SiteAccess + And there's a "Test Role edited" Role on Roles list + When I start assigning to "Test Role edited" from Roles page + And I assign users to role + | path | + | Users/Anonymous users/Anonymous User | + | Users/Administrator users/Administrator User | + And I assign groups to role + | path | + | Users/Editors | + And I select limitation "Media/Images" for assignment through UDW + And I perform the "Save" action from the "Save and close" group + Then I should be on "Test Role edited" Role page + And Policies list is empty + And there are assignments on the "Test Role edited" assignments list + | User/Group | Limitation | + | Administrator User | Subtree: /Media/Images | + | Anonymous User | Subtree: /Media/Images | + | Editors | Subtree: /Media/Images | -# @javascript -# Scenario: User can be assigned to role from the Role details view -# Given I am logged as admin -# And I open "Test Role edited" Role page in admin SiteAccess -# When I start assigning users and groups from Role page -# And I assign groups to role -# | path | -# | Users | -# And I perform the "Save" action from the "Save and close" group -# Then I should be on "Test Role edited" Role page -# And Policies list is empty -# And there are assignments on the "Test Role edited" assignments list -# | User/Group | Limitation | -# | Administrator User | Subtree: /Media/Images | -# | Editors | Subtree: /Media/Images | -# | Anonymous User | Subtree: /Media/Images | -# | Users | None | + @javascript + Scenario: User can be assigned to role from the Role details view + Given I am logged as admin + And I open "Test Role edited" Role page in admin SiteAccess + When I start assigning users and groups from Role page + And I assign groups to role + | path | + | Users | + And I perform the "Save" action from the "Save and close" group + Then I should be on "Test Role edited" Role page + And Policies list is empty + And there are assignments on the "Test Role edited" assignments list + | User/Group | Limitation | + | Administrator User | Subtree: /Media/Images | + | Editors | Subtree: /Media/Images | + | Anonymous User | Subtree: /Media/Images | + | Users | None | -# @javascript -# Scenario: Assignment can be deleted from role -# Given I am logged as admin -# And I open "Test Role edited" Role page in admin SiteAccess -# When I delete assignment from "Test Role edited" role -# | item | -# | Administrator User | -# | Editors | -# | Users | -# Then I should be on "Test Role edited" Role page -# And Policies list is empty -# And there are assignments on the "Test Role edited" assignments list -# | User/Group | Limitation | -# | Anonymous User | Subtree: /Media/Images | + @javascript + Scenario: Assignment can be deleted from role + Given I am logged as admin + And I open "Test Role edited" Role page in admin SiteAccess + When I delete assignment from "Test Role edited" role + | item | + | Administrator User | + | Editors | + | Users | + Then I should be on "Test Role edited" Role page + And Policies list is empty + And there are assignments on the "Test Role edited" assignments list + | User/Group | Limitation | + | Anonymous User | Subtree: /Media/Images | -# @javascript -# Scenario: Adding policy can be discarded -# Given I am logged as admin -# And I open "Test Role edited" Role page in admin SiteAccess -# When I start creating a new Policy -# And I select policy "Content Type / All functions" -# And I perform the "Discard changes" action -# Then I should be on "Test Role edited" Role page -# And Policies list is empty -# And there are assignments on the "Test Role edited" assignments list -# | User/Group | Limitation | -# | Anonymous User | Subtree: /Media/Images | + @javascript + Scenario: Adding policy can be discarded + Given I am logged as admin + And I open "Test Role edited" Role page in admin SiteAccess + When I start creating a new Policy + And I select policy "Content Type / All functions" + And I perform the "Discard changes" action + Then I should be on "Test Role edited" Role page + And Policies list is empty + And there are assignments on the "Test Role edited" assignments list + | User/Group | Limitation | + | Anonymous User | Subtree: /Media/Images | -# @javascript -# Scenario: Policies can be added to role -# Given I am logged as admin -# And I open "Test Role edited" Role page in admin SiteAccess -# When I start creating a new Policy -# And I select policy "Content / Read" -# And I perform the "Create" action -# And success notification that "Now you can set Limitations for the Policy." appears -# And I select limitation for "Content Type" -# | option | -# | File | -# And I perform the "Update" action -# Then I should be on "Test Role edited" Role page -# And there is a policy "Content/Read" with "Content Type: File" limitation on the "Test Role edited" policies list -# And there are assignments on the "Test Role edited" assignments list -# | User/Group | Limitation | -# | Anonymous User | Subtree: /Media/Images | + @javascript + Scenario: Policies can be added to role + Given I am logged as admin + And I open "Test Role edited" Role page in admin SiteAccess + When I start creating a new Policy + And I select policy "Content / Read" + And I perform the "Create" action + And success notification that "Now you can set Limitations for the Policy." appears + And I select limitation for "Content Type" + | option | + | File | + And I perform the "Update" action + Then I should be on "Test Role edited" Role page + And there is a policy "Content/Read" with "Content Type: File" limitation on the "Test Role edited" policies list + And there are assignments on the "Test Role edited" assignments list + | User/Group | Limitation | + | Anonymous User | Subtree: /Media/Images | -# @javascript -# Scenario: Policies without limitations can be added to role -# Given I am logged as admin -# And I open "Test Role edited" Role page in admin SiteAccess -# When I start creating a new Policy -# And I select policy "User / Password" -# And I perform the "Create" action -# Then I should be on "Test Role edited" Role page -# And there is a policy "User/Password" with "None" limitation on the "Test Role edited" policies list -# And there are assignments on the "Test Role edited" assignments list -# | User/Group | Limitation | -# | Anonymous User | Subtree: /Media/Images | + @javascript + Scenario: Policies without limitations can be added to role + Given I am logged as admin + And I open "Test Role edited" Role page in admin SiteAccess + When I start creating a new Policy + And I select policy "User / Password" + And I perform the "Create" action + Then I should be on "Test Role edited" Role page + And there is a policy "User/Password" with "None" limitation on the "Test Role edited" policies list + And there are assignments on the "Test Role edited" assignments list + | User/Group | Limitation | + | Anonymous User | Subtree: /Media/Images | -# @javascript -# Scenario: Policies can be edited -# Given I am logged as admin -# And I open "Test Role edited" Role page in admin SiteAccess -# When I start editing the policy "Content" "Read" -# And I select limitation for "Content Type" -# | option | -# | Article | -# | Folder | -# And I select subtree limitation "Users/Anonymous users" for policy through UDW -# And I select limitation for "State" -# | option | -# | Lock:Locked | -# And I perform the "Update" action -# Then I should be on "Test Role edited" Role page -# And there are policies on the "Test Role edited" policies list -# | policy | limitation | -# | Content/Read | Content Type: Article, Folder | -# | Content/Read | Subtree: /Users/Anonymous users | -# | Content/Read | State: Lock:Locked | -# And there are assignments on the "Test Role edited" assignments list -# | User/Group | Limitation | -# | Anonymous User | Subtree: /Media/Images | + @javascript + Scenario: Policies can be edited + Given I am logged as admin + And I open "Test Role edited" Role page in admin SiteAccess + When I start editing the policy "Content" "Read" + And I select limitation for "Content Type" + | option | + | Article | + | Folder | + And I select subtree limitation "Users/Anonymous users" for policy through UDW + And I select limitation for "State" + | option | + | Lock:Locked | + And I perform the "Update" action + Then I should be on "Test Role edited" Role page + And there are policies on the "Test Role edited" policies list + | policy | limitation | + | Content/Read | Content Type: Article, Folder | + | Content/Read | Subtree: /Users/Anonymous users | + | Content/Read | State: Lock:Locked | + And there are assignments on the "Test Role edited" assignments list + | User/Group | Limitation | + | Anonymous User | Subtree: /Media/Images | -# @javascript -# Scenario: Policy can be deleted -# Given I am logged as admin -# And I open "Test Role edited" Role page in admin SiteAccess -# When I delete policy from "Test Role edited" role -# | item | -# | Content | -# Then success notification that "Removed Policies from Role 'Test Role edited'." appears -# And there is no policy "Content/Read" with "Content Type: File" limitation on the "Test Role edited" policies list -# And there are assignments on the "Test Role edited" assignments list -# | User/Group | Limitation | -# | Anonymous User | Subtree: /Media/Images | + @javascript + Scenario: Policy can be deleted + Given I am logged as admin + And I open "Test Role edited" Role page in admin SiteAccess + When I delete policy from "Test Role edited" role + | item | + | Content | + Then success notification that "Removed Policies from Role 'Test Role edited'." appears + And there is no policy "Content/Read" with "Content Type: File" limitation on the "Test Role edited" policies list + And there are assignments on the "Test Role edited" assignments list + | User/Group | Limitation | + | Anonymous User | Subtree: /Media/Images | -# @javascript -# Scenario: Role can be deleted -# Given I am logged as admin -# And I open "Roles" page in admin SiteAccess -# And there's a "Test Role edited" Role on Roles list -# When I delete Role "Test Role edited" -# Then notification that "Role" "Test Role edited" is removed appears -# And there's no "Test Role edited" Role on Roles list + @javascript + Scenario: Role can be deleted + Given I am logged as admin + And I open "Roles" page in admin SiteAccess + And there's a "Test Role edited" Role on Roles list + When I delete Role "Test Role edited" + Then notification that "Role" "Test Role edited" is removed appears + And there's no "Test Role edited" Role on Roles list -# @javascript -# Scenario: I can access role that has limitation to deleted location -# Given I am using the API as "admin" -# And I create "folder" Content items in root in "eng-GB" -# | name | short_name | -# | DeletedLocation | DeletedLocation | -# And I create a role "DeletedLocationRole" -# And I add policy "content" "read" to "DeletedLocationRole" with limitations -# | limitationType | limitationValue | -# | Location | /DeletedLocation | -# And I send "/DeletedLocation" to the Trash -# When I am logged as admin -# And I open "DeletedLocationRole" Role page in admin SiteAccess -# Then I should be on "DeletedLocationRole" Role page + @javascript + Scenario: I can access role that has limitation to deleted location + Given I am using the API as "admin" + And I create "folder" Content items in root in "eng-GB" + | name | short_name | + | DeletedLocation | DeletedLocation | + And I create a role "DeletedLocationRole" + And I add policy "content" "read" to "DeletedLocationRole" with limitations + | limitationType | limitationValue | + | Location | /DeletedLocation | + And I send "/DeletedLocation" to the Trash + When I am logged as admin + And I open "DeletedLocationRole" Role page in admin SiteAccess + Then I should be on "DeletedLocationRole" Role page From c190332041714ca571409686d46d517d82a8e44c Mon Sep 17 00:00:00 2001 From: tischsoic Date: Wed, 20 Sep 2023 12:47:19 +0200 Subject: [PATCH 28/40] after CR --- src/bundle/Controller/ContentTypeGroupController.php | 4 ++-- src/bundle/Controller/LanguageController.php | 4 ++-- src/bundle/Controller/LinkManagerController.php | 2 +- src/bundle/Controller/ObjectStateController.php | 4 ++-- src/bundle/Controller/ObjectStateGroupController.php | 4 ++-- src/bundle/Controller/PolicyController.php | 2 +- src/bundle/Controller/RoleController.php | 4 ++-- src/bundle/Controller/URLWildcardController.php | 4 ++-- src/bundle/ParamConverter/ContentTypeDraftParamConverter.php | 5 ----- src/lib/Form/Processor/ContentEditFormProcessor.php | 2 +- src/lib/Menu/ContentEditRightSidebarBuilder.php | 2 +- 11 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/bundle/Controller/ContentTypeGroupController.php b/src/bundle/Controller/ContentTypeGroupController.php index e773fe7504..15f8e789a3 100644 --- a/src/bundle/Controller/ContentTypeGroupController.php +++ b/src/bundle/Controller/ContentTypeGroupController.php @@ -118,7 +118,7 @@ public function createAction(Request $request): Response $form->handleRequest($request); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (ContentTypeGroupCreateData $data) use ($form) { + $result = $this->submitHandler->handle($form, function (ContentTypeGroupCreateData $data) use ($form): Response { $createStruct = $this->contentTypeService->newContentTypeGroupCreateStruct( $data->getIdentifier() ); @@ -170,7 +170,7 @@ public function updateAction(Request $request, ContentTypeGroup $group): Respons $form->handleRequest($request); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (ContentTypeGroupUpdateData $data) use ($form) { + $result = $this->submitHandler->handle($form, function (ContentTypeGroupUpdateData $data) use ($form): Response { $group = $data->getContentTypeGroup(); $updateStruct = $this->contentTypeService->newContentTypeGroupUpdateStruct(); $updateStruct->identifier = $data->getIdentifier(); diff --git a/src/bundle/Controller/LanguageController.php b/src/bundle/Controller/LanguageController.php index e424da9b18..0cae768776 100644 --- a/src/bundle/Controller/LanguageController.php +++ b/src/bundle/Controller/LanguageController.php @@ -204,7 +204,7 @@ public function createAction(Request $request): Response $form->handleRequest($request); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (LanguageCreateData $data) use ($form) { + $result = $this->submitHandler->handle($form, function (LanguageCreateData $data) use ($form): Response { $languageCreateStruct = $this->languageCreateMapper->reverseMap($data); $language = $this->languageService->createLanguage($languageCreateStruct); @@ -248,7 +248,7 @@ public function editAction(Request $request, Language $language): Response $form->handleRequest($request); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (LanguageUpdateData $data) use ($language, $form) { + $result = $this->submitHandler->handle($form, function (LanguageUpdateData $data) use ($language, $form): Response { $this->languageService->updateLanguageName($language, $data->getName()); $data->isEnabled() diff --git a/src/bundle/Controller/LinkManagerController.php b/src/bundle/Controller/LinkManagerController.php index e59b8031d5..e549df6b47 100644 --- a/src/bundle/Controller/LinkManagerController.php +++ b/src/bundle/Controller/LinkManagerController.php @@ -78,7 +78,7 @@ public function editAction(Request $request, int $urlId): Response $form->handleRequest($request); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (URLUpdateData $data) use ($url, $form) { + $result = $this->submitHandler->handle($form, function (URLUpdateData $data) use ($url, $form): Response { $this->urlService->updateUrl($url, $data); $this->notificationHandler->success( /** @Desc("URL updated") */ diff --git a/src/bundle/Controller/ObjectStateController.php b/src/bundle/Controller/ObjectStateController.php index aab0572555..a44d7217b8 100644 --- a/src/bundle/Controller/ObjectStateController.php +++ b/src/bundle/Controller/ObjectStateController.php @@ -142,7 +142,7 @@ public function addAction(Request $request, ObjectStateGroup $objectStateGroup): if ($form->isSubmitted()) { $result = $this->submitHandler->handle( $form, - function (ObjectStateCreateData $data) use ($defaultLanguageCode, $objectStateGroup, $form) { + function (ObjectStateCreateData $data) use ($defaultLanguageCode, $objectStateGroup, $form): Response { $createStruct = $this->objectStateService->newObjectStateCreateStruct( $data->getIdentifier() ); @@ -278,7 +278,7 @@ public function updateAction(Request $request, ObjectState $objectState): Respon $form->handleRequest($request); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (ObjectStateUpdateData $data) use ($form) { + $result = $this->submitHandler->handle($form, function (ObjectStateUpdateData $data) use ($form): Response { $objectState = $data->getObjectState(); $updateStruct = $this->objectStateService->newObjectStateUpdateStruct(); $updateStruct->identifier = $data->getIdentifier(); diff --git a/src/bundle/Controller/ObjectStateGroupController.php b/src/bundle/Controller/ObjectStateGroupController.php index fe80ab0ebc..c2c8cc8db5 100644 --- a/src/bundle/Controller/ObjectStateGroupController.php +++ b/src/bundle/Controller/ObjectStateGroupController.php @@ -121,7 +121,7 @@ public function addAction(Request $request): Response if ($form->isSubmitted()) { $result = $this->submitHandler->handle( $form, - function (ObjectStateGroupCreateData $data) use ($defaultLanguageCode, $form) { + function (ObjectStateGroupCreateData $data) use ($defaultLanguageCode, $form): Response { $createStruct = $this->objectStateService->newObjectStateGroupCreateStruct( $data->getIdentifier() ); @@ -249,7 +249,7 @@ public function updateAction(Request $request, ObjectStateGroup $group): Respons $form->handleRequest($request); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (ObjectStateGroupUpdateData $data) use ($form) { + $result = $this->submitHandler->handle($form, function (ObjectStateGroupUpdateData $data) use ($form): Response { $group = $data->getObjectStateGroup(); $updateStruct = $this->objectStateService->newObjectStateGroupUpdateStruct(); $updateStruct->identifier = $data->getIdentifier(); diff --git a/src/bundle/Controller/PolicyController.php b/src/bundle/Controller/PolicyController.php index fe028b4507..cf0eb5f72f 100644 --- a/src/bundle/Controller/PolicyController.php +++ b/src/bundle/Controller/PolicyController.php @@ -238,7 +238,7 @@ public function updateAction(Request $request, Role $role, Policy $policy): Resp $form->handleRequest($request); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (PolicyUpdateData $data) use ($role, $policy, $form) { + $result = $this->submitHandler->handle($form, function (PolicyUpdateData $data) use ($role, $policy, $form): Response { $policyUpdateStruct = $this->policyUpdateMapper->reverseMap($data); $roleDraft = $this->roleService->createRoleDraft($role); diff --git a/src/bundle/Controller/RoleController.php b/src/bundle/Controller/RoleController.php index 93533872de..f0d6d4e9d7 100644 --- a/src/bundle/Controller/RoleController.php +++ b/src/bundle/Controller/RoleController.php @@ -141,7 +141,7 @@ public function createAction(Request $request): Response $form->handleRequest($request); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (RoleCreateData $data) use ($form) { + $result = $this->submitHandler->handle($form, function (RoleCreateData $data) use ($form): Response { $roleCreateStruct = $this->roleCreateMapper->reverseMap($data); $roleDraft = $this->roleService->createRole($roleCreateStruct); $this->roleService->publishRoleDraft($roleDraft); @@ -227,7 +227,7 @@ public function updateAction(Request $request, Role $role): Response $form->handleRequest($request); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (RoleUpdateData $data) use ($form) { + $result = $this->submitHandler->handle($form, function (RoleUpdateData $data) use ($form): Response { /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role $role */ $role = $data->getRole(); diff --git a/src/bundle/Controller/URLWildcardController.php b/src/bundle/Controller/URLWildcardController.php index 18d1979cbf..aa4686ad28 100644 --- a/src/bundle/Controller/URLWildcardController.php +++ b/src/bundle/Controller/URLWildcardController.php @@ -64,7 +64,7 @@ public function addAction(Request $request): Response $form->handleRequest($request); if ($form->isSubmitted()) { - $this->submitHandler->handle($form, function (URLWildcardData $data) use ($form) { + $this->submitHandler->handle($form, function (URLWildcardData $data) use ($form): Response { $urlWildcard = $this->urlWildcardService->create( $data->getSourceURL(), $data->getDestinationUrl(), @@ -111,7 +111,7 @@ public function updateAction(URLWildcard $urlWildcard, Request $request): Respon if ($form->isSubmitted()) { $result = $this->submitHandler->handle( $form, - function (URLWildcardUpdateData $data) use ($urlWildcard, $form) { + function (URLWildcardUpdateData $data) use ($urlWildcard, $form): Response { $urlWildcardUpdateStruct = new URLWildcardUpdateStruct(); $urlWildcardUpdateStruct->destinationUrl = $data->getDestinationUrl(); $urlWildcardUpdateStruct->sourceUrl = $data->getSourceURL(); diff --git a/src/bundle/ParamConverter/ContentTypeDraftParamConverter.php b/src/bundle/ParamConverter/ContentTypeDraftParamConverter.php index a98efdf1a4..97112a65de 100644 --- a/src/bundle/ParamConverter/ContentTypeDraftParamConverter.php +++ b/src/bundle/ParamConverter/ContentTypeDraftParamConverter.php @@ -19,11 +19,6 @@ class ContentTypeDraftParamConverter implements ParamConverterInterface /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ private $contentTypeService; - /** - * ContentTypeDraftParamConverter constructor. - * - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeGroupService - */ public function __construct(ContentTypeService $contentTypeGroupService) { $this->contentTypeService = $contentTypeGroupService; diff --git a/src/lib/Form/Processor/ContentEditFormProcessor.php b/src/lib/Form/Processor/ContentEditFormProcessor.php index eb42344988..47048e0822 100644 --- a/src/lib/Form/Processor/ContentEditFormProcessor.php +++ b/src/lib/Form/Processor/ContentEditFormProcessor.php @@ -14,7 +14,7 @@ use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\Routing\RouterInterface; -class ContentEditFormProcessor implements EventSubscriberInterface +final class ContentEditFormProcessor implements EventSubscriberInterface { private RouterInterface $router; diff --git a/src/lib/Menu/ContentEditRightSidebarBuilder.php b/src/lib/Menu/ContentEditRightSidebarBuilder.php index 27444cd239..a074c4308e 100644 --- a/src/lib/Menu/ContentEditRightSidebarBuilder.php +++ b/src/lib/Menu/ContentEditRightSidebarBuilder.php @@ -153,7 +153,7 @@ public function createStructure(array $options): ItemInterface ? $saveDraftAttributes : array_merge($saveDraftAttributes, self::BTN_DISABLED_ATTR), 'extras' => [ - 'orderNumber' => 80, + 'orderNumber' => 10, ], ] ); From 1ed6c877cb6d2f3b8de3c8046a5d03006de4a4ce Mon Sep 17 00:00:00 2001 From: tischsoic Date: Wed, 20 Sep 2023 14:04:25 +0200 Subject: [PATCH 29/40] after CR 2 --- src/bundle/Controller/URLWildcardController.php | 5 +++++ src/lib/Form/Processor/ContentEditFormProcessor.php | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/bundle/Controller/URLWildcardController.php b/src/bundle/Controller/URLWildcardController.php index aa4686ad28..ac2d26ff37 100644 --- a/src/bundle/Controller/URLWildcardController.php +++ b/src/bundle/Controller/URLWildcardController.php @@ -22,6 +22,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\URLWildcardUpdateStruct; use JMS\TranslationBundle\Annotation\Desc; use Symfony\Component\Form\Button; +use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -85,6 +86,10 @@ public function addAction(Request $request): Response 'urlWildcardId' => $urlWildcard->id, ]); } + + return $this->redirect($this->generateUrl('ibexa.url_management', [ + '_fragment' => URLWildcardsTab::URI_FRAGMENT, + ])); }); } diff --git a/src/lib/Form/Processor/ContentEditFormProcessor.php b/src/lib/Form/Processor/ContentEditFormProcessor.php index 47048e0822..9ac1020a54 100644 --- a/src/lib/Form/Processor/ContentEditFormProcessor.php +++ b/src/lib/Form/Processor/ContentEditFormProcessor.php @@ -24,9 +24,6 @@ public function __construct( $this->router = $router; } - /** - * {@inheritdoc} - */ public static function getSubscribedEvents(): array { return [ From b6a3423a818f2109b1e5b3511cc957dcbc4df39a Mon Sep 17 00:00:00 2001 From: tischsoic Date: Wed, 20 Sep 2023 14:11:41 +0200 Subject: [PATCH 30/40] drop ezplatform. from new lang keys --- .../Resources/translations/forms.en.xliff | 30 +++++++++---------- .../Form/Type/Language/LanguageCreateType.php | 4 +-- .../Form/Type/Language/LanguageUpdateType.php | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/bundle/Resources/translations/forms.en.xliff b/src/bundle/Resources/translations/forms.en.xliff index 26e5ea7651..4dec48ca8d 100644 --- a/src/bundle/Resources/translations/forms.en.xliff +++ b/src/bundle/Resources/translations/forms.en.xliff @@ -71,16 +71,6 @@ Name key: ezplatform.language.create.name - - Save - Save - key: ezplatform.language.create.save - - - Save and close - Save and close - key: ezplatform.language.create.save_and_close - Delete Delete @@ -101,11 +91,6 @@ Save key: ezplatform.language.update.save - - Save and close - Save and close - key: ezplatform.language.update.save_and_close - Sub-items Sub-items @@ -126,6 +111,21 @@ Asset Fields(s) key: form.trash_assets_non_unique.label + + Save + Save + key: language.create.save + + + Save and close + Save and close + key: language.create.save_and_close + + + Save and close + Save and close + key: language.update.save_and_close + Delete languages Delete languages diff --git a/src/lib/Form/Type/Language/LanguageCreateType.php b/src/lib/Form/Type/Language/LanguageCreateType.php index e558ad40d0..3e7b60f7b7 100644 --- a/src/lib/Form/Type/Language/LanguageCreateType.php +++ b/src/lib/Form/Type/Language/LanguageCreateType.php @@ -42,12 +42,12 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add( self::BTN_SAVE, SubmitType::class, - ['label' => /** @Desc("Save") */ 'ezplatform.language.create.save'] + ['label' => /** @Desc("Save") */ 'language.create.save'] ) ->add( 'save_and_close', SubmitType::class, - ['label' => /** @Desc("Save and close") */ 'ezplatform.language.create.save_and_close'] + ['label' => /** @Desc("Save and close") */ 'language.create.save_and_close'] ); } diff --git a/src/lib/Form/Type/Language/LanguageUpdateType.php b/src/lib/Form/Type/Language/LanguageUpdateType.php index b016298240..e0ef265bd4 100644 --- a/src/lib/Form/Type/Language/LanguageUpdateType.php +++ b/src/lib/Form/Type/Language/LanguageUpdateType.php @@ -47,7 +47,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add( 'save_and_close', SubmitType::class, - ['label' => /** @Desc("Save and close") */ 'ezplatform.language.update.save_and_close'] + ['label' => /** @Desc("Save and close") */ 'language.update.save_and_close'] ); } From b9a052892d6c0b20f0fe95bf8e60e0dcfa1aedcf Mon Sep 17 00:00:00 2001 From: tischsoic Date: Wed, 20 Sep 2023 14:39:33 +0200 Subject: [PATCH 31/40] fix-cs --- src/bundle/Controller/URLWildcardController.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/bundle/Controller/URLWildcardController.php b/src/bundle/Controller/URLWildcardController.php index ac2d26ff37..97704886e1 100644 --- a/src/bundle/Controller/URLWildcardController.php +++ b/src/bundle/Controller/URLWildcardController.php @@ -22,7 +22,6 @@ use Ibexa\Contracts\Core\Repository\Values\Content\URLWildcardUpdateStruct; use JMS\TranslationBundle\Annotation\Desc; use Symfony\Component\Form\Button; -use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; From d0f62c8c5e7a49a284f7b06a98d65be8ca73360c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Thu, 21 Sep 2023 15:59:49 +0200 Subject: [PATCH 32/40] Roles fixes --- features/standard/Roles.feature | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/features/standard/Roles.feature b/features/standard/Roles.feature index fc27c5f7b4..2389b2a5cd 100644 --- a/features/standard/Roles.feature +++ b/features/standard/Roles.feature @@ -12,7 +12,7 @@ Feature: Roles management And I set fields | label | value | | Name | Test Role | - And I perform the "Discard changes" action + And I perform the "Discard" action Then I should be on "Roles" page And there's no "Test Role" Role on Roles list @@ -24,7 +24,7 @@ Feature: Roles management And I set fields | label | value | | Name | Test Role | - And I perform the "Create" action + And I perform the "Save and close" action Then I should be on "Test Role" Role page And Policies list is empty And Assignments list is empty @@ -38,7 +38,7 @@ Feature: Roles management And I set fields | label | value | | Name | Test Role edited | - And I perform the "Discard changes" action + And I perform the "Discard" action Then I should be on "Roles" page And there's a "Test Role" Role on Roles list And there's no "Test Role edited" Role on Roles list @@ -52,7 +52,7 @@ Feature: Roles management And I set fields | label | value | | Name | Test Role edited | - And I perform the "Save" action from the "Save and close" group + And I perform the "Save and close" action Then I should be on "Test Role edited" Role page And Policies list is empty And Assignments list is empty @@ -71,7 +71,7 @@ Feature: Roles management | Users/Editors | | Users | And I select "Media" from Sections as role assignment limitation - And I perform the "Cancel" action + And I perform the "Discard" action Then I should be on "Test Role edited" Role page And Policies list is empty And Assignments list is empty @@ -90,7 +90,7 @@ Feature: Roles management | path | | Users/Editors | And I select limitation "Media/Images" for assignment through UDW - And I perform the "Save" action from the "Save and close" group + And I perform the "Save and close" action Then I should be on "Test Role edited" Role page And Policies list is empty And there are assignments on the "Test Role edited" assignments list @@ -107,7 +107,7 @@ Feature: Roles management And I assign groups to role | path | | Users | - And I perform the "Save" action from the "Save and close" group + And I perform the "Save and close" action Then I should be on "Test Role edited" Role page And Policies list is empty And there are assignments on the "Test Role edited" assignments list @@ -138,7 +138,7 @@ Feature: Roles management And I open "Test Role edited" Role page in admin SiteAccess When I start creating a new Policy And I select policy "Content Type / All functions" - And I perform the "Discard changes" action + And I perform the "Discard" action Then I should be on "Test Role edited" Role page And Policies list is empty And there are assignments on the "Test Role edited" assignments list @@ -156,7 +156,7 @@ Feature: Roles management And I select limitation for "Content Type" | option | | File | - And I perform the "Update" action + And I perform the "Save and close" action Then I should be on "Test Role edited" Role page And there is a policy "Content/Read" with "Content Type: File" limitation on the "Test Role edited" policies list And there are assignments on the "Test Role edited" assignments list @@ -169,7 +169,7 @@ Feature: Roles management And I open "Test Role edited" Role page in admin SiteAccess When I start creating a new Policy And I select policy "User / Password" - And I perform the "Create" action + And I perform the "Save and close" action Then I should be on "Test Role edited" Role page And there is a policy "User/Password" with "None" limitation on the "Test Role edited" policies list And there are assignments on the "Test Role edited" assignments list @@ -189,7 +189,7 @@ Feature: Roles management And I select limitation for "State" | option | | Lock:Locked | - And I perform the "Update" action + And I perform the "Save and close" action Then I should be on "Test Role edited" Role page And there are policies on the "Test Role edited" policies list | policy | limitation | From e2056b1294b833dfacc37350956758e9edb58d33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Thu, 21 Sep 2023 21:25:20 +0200 Subject: [PATCH 33/40] Fixes for Roles --- features/standard/Roles.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/standard/Roles.feature b/features/standard/Roles.feature index 2389b2a5cd..8eebdc3678 100644 --- a/features/standard/Roles.feature +++ b/features/standard/Roles.feature @@ -38,7 +38,7 @@ Feature: Roles management And I set fields | label | value | | Name | Test Role edited | - And I perform the "Discard" action + And I perform the "Discard changes" action Then I should be on "Roles" page And there's a "Test Role" Role on Roles list And there's no "Test Role edited" Role on Roles list @@ -151,7 +151,7 @@ Feature: Roles management And I open "Test Role edited" Role page in admin SiteAccess When I start creating a new Policy And I select policy "Content / Read" - And I perform the "Create" action + And I perform the "Save and close" action And success notification that "Now you can set Limitations for the Policy." appears And I select limitation for "Content Type" | option | From 0ee292207dbe0fbc009eb992decefbed4b203217 Mon Sep 17 00:00:00 2001 From: tischsoic Date: Mon, 25 Sep 2023 15:05:16 +0200 Subject: [PATCH 34/40] fix context menu --- .../Resources/public/js/scripts/admin.context.menu.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/bundle/Resources/public/js/scripts/admin.context.menu.js b/src/bundle/Resources/public/js/scripts/admin.context.menu.js index 10d7279e47..1e7fbf2986 100644 --- a/src/bundle/Resources/public/js/scripts/admin.context.menu.js +++ b/src/bundle/Resources/public/js/scripts/admin.context.menu.js @@ -79,11 +79,7 @@ return { label: alternativeToggleLabel ?? mainBtnLabel, - onClick: () => clickRelatedBtn(relatedMainBtnId), processAfterCreated: (itemElement) => { - const itemBtn = itemElement.querySelector('.ibexa-multilevel-popup-menu__item-content'); - - itemBtn.disabled = mainBtn.disabled; addRelatedBtnIdToMenuItem(itemElement, relatedMainBtnId); }, branch: { @@ -94,6 +90,13 @@ { label: mainBtnAlternativeLabel ?? mainBtnLabel, sublabel: mainBtnAlternativeSublabel, + onClick: () => clickRelatedBtn(relatedMainBtnId), + processAfterCreated: (itemElement) => { + const itemBtn = itemElement.querySelector('.ibexa-multilevel-popup-menu__item-content'); + + itemBtn.disabled = mainBtn.disabled; + addRelatedBtnIdToMenuItem(itemElement, relatedMainBtnId); + }, }, ], }, From c29f9178701d78eb94f65108da541c249feb41cc Mon Sep 17 00:00:00 2001 From: tischsoic Date: Mon, 25 Sep 2023 15:27:04 +0200 Subject: [PATCH 35/40] fix visible publishAndEdit and saveDraftAndClose buttons in COTF --- .../admin/ui/on_the_fly/content_edit_on_the_fly.html.twig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bundle/Resources/views/themes/admin/ui/on_the_fly/content_edit_on_the_fly.html.twig b/src/bundle/Resources/views/themes/admin/ui/on_the_fly/content_edit_on_the_fly.html.twig index 95ab02032d..c4a9a79393 100644 --- a/src/bundle/Resources/views/themes/admin/ui/on_the_fly/content_edit_on_the_fly.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/on_the_fly/content_edit_on_the_fly.html.twig @@ -3,6 +3,8 @@ {% block form_fields %} {{ parent() }} {{ form_widget(form.publish, {'attr': {'hidden': 'hidden', 'data-action': 'publish'}}) }} + {% if form.publishAndEdit is defined %}{{ form_widget(form.publishAndEdit, { attr: { hidden: 'hidden' }}) }}{% endif %} {% if form.saveDraft is defined %}{{ form_widget(form.saveDraft, {'attr': {'hidden': 'hidden'}}) }}{% endif %} + {% if form.saveDraftAndClose is defined %}{{ form_widget(form.saveDraftAndClose, { attr: { hidden: 'hidden' }}) }}{% endif %} {% if form.cancel is defined %}{{ form_widget(form.cancel, {'attr': {'hidden': 'hidden'}}) }}{% endif %} {% endblock %} From 5635e58deddd97b5260549d9be70c9e5f42e67c4 Mon Sep 17 00:00:00 2001 From: tischsoic Date: Tue, 26 Sep 2023 10:24:20 +0200 Subject: [PATCH 36/40] Add save and close button in create view context menu --- .../Menu/ContentCreateRightSidebarBuilder.php | 45 ++++++++++++++----- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/src/lib/Menu/ContentCreateRightSidebarBuilder.php b/src/lib/Menu/ContentCreateRightSidebarBuilder.php index 2db2e82eeb..11c858631c 100644 --- a/src/lib/Menu/ContentCreateRightSidebarBuilder.php +++ b/src/lib/Menu/ContentCreateRightSidebarBuilder.php @@ -32,6 +32,7 @@ class ContentCreateRightSidebarBuilder extends AbstractBuilder implements Transl /* Menu items */ public const ITEM__PUBLISH = 'content_create__sidebar_right__publish'; public const ITEM__SAVE_DRAFT = 'content_create__sidebar_right__save_draft'; + public const ITEM__SAVE_DRAFT_AND_CLOSE = 'content_edit__sidebar_right__save_draft_and_close'; public const ITEM__PREVIEW = 'content_create__sidebar_right__preview'; public const ITEM__CANCEL = 'content_create__sidebar_right__cancel'; @@ -108,10 +109,14 @@ public function createStructure(array $options): ItemInterface 'class' => self::BTN_TRIGGER_CLASS, 'data-click' => '#ezplatform_content_forms_content_edit_publish', ]; - $createAttributes = [ + $saveDraftAttributes = [ 'class' => self::BTN_TRIGGER_CLASS, 'data-click' => '#ezplatform_content_forms_content_edit_saveDraft', ]; + $saveDraftAndCloseAttributes = [ + 'class' => self::BTN_TRIGGER_CLASS, + 'data-click' => '#ezplatform_content_forms_content_edit_saveDraftAndClose', + ]; $previewAttributes = [ 'class' => self::BTN_TRIGGER_CLASS, 'data-click' => '#ezplatform_content_forms_content_edit_preview', @@ -129,17 +134,6 @@ public function createStructure(array $options): ItemInterface ], ] ), - self::ITEM__SAVE_DRAFT => $this->createMenuItem( - self::ITEM__SAVE_DRAFT, - [ - 'attributes' => $canCreate - ? $createAttributes - : array_merge($createAttributes, self::BTN_DISABLED_ATTR), - 'extras' => [ - 'orderNumber' => 50, - ], - ] - ), self::ITEM__PREVIEW => $this->createMenuItem( self::ITEM__PREVIEW, [ @@ -165,6 +159,32 @@ public function createStructure(array $options): ItemInterface ), ]); + $saveDraftAndCloseItem = $this->createMenuItem( + self::ITEM__SAVE_DRAFT_AND_CLOSE, + [ + 'attributes' => $canCreate + ? $saveDraftAndCloseAttributes + : array_merge($saveDraftAndCloseAttributes, self::BTN_DISABLED_ATTR), + 'extras' => [ + 'orderNumber' => 80, + ], + ] + ); + + $saveDraftAndCloseItem->addChild( + self::ITEM__SAVE_DRAFT, + [ + 'attributes' => $canCreate + ? $saveDraftAttributes + : array_merge($saveDraftAttributes, self::BTN_DISABLED_ATTR), + 'extras' => [ + 'orderNumber' => 10, + ], + ] + ); + + $menu->addChild($saveDraftAndCloseItem); + return $menu; } @@ -176,6 +196,7 @@ public static function getTranslationMessages(): array return [ (new Message(self::ITEM__PUBLISH, 'ibexa_menu'))->setDesc('Publish'), (new Message(self::ITEM__SAVE_DRAFT, 'ibexa_menu'))->setDesc('Save'), + (new Message(self::ITEM__SAVE_DRAFT_AND_CLOSE, 'ibexa_menu'))->setDesc('Save and close'), (new Message(self::ITEM__PREVIEW, 'ibexa_menu'))->setDesc('Preview'), (new Message(self::ITEM__CANCEL, 'ibexa_menu'))->setDesc('Cancel'), ]; From a547cb83a334e27248012793920d464c444740c6 Mon Sep 17 00:00:00 2001 From: tischsoic Date: Tue, 26 Sep 2023 10:28:41 +0200 Subject: [PATCH 37/40] fix translations --- src/bundle/Resources/translations/ibexa_menu.en.xliff | 5 +++++ src/lib/Menu/ContentCreateRightSidebarBuilder.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bundle/Resources/translations/ibexa_menu.en.xliff b/src/bundle/Resources/translations/ibexa_menu.en.xliff index 2c0b3f6c32..82ce573afd 100644 --- a/src/bundle/Resources/translations/ibexa_menu.en.xliff +++ b/src/bundle/Resources/translations/ibexa_menu.en.xliff @@ -76,6 +76,11 @@ Save key: content_create__sidebar_right__save_draft + + Save and close + Save and close + key: content_create__sidebar_right__save_draft_and_close + Content Content diff --git a/src/lib/Menu/ContentCreateRightSidebarBuilder.php b/src/lib/Menu/ContentCreateRightSidebarBuilder.php index 11c858631c..1d7b457290 100644 --- a/src/lib/Menu/ContentCreateRightSidebarBuilder.php +++ b/src/lib/Menu/ContentCreateRightSidebarBuilder.php @@ -32,7 +32,7 @@ class ContentCreateRightSidebarBuilder extends AbstractBuilder implements Transl /* Menu items */ public const ITEM__PUBLISH = 'content_create__sidebar_right__publish'; public const ITEM__SAVE_DRAFT = 'content_create__sidebar_right__save_draft'; - public const ITEM__SAVE_DRAFT_AND_CLOSE = 'content_edit__sidebar_right__save_draft_and_close'; + public const ITEM__SAVE_DRAFT_AND_CLOSE = 'content_create__sidebar_right__save_draft_and_close'; public const ITEM__PREVIEW = 'content_create__sidebar_right__preview'; public const ITEM__CANCEL = 'content_create__sidebar_right__cancel'; From 6ec0301bf60888e9c0d33f9705d10b2631f4a337 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Tue, 26 Sep 2023 10:35:21 +0200 Subject: [PATCH 38/40] [Behat] Added Autosave create Scenario --- features/standard/Autosave.feature | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/features/standard/Autosave.feature b/features/standard/Autosave.feature index bdbb04aab3..2b337c62a8 100644 --- a/features/standard/Autosave.feature +++ b/features/standard/Autosave.feature @@ -48,3 +48,17 @@ Feature: Content Items creation And I check if "Autosave is off" notification is displayed And I open the "Dashboard" page in admin SiteAccess Then there's no draft "Test Article Autosave Off draft" on Dashboard list + + @javascript + Scenario: Content item can be created when autosave is off + Given I open Login page in admin SiteAccess + And I log in as "AutosaveDisabledTestUser" with password "Passw0rd-42" + And I'm on Content view Page for root + When I start creating a new content "Article" + And I set content fields + | label | value | + | Title | TestAutosaveCreate | + | Short title | TestAutosaveCreate | + And I perform the "Save and close" action + Then success notification that "Content published." appears + And I should be on Content view Page for "TestAutosaveCreate" From aef4871d40056b4c9083c63a031f93fabfcd0004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Tue, 26 Sep 2023 13:34:21 +0200 Subject: [PATCH 39/40] Fixed executed action --- features/standard/Autosave.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/standard/Autosave.feature b/features/standard/Autosave.feature index 2b337c62a8..ed70026964 100644 --- a/features/standard/Autosave.feature +++ b/features/standard/Autosave.feature @@ -59,6 +59,6 @@ Feature: Content Items creation | label | value | | Title | TestAutosaveCreate | | Short title | TestAutosaveCreate | - And I perform the "Save and close" action + And I perform the "Publish" action Then success notification that "Content published." appears And I should be on Content view Page for "TestAutosaveCreate" From 94f914b0453b53108c27bccde8e25c461ad0c0b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Tue, 26 Sep 2023 15:28:28 +0200 Subject: [PATCH 40/40] Fixed fields --- features/standard/Autosave.feature | 1 + 1 file changed, 1 insertion(+) diff --git a/features/standard/Autosave.feature b/features/standard/Autosave.feature index ed70026964..7375e9f890 100644 --- a/features/standard/Autosave.feature +++ b/features/standard/Autosave.feature @@ -59,6 +59,7 @@ Feature: Content Items creation | label | value | | Title | TestAutosaveCreate | | Short title | TestAutosaveCreate | + | Intro | TestAutosaveCreate | And I perform the "Publish" action Then success notification that "Content published." appears And I should be on Content view Page for "TestAutosaveCreate"