Skip to content

Commit

Permalink
Added "Save & Add Another" button to enum value form
Browse files Browse the repository at this point in the history
  • Loading branch information
mpscholten committed Aug 6, 2021
1 parent 0e4c4d7 commit 0164273
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 9 additions & 1 deletion IHP/IDE/SchemaDesigner/Controller/EnumValues.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ instance Controller EnumValuesController where
setErrorMessage message
Success ->
updateSchema (map (addValueToEnum enumName enumValueName))
redirectTo ShowEnumAction { .. }

-- The form to save an enum has two save buttons:
--
-- 1. Save
-- 2. Save & Add another
--
case paramOrDefault @Text "Save" "submit" of
"Save" -> redirectTo ShowEnumAction { .. }
"Save & Add Another" -> redirectTo NewEnumValueAction { .. }

action EditEnumValueAction { .. } = do
statements <- readSchema
Expand Down
3 changes: 2 additions & 1 deletion IHP/IDE/SchemaDesigner/View/EnumValues/New.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ instance View NewEnumValueView where
</div>

<div class="text-right">
<button type="submit" class="btn btn-primary">Create Enum Value</button>
<input type="submit" name="submit" value="Save" class="btn btn-secondary mr-2">
<input type="submit" name="submit" value="Save & Add Another" class="btn btn-primary">
</div>
</form>
|]
Expand Down

0 comments on commit 0164273

Please sign in to comment.