Skip to content

Commit

Permalink
"Save and continue editing" everywhere
Browse files Browse the repository at this point in the history
Resolves #14168
  • Loading branch information
brandonkelly committed Jan 22, 2024
1 parent 02bfc3f commit d46e113
Show file tree
Hide file tree
Showing 11 changed files with 97 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG-WIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
### Content Management
- Admin tables now have sticky footers. ([#14149](https://github.com/craftcms/cms/pull/14149))

### Administration
- Added “Save and continue editing” actions to all core settings pages with full-page forms. ([#14168](https://github.com/craftcms/cms/discussions/14168))

### System
- Reduced the system font file size, and prevented the flash of unstyled type for it. ([#13879](https://github.com/craftcms/cms/pull/13879))
- Log message timestamps are now set to the system time zone. ([#13341](https://github.com/craftcms/cms/issues/13341))
5 changes: 5 additions & 0 deletions src/controllers/VolumesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ public function actionEditVolume(?int $volumeId = null, ?Volume $volume = null):
->action('volumes/save-volume')
->redirectUrl('settings/assets')
->saveShortcutRedirectUrl('settings/assets/volumes/{id}')
->addAltAction(Craft::t('app', 'Save and continue editing'), [
'redirect' => 'settings/assets/volumes/{id}',
'shortcut' => true,
'retainScroll' => true,
])
->editUrl($volume->id ? "settings/assets/volumes/$volume->id" : null)
->contentTemplate('settings/assets/volumes/_edit.twig', [
'volumeId' => $volumeId,
Expand Down
13 changes: 11 additions & 2 deletions src/templates/settings/assets/transforms/_settings.twig
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
{% extends '_layouts/cp.twig' %}

{% import '_includes/forms.twig' as forms %}
{% set fullPageForm = true %}

{% set crumbs = [
{ label: "Settings"|t('app'), url: url('settings') },
{ label: "Assets"|t('app'), url: url('settings/assets') },
{ label: "Image Transforms"|t('app'), url: url('settings/assets/transforms') }
] %}

{% set fullPageForm = true %}
{% set formActions = [
{
label: 'Save and continue editing'|t('app'),
redirect: 'settings/assets/transforms/{handle}'|hash,
shortcut: true,
retainScroll: true,
},
] %}

{% import '_includes/forms.twig' as forms %}


{% block content %}
Expand Down
9 changes: 9 additions & 0 deletions src/templates/settings/categories/_edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

{% set fullPageForm = true %}

{% set formActions = [
{
label: 'Save and continue editing'|t('app'),
redirect: 'settings/categories/{id}'|hash,
shortcut: true,
retainScroll: true,
},
] %}

{% import '_includes/forms.twig' as forms %}

{% set headlessMode = craft.app.config.general.headlessMode %}
Expand Down
13 changes: 11 additions & 2 deletions src/templates/settings/email/_index.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,21 @@

{% extends '_layouts/cp.twig' %}

{% set title = 'Email Settings'|t('app') %}
{% set fullPageForm = true %}

{% set crumbs = [
{ label: "Settings"|t('app'), url: url('settings') }
] %}

{% set fullPageForm = true %}
{% set title = "Email Settings"|t('app') %}
{% set formActions = [
{
label: 'Save and continue editing'|t('app'),
redirect: 'settings/email'|hash,
shortcut: true,
retainScroll: true,
},
] %}

{% import '_includes/forms.twig' as forms %}

Expand Down
9 changes: 9 additions & 0 deletions src/templates/settings/general/_index.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
{ label: "Settings"|t('app'), url: url('settings') }
] %}

{% set formActions = [
{
label: 'Save and continue editing'|t('app'),
redirect: 'settings/general'|hash,
shortcut: true,
retainScroll: true,
},
] %}

{# set defaults #}
{% set system = {
name: null,
Expand Down
9 changes: 9 additions & 0 deletions src/templates/settings/globals/_edit.twig
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
{% extends '_layouts/cp.twig' %}
{% set fullPageForm = true %}

{% set formActions = [
{
label: 'Save and continue editing'|t('app'),
redirect: 'settings/globals/{id}'|hash,
shortcut: true,
retainScroll: true,
},
] %}

{% import '_includes/forms.twig' as forms %}


Expand Down
19 changes: 13 additions & 6 deletions src/templates/settings/plugins/_settings.twig
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
{% requireAdmin %}

{% extends "_layouts/cp" %}
{% set title = plugin.name %}
{% set docTitle = title ~ ' - ' ~ "Plugins"|t('app') %}
{% set fullPageForm = true %}

{% set crumbs = [
{ label: "Settings"|t('app'), url: url('settings') },
{ label: "Plugins"|t('app'), url: url('settings/plugins') }
] %}

{% set fullPageForm = true %}


{% extends "_layouts/cp" %}
{% set title = plugin.name %}
{% set docTitle = title ~ ' - ' ~ "Plugins"|t('app') %}
{% set formActions = [
{
label: 'Save and continue editing'|t('app'),
redirect: "settings/plugins/#{plugin.handle}"|hash,
shortcut: true,
retainScroll: true,
},
] %}


{% block content %}
Expand Down
9 changes: 9 additions & 0 deletions src/templates/settings/sites/_edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

{% set fullPageForm = true %}

{% set formActions = [
{
label: 'Save and continue editing'|t('app'),
redirect: 'settings/sites/{id}'|hash,
shortcut: true,
retainScroll: true,
},
] %}

{% import '_includes/forms.twig' as forms %}


Expand Down
9 changes: 9 additions & 0 deletions src/templates/settings/tags/_edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

{% set fullPageForm = true %}

{% set formActions = [
{
label: 'Save and continue editing'|t('app'),
redirect: 'settings/tags/{id}'|hash,
shortcut: true,
retainScroll: true,
},
] %}

{% import '_includes/forms.twig' as forms %}

{% block content %}
Expand Down
9 changes: 9 additions & 0 deletions src/templates/settings/users/groups/_edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@
{ label: "User Groups"|t('app'), url: url('settings/users') }
] %}

{% set formActions = [
{
label: 'Save and continue editing'|t('app'),
redirect: 'settings/users/groups/{id}'|hash,
shortcut: true,
retainScroll: true,
},
] %}


{% if group is not defined and groupId is defined %}
{% set group = craft.app.userGroups.getGroupById(groupId) %}
Expand Down

0 comments on commit d46e113

Please sign in to comment.