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..7375e9f890 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 @@ -39,7 +38,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 And I'm on Content view Page for root When I start creating a new content "Article" And I set content fields @@ -47,6 +46,20 @@ 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 + + @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 | + | 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" diff --git a/features/standard/ContentDraft.feature b/features/standard/ContentDraft.feature index edd2c2cb4b..5b70608e53 100644 --- a/features/standard/ContentDraft.feature +++ b/features/standard/ContentDraft.feature @@ -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" @@ -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 @@ -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..eec74fafe3 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 "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 click on the edit action bar button "Create" + 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 click on the edit action bar button "Cancel" + 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 @@ -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 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 77db711c55..cd0c170eb7 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" 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 "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 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 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/features/standard/Languages.feature b/features/standard/Languages.feature index 55a4bc1105..e22e51d3db 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 "Discard" 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 "Save and close" 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 "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 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 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 click on the edit action bar button "Save" + 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/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..7e354491b0 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 click on the edit action bar button "Discard changes" + 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 click on the edit action bar button "Create" + 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 @@ -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 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 @@ -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 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 @@ -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 "Save and close" 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 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 @@ -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 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 @@ -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 "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/Roles.feature b/features/standard/Roles.feature index 9433428b94..8eebdc3678 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" 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 "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 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 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 click on the edit action bar button "Cancel" + 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 click on the edit action bar button "Save" + 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 click on the edit action bar button "Save" + 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 click on the edit action bar button "Discard changes" + 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 @@ -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 "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 | | File | - And I click on the edit action bar button "Update" + 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 click on the edit action bar button "Create" + 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 click on the edit action bar button "Update" + 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 | diff --git a/features/standard/Sections.feature b/features/standard/Sections.feature index 32b931536d..84e5e9c7ac 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" 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 "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 @@ -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 and close" action 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 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 click on the edit action bar button "Create" + 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 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/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/ContentTypeGroupController.php b/src/bundle/Controller/ContentTypeGroupController.php index 1a9c40614c..15f8e789a3 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; @@ -109,13 +111,14 @@ 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() ); $form->handleRequest($request); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (ContentTypeGroupCreateData $data) { + $result = $this->submitHandler->handle($form, function (ContentTypeGroupCreateData $data) use ($form): Response { $createStruct = $this->contentTypeService->newContentTypeGroupCreateStruct( $data->getIdentifier() ); @@ -128,6 +131,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, ])); @@ -152,13 +163,14 @@ 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) ); $form->handleRequest($request); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (ContentTypeGroupUpdateData $data) { + $result = $this->submitHandler->handle($form, function (ContentTypeGroupUpdateData $data) use ($form): Response { $group = $data->getContentTypeGroup(); $updateStruct = $this->contentTypeService->newContentTypeGroupUpdateStruct(); $updateStruct->identifier = $data->getIdentifier(); @@ -172,6 +184,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/Controller/LanguageController.php b/src/bundle/Controller/LanguageController.php index fa04c96650..0cae768776 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; @@ -196,11 +199,12 @@ 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); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (LanguageCreateData $data) { + $result = $this->submitHandler->handle($form, function (LanguageCreateData $data) use ($form): Response { $languageCreateStruct = $this->languageCreateMapper->reverseMap($data); $language = $this->languageService->createLanguage($languageCreateStruct); @@ -211,6 +215,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, ])); @@ -229,13 +241,14 @@ 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) ); $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): Response { $this->languageService->updateLanguageName($language, $data->getName()); $data->isEnabled() @@ -249,6 +262,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/Controller/LinkManagerController.php b/src/bundle/Controller/LinkManagerController.php index 3987242863..e549df6b47 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; @@ -67,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, @@ -75,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) { + $result = $this->submitHandler->handle($form, function (URLUpdateData $data) use ($url, $form): Response { $this->urlService->updateUrl($url, $data); $this->notificationHandler->success( /** @Desc("URL updated") */ @@ -84,6 +87,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/ObjectStateController.php b/src/bundle/Controller/ObjectStateController.php index ddb467ecac..a44d7217b8 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; @@ -131,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() @@ -140,7 +142,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): Response { $createStruct = $this->objectStateService->newObjectStateCreateStruct( $data->getIdentifier() ); @@ -155,6 +157,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, ]); @@ -260,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) @@ -267,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) { + $result = $this->submitHandler->handle($form, function (ObjectStateUpdateData $data) use ($form): Response { $objectState = $data->getObjectState(); $updateStruct = $this->objectStateService->newObjectStateUpdateStruct(); $updateStruct->identifier = $data->getIdentifier(); @@ -282,6 +293,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..c2c8cc8db5 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; @@ -109,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() ); @@ -117,7 +121,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): Response { $createStruct = $this->objectStateService->newObjectStateGroupCreateStruct( $data->getIdentifier() ); @@ -132,6 +136,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, ]); @@ -230,13 +242,14 @@ 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) ); $form->handleRequest($request); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (ObjectStateGroupUpdateData $data) { + $result = $this->submitHandler->handle($form, function (ObjectStateGroupUpdateData $data) use ($form): Response { $group = $data->getObjectStateGroup(); $updateStruct = $this->objectStateService->newObjectStateGroupUpdateStruct(); $updateStruct->identifier = $data->getIdentifier(); @@ -251,6 +264,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/Controller/PolicyController.php b/src/bundle/Controller/PolicyController.php index 33a2681089..cf0eb5f72f 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; @@ -229,13 +231,14 @@ public function updateAction(Request $request, Role $role, Policy $policy): Resp ])); } + /** @var \Symfony\Component\Form\Form $form */ $form = $this->formFactory->updatePolicy( new PolicyUpdateData($policy) ); $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): Response { $policyUpdateStruct = $this->policyUpdateMapper->reverseMap($data); $roleDraft = $this->roleService->createRoleDraft($role); @@ -255,6 +258,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..f0d6d4e9d7 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; @@ -133,11 +136,12 @@ 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); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (RoleCreateData $data) { + $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); @@ -149,6 +153,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, ])); @@ -208,13 +220,15 @@ 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) ); $form->handleRequest($request); if ($form->isSubmitted()) { - $result = $this->submitHandler->handle($form, function (RoleUpdateData $data) { + $result = $this->submitHandler->handle($form, function (RoleUpdateData $data) use ($form): Response { + /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role $role */ $role = $data->getRole(); $roleUpdateStruct = $this->roleUpdateMapper->reverseMap($data); @@ -230,6 +244,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/Controller/SectionController.php b/src/bundle/Controller/SectionController.php index e699a8d184..57330061ca 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; @@ -396,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() ); @@ -414,6 +418,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, ])); @@ -438,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) ); @@ -456,9 +469,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/Controller/URLWildcardController.php b/src/bundle/Controller/URLWildcardController.php index 810d4c6541..97704886e1 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; @@ -56,13 +58,14 @@ public function __construct( */ public function addAction(Request $request): Response { + /** @var \Symfony\Component\Form\Form $form */ $form = $this->formFactory->createURLWildcard(); $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): Response { + $urlWildcard = $this->urlWildcardService->create( $data->getSourceURL(), $data->getDestinationUrl(), (bool) $data->getForward() @@ -74,6 +77,18 @@ 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, + ]); + } + + return $this->redirect($this->generateUrl('ibexa.url_management', [ + '_fragment' => URLWildcardsTab::URI_FRAGMENT, + ])); }); } @@ -90,6 +105,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) ); @@ -99,7 +115,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): Response { $urlWildcardUpdateStruct = new URLWildcardUpdateStruct(); $urlWildcardUpdateStruct->destinationUrl = $data->getDestinationUrl(); $urlWildcardUpdateStruct->sourceUrl = $data->getSourceURL(); @@ -117,6 +133,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/ParamConverter/ContentTypeDraftParamConverter.php b/src/bundle/ParamConverter/ContentTypeDraftParamConverter.php index 5577e32e66..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; - /** - * ContentTypeGroupParamConverter constructor. - * - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeGroupService - */ public function __construct(ContentTypeService $contentTypeGroupService) { $this->contentTypeService = $contentTypeGroupService; 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/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); + }, }, ], }, diff --git a/src/bundle/Resources/translations/forms.en.xliff b/src/bundle/Resources/translations/forms.en.xliff index 05f3b04704..4dec48ca8d 100644 --- a/src/bundle/Resources/translations/forms.en.xliff +++ b/src/bundle/Resources/translations/forms.en.xliff @@ -71,11 +71,6 @@ Name key: ezplatform.language.create.name - - Create - Create - key: ezplatform.language.create.save - Delete Delete @@ -116,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 @@ -152,8 +162,8 @@ key: policies_delete_form.delete - Create - Create + Save + Save key: policy_create.save @@ -227,10 +237,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 +257,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 @@ -266,6 +286,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 @@ -287,8 +317,8 @@ key: section_subtree_assign_form.assign - Update - Update + Save + Save key: section_update_form.update 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_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_content_type.en.xliff b/src/bundle/Resources/translations/ibexa_content_type.en.xliff index d2e3b4ffc2..f3b4c115ab 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 @@ -381,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 @@ -416,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_menu.en.xliff b/src/bundle/Resources/translations/ibexa_menu.en.xliff index 0e73d9eb2d..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 @@ -106,19 +111,29 @@ 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 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 @@ -132,25 +147,35 @@ 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 - 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 changes Discard changes @@ -161,16 +186,26 @@ 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 + 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 @@ -181,6 +216,11 @@ Save key: language_edit__sidebar_right__save + + Save and close + Save and close + key: language_edit__sidebar_right__save_and_close + Admin Admin @@ -262,10 +302,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 @@ -276,16 +321,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 @@ -296,14 +351,19 @@ 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 + Discard + Discard key: policy_create__sidebar_right__cancel - Create - Create + Save and close + Save and close key: policy_create__sidebar_right__create @@ -312,18 +372,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 @@ -337,15 +402,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 @@ -356,16 +426,26 @@ Save key: role_edit__sidebar_right__save + + Save and close + Save and close + key: role_edit__sidebar_right__save_and_close + - 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 @@ -376,6 +456,11 @@ Save key: section_edit__sidebar_right__save + + Save and close + Save and close + key: section_edit__sidebar_right__save_and_close + Bookmarks Bookmarks @@ -416,6 +501,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 @@ -426,6 +516,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/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/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 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/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/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/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/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/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/bundle/Resources/views/themes/admin/link_manager/edit.html.twig b/src/bundle/Resources/views/themes/admin/link_manager/edit.html.twig index 3163e8e3de..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,12 +4,11 @@ {% 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', [], {'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 +28,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/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/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/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/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/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/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/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/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' -%} 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 %} 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/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/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/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/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/edit.html.twig b/src/bundle/Resources/views/themes/admin/user/role/edit.html.twig index bc725d2f56..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'), @@ -15,7 +19,7 @@ {% endblock %} {% block form %} - {{ form_start(form, {'attr': {'class': 'update-section'}}) }} + {{ form_start(form, {'attr': {'class': 'update-role'}}) }}
@@ -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/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') 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/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/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/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 9cd4bc013e..8d1d9b602c 100644 --- a/src/lib/Behat/Component/ContentActionsMenu.php +++ b/src/lib/Behat/Component/ContentActionsMenu.php @@ -10,36 +10,76 @@ 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 { - public function clickButton(string $buttonName): void + public function clickButton(string $buttonName, ?string $groupName = null): void + { + 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(); + $buttons->single()->click(); + + return; + } + + 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(); + } - if ($button->findAll($this->getLocator('label'))->any()) { - $button->find($this->getLocator('label'))->click(); + private function clickButtonInGroup(string $groupName, string $buttonName): void + { + $group = $this->getHTMLPage() + ->findAll($this->getLocator('splitButton')) + ->filterBy(new ElementTextCriterion($groupName)); - return; - } + if ($group->any()) { + $group->single()->find($this->getLocator('toggle'))->click(); - $button->click(); + $this->getHTMLPage()->findAll($this->getLocator('button')) + ->getByCriterion(new ElementTextCriterion($buttonName)) + ->click(); 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)) + ->mouseOver(); + + $this->getHTMLPage() + ->findAll($this->getLocator('menuButton')) ->getByCriterion(new ElementTextCriterion($buttonName)) ->click(); } @@ -56,10 +96,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')) @@ -67,6 +104,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() @@ -78,10 +123,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('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'), ]; } } 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)'), diff --git a/src/lib/Form/Processor/ContentEditFormProcessor.php b/src/lib/Form/Processor/ContentEditFormProcessor.php new file mode 100644 index 0000000000..9ac1020a54 --- /dev/null +++ b/src/lib/Form/Processor/ContentEditFormProcessor.php @@ -0,0 +1,45 @@ +router = $router; + } + + public static function getSubscribedEvents(): array + { + return [ + ContentFormEvents::CONTENT_SAVE_DRAFT_AND_CLOSE => ['redirectToDraftsView', 5], + ]; + } + + /** + * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + */ + public function redirectToDraftsView(FormActionEvent $event): void + { + $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/Form/Processor/ContentType/ContentTypeFormProcessor.php b/src/lib/Form/Processor/ContentType/ContentTypeFormProcessor.php index 459e21f9e7..c34475dc2d 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): void + { + $eventData = $event->getData(); + /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\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/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/Form/Type/Language/LanguageCreateType.php b/src/lib/Form/Type/Language/LanguageCreateType.php index 35d2d7ae9c..3e7b60f7b7 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") */ 'language.create.save'] + ) + ->add( + 'save_and_close', SubmitType::class, - ['label' => /** @Desc("Create") */ 'ezplatform.language.create.save'] + ['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 3912b9d5ad..e0ef265bd4 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") */ 'language.update.save_and_close'] ); } 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/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..f99f776da0 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,9 +28,14 @@ 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'] + ) + ->add( + 'save_and_close', SubmitType::class, - ['label' => /** @Desc("Create") */ 'role_create.save'] + ['label' => /** @Desc("Save and close") */ 'role_create.save_and_close'] ); } 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/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/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/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; 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 f771efc140..d6b5fee339 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 */ @@ -60,20 +61,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, [ @@ -92,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'), ]; } 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'), ]; } 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'), ]; } 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'), ]; } diff --git a/src/lib/Menu/ContentCreateRightSidebarBuilder.php b/src/lib/Menu/ContentCreateRightSidebarBuilder.php index 2db2e82eeb..1d7b457290 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_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'; @@ -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'), ]; diff --git a/src/lib/Menu/ContentEditRightSidebarBuilder.php b/src/lib/Menu/ContentEditRightSidebarBuilder.php index 6d3bb19816..a074c4308e 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' => 10, + ], + ] + ); + + $items[self::ITEM__SAVE_DRAFT_AND_CLOSE] = $saveDraftAndCloseItem; + $items[self::ITEM__PREVIEW] = $this->getContentPreviewItem( $location, $content, @@ -172,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'), ]; 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'), ]; } 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, [ 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()); }