Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "save and continue" button to admin menu node and content type editors #17515

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hawkeye101
Copy link

@hawkeye101 hawkeye101 commented Feb 23, 2025

Fixes #17483

Copy link
Contributor

Thank you for submitting your first pull request, awesome! 🚀 If you haven't already, please take a moment to review our contribution guide. This guide provides helpful information to ensure your contribution aligns with our standards. A core team member will review your pull request.

If you like Orchard Core, please star our repo and join our community channels.

@hishamco hishamco requested a review from Piedone February 23, 2025 11:15
Copy link
Member

@Piedone Piedone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current Save button already does the "save and close" behavior. What you asked for is the "save and continue" one.

@Piedone Piedone changed the title Added 'Save & Close' button next to 'Save' button Add "save and continue" button to admin menu node editor Feb 24, 2025
@Piedone
Copy link
Member

Piedone commented Feb 24, 2025

There seem to be one more user who has made a commit independently regarding the same ticket. I'm not sure what's the process here, please let me know if we need to delete my branch.

I'm not sure what you mean by that, please be specific. There are no related commits in this, the official, repository.

Copy link
Member

@Piedone Piedone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still implementing a "save and close" behavior. As I told previously, and as you also asked under the issue, this should rather be "save and continue", meaning that the default is "save and close" (as it is today), and you can opt to do a "save and continue". As we discussed here: #17483 (comment) please do this in the exact same way as other piece of the UI do; you can take the "Save Draft ...and continue" button as an example. This should be the same, just without "Draft", since the Admin Menu is not versioned.

@hawkeye101 hawkeye101 force-pushed the main branch 3 times, most recently from 24151bb to ed5759c Compare February 26, 2025 09:23
@hawkeye101
Copy link
Author

I have made changes as you said.

@Piedone Piedone changed the title Add "save and continue" button to admin menu node editor Add "save and continue" button to admin menu node and content type editors Feb 27, 2025
Copy link
Member

@Piedone Piedone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

}
else if (String.Equals(submit, "saveAndContinue", StringComparison.Ordinal))
{
await _notifier.SuccessAsync(H["Admin node updated successfully."]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
await _notifier.SuccessAsync(H["Admin node updated successfully."]);
await _notifier.SuccessAsync(H["Content type updated successfully."]);

@@ -225,7 +225,15 @@ public async Task<IActionResult> Edit(AdminNodeEditViewModel model)
await _adminMenuService.SaveAsync(adminMenu);

await _notifier.SuccessAsync(H["Admin node updated successfully."]);
return RedirectToAction(nameof(List), new { id = model.AdminMenuId });
if (String.Equals(submit, "saveAndContinue", StringComparison.Ordinal))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also the same in the other places.

Suggested change
if (String.Equals(submit, "saveAndContinue", StringComparison.Ordinal))
if (string.Equals(submit, "saveAndContinue", StringComparison.Ordinal))

Comment on lines +167 to +174
if (String.Equals(submit, "save", StringComparison.Ordinal))
{
return RedirectToAction(nameof(List));
}
else if (String.Equals(submit, "saveAndContinue", StringComparison.Ordinal))
{
await _notifier.SuccessAsync(H["Admin node updated successfully."]);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (String.Equals(submit, "save", StringComparison.Ordinal))
{
return RedirectToAction(nameof(List));
}
else if (String.Equals(submit, "saveAndContinue", StringComparison.Ordinal))
{
await _notifier.SuccessAsync(H["Admin node updated successfully."]);
}
if (string.Equals(submit, "saveAndContinue", StringComparison.Ordinal))
{
await _notifier.SuccessAsync(H["Admin node updated successfully."]);
return View(typeViewModel);
}
else
{
return RedirectToAction(nameof(List));
}

<span class="visually-hidden">@T["Toggle Dropdown"]</span>
</button>
<div class="dropdown-menu">
<button class="dropdown-item save-continue" type="submit" name="submit" value="saveAndContinue">@T["and continue"]</button>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it's in line with the other such features. Also do the same for the content type editor.

Suggested change
<button class="dropdown-item save-continue" type="submit" name="submit" value="saveAndContinue">@T["and continue"]</button>
<button class="dropdown-item save-continue" type="submit" name="submit" value="SaveAndContinue">@T["and continue"]</button>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add "save and continue" button to admin menu node editor
3 participants