Skip to content

Commit

Permalink
"Save and continue editing" for GraphQL schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed May 25, 2024
1 parent f057a81 commit 3074153
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG-WIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
- Added the `--format` option to the `db/backup` and `db/restore` commands for PostgreSQL installs. ([#14931](https://github.com/craftcms/cms/pull/14931))
- The `db/restore` command now autodetects the backup format for PostgreSQL installs, if `--format` isn’t passed. ([#14931](https://github.com/craftcms/cms/pull/14931))
- The `install` command and web-based installer now validate the existing project config files at the outset, and abort installation if there are any issues.
- The web-based installer now displays the error message when installation fails.
- The web-based installer now displays the error message when installation fails.
- GraphQL schema edit pages now have a “Save and continue editing” alternate action.

### Development
- Added `craft\elements\ElementCollection::find()`, which can return an element or elements in the collection based on a given element or ID. ([#15023](https://github.com/craftcms/cms/discussions/15023))
Expand Down
3 changes: 1 addition & 2 deletions src/controllers/GraphqlController.php
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,6 @@ public function actionEditSchema(?int $schemaId = null, ?GqlSchema $schema = nul
$title = trim($schema->name) ?: Craft::t('app', 'Create a new GraphQL Schema');
}


return $this->renderTemplate('graphql/schemas/_edit.twig', compact(
'schema',
'title'
Expand Down Expand Up @@ -718,7 +717,7 @@ public function actionSaveSchema(): ?Response
}

$this->setSuccessFlash(Craft::t('app', 'Schema saved.'));
return $this->redirectToPostedUrl();
return $this->redirectToPostedUrl($schema);
}

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

{% set fullPageForm = true %}

{% set formActions = [
{
label: 'Save and continue editing'|t('app'),
redirect: (schema.isPublic ? 'graphql/schemas/public' : 'graphql/schemas/{id}')|hash,
shortcut: true,
retainScroll: true,
},
] %}

{% set crumbs = [
{ label: "GraphQL Schemas"|t('app'), url: url('graphql/schemas') }
] %}
Expand Down

0 comments on commit 3074153

Please sign in to comment.