-
Notifications
You must be signed in to change notification settings - Fork 537
Add Message Templates management to Grand.Web.Store #694
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
Open
Copilot
wants to merge
14
commits into
develop
Choose a base branch
from
copilot/add-message-template-controller
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
1f517b5
Add MessageTemplate management for Store area (controller + CRUD views)
Copilot 100ba4b
Fix implicit global variable in MessageTemplate partial view
Copilot c81b017
Prevent duplicate message templates per store in Create action
Copilot 081fb18
Potential fix for pull request finding 'Generic catch clause'
KrzysztofPajak e720b1a
Add missing resource string for duplicate template name validation
Copilot f4681db
Block copy when template with same name already exists for current store
Copilot 54f4377
Fix false positive duplicate check when copying global message templates
Copilot 74c5fa1
Add missing resource strings for message template tabs (store/global)
Copilot fb220b8
Block copy of store-specific templates (LimitedToStores=true) in Copy…
Copilot 5195dd8
Fix duplicate copy check and add missing admin.content.messagetemplat…
Copilot d90c92a
Optimize duplicate check in message template copy
KrzysztofPajak d3f4a12
Potential fix for pull request finding
KrzysztofPajak 3cd28d8
Add server-side pagination to ListGlobal and ListStore grid actions
Copilot 2668755
Fix false-positive duplicate check in Create action to allow store-sp…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
src/Web/Grand.Web.Store/Areas/Store/Views/MessageTemplate/Create.cshtml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| @model MessageTemplateModel | ||
| @{ | ||
| ViewBag.Title = Loc["Admin.Content.MessageTemplates.AddNew"]; | ||
| Layout = Constants.LayoutStore; | ||
| } | ||
| <form asp-area="@Constants.AreaStore" asp-controller="MessageTemplate" asp-action="Create" method="post"> | ||
|
|
||
| <div class="row"> | ||
| <div class="col-md-12"> | ||
| <div class="x_panel light form-fit"> | ||
| <div class="x_title"> | ||
| <div class="caption"> | ||
| <i class="fa fa-envelope-o"></i> | ||
| @Loc["Admin.Content.MessageTemplates.AddNew"] | ||
| <small> | ||
| <i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["Admin.Content.MessageTemplates.BackToList"], "List") | ||
| </small> | ||
| </div> | ||
| <div class="actions"> | ||
| <div class="btn-group btn-group-devided"> | ||
| <button class="btn btn-success" type="submit" name="save"> | ||
| <i class="fa fa-check"></i> @Loc["Admin.Common.Save"] | ||
| </button> | ||
| <button class="btn btn-success" type="submit" name="save-continue"> | ||
| <i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"] | ||
| </button> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class="x_content form"> | ||
| <partial name="Partials/CreateOrUpdate" model="Model"/> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </form> |
41 changes: 41 additions & 0 deletions
41
src/Web/Grand.Web.Store/Areas/Store/Views/MessageTemplate/Edit.cshtml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| @model MessageTemplateModel | ||
| @{ | ||
| ViewBag.Title = Loc["Admin.Content.MessageTemplates.EditMessageTemplateDetails"]; | ||
| Layout = Constants.LayoutStore; | ||
| } | ||
| <form asp-area="@Constants.AreaStore" asp-controller="MessageTemplate" asp-action="Edit" method="post"> | ||
|
|
||
| <div class="row"> | ||
| <div class="col-md-12"> | ||
| <div class="x_panel light form-fit"> | ||
| <div class="x_title"> | ||
| <div class="caption"> | ||
| <i class="fa fa-envelope-o"></i> | ||
| @Loc["Admin.Content.MessageTemplates.EditMessageTemplateDetails"] - @Model.Name | ||
| <small> | ||
| <i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["Admin.Content.MessageTemplates.BackToList"], "List") | ||
| </small> | ||
| </div> | ||
| <div class="actions"> | ||
| <div class="btn-group btn-group-devided"> | ||
| <button class="btn btn-success" type="submit" name="save"> | ||
| <i class="fa fa-check"></i> @Loc["Admin.Common.Save"] | ||
| </button> | ||
| <button class="btn btn-success" type="submit" name="save-continue"> | ||
| <i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"] | ||
| </button> | ||
| <input type="submit" name="message-template-copy" asp-action="CopyTemplate" class="btn blue" value="@Loc["Admin.Content.MessageTemplates.Copy"]" onclick="return confirm('@Loc["Admin.Common.AreYouSure"]');"/> | ||
| <span id="message-template-delete" class="btn red"> | ||
| <i class="fa fa-trash-o"></i> @Loc["Admin.Common.Delete"] | ||
| </span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class="x_content form"> | ||
| <partial name="Partials/CreateOrUpdate" model="Model"/> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </form> | ||
| <admin-delete-confirmation button-id="message-template-delete"/> | ||
|
KrzysztofPajak marked this conversation as resolved.
|
||
143 changes: 143 additions & 0 deletions
143
src/Web/Grand.Web.Store/Areas/Store/Views/MessageTemplate/List.cshtml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,143 @@ | ||
| @inject AdminAreaSettings adminAreaSettings | ||
| @{ | ||
| ViewBag.Title = Loc["Admin.Content.MessageTemplates"]; | ||
| Layout = Constants.LayoutStore; | ||
| } | ||
|
|
||
| <div class="row"> | ||
| <div class="col-md-12"> | ||
| <div class="x_panel light form-fit"> | ||
| <div class="x_title"> | ||
| <div class="caption"> | ||
| <i class="fa fa-envelope-o"></i> | ||
| @Loc["Admin.Content.MessageTemplates"] | ||
| </div> | ||
| <div class="actions btn-group btn-group-devided"> | ||
| <a href="@Url.Action("Create", new { area = Constants.AreaStore })" class="btn green"> | ||
| <i class="fa fa-plus"></i><span class="d-none d-sm-inline"> @Loc["Admin.Common.AddNew"] </span> | ||
| </a> | ||
| </div> | ||
| </div> | ||
| <div class="x_content form"> | ||
| <admin-tabstrip name="messagetemplates-tabs"> | ||
| <items> | ||
| <tabstrip-item text="@Loc["Admin.Content.MessageTemplates.Tab.Store"]" tab-index="0"> | ||
| <content> | ||
| <div id="store-templates-grid"></div> | ||
| </content> | ||
| </tabstrip-item> | ||
| <tabstrip-item text="@Loc["Admin.Content.MessageTemplates.Tab.Global"]" tab-index="1"> | ||
| <content> | ||
| <div id="global-templates-grid"></div> | ||
| </content> | ||
| </tabstrip-item> | ||
| </items> | ||
| </admin-tabstrip> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <script> | ||
| $(document).ready(function () { | ||
| $("#store-templates-grid").kendoGrid({ | ||
| dataSource: { | ||
| transport: { | ||
| read: { | ||
| url: "@Html.Raw(Url.Action("ListStore", "MessageTemplate", new { area = Constants.AreaStore }))", | ||
| type: "POST", | ||
| dataType: "json", | ||
| data: addAntiForgeryToken | ||
| } | ||
| }, | ||
| schema: { | ||
| data: "Data", | ||
| total: "Total", | ||
| errors: "Errors" | ||
| }, | ||
| error: function(e) { | ||
| display_kendoui_grid_error(e); | ||
| this.cancelChanges(); | ||
| }, | ||
| pageSize: @(adminAreaSettings.DefaultGridPageSize), | ||
| serverPaging: true, | ||
| serverFiltering: true, | ||
| serverSorting: true | ||
| }, | ||
| pageable: { | ||
| refresh: true, | ||
| pageSizes: [@(adminAreaSettings.GridPageSizes)] | ||
| }, | ||
| scrollable: false, | ||
| columns: [{ | ||
| field: "Name", | ||
| title: "@Loc["Admin.Content.MessageTemplates.Fields.Name"]", | ||
| width: 300, | ||
| template: '<a class="k-link" href="Edit/#=Id#">#=kendo.htmlEncode(Name)#</a>' | ||
| }, { | ||
| field: "Subject", | ||
| title: "@Loc["Admin.Content.MessageTemplates.Fields.Subject"]", | ||
| width: 200 | ||
| }, { | ||
| field: "IsActive", | ||
| title: "@Loc["Admin.Content.MessageTemplates.Fields.IsActive"]", | ||
| width: 80, | ||
| headerAttributes: { style: "text-align:center" }, | ||
| attributes: { style: "text-align:center" }, | ||
| template: '# if(IsActive) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #' | ||
| }] | ||
| }); | ||
|
|
||
| $("#global-templates-grid").kendoGrid({ | ||
| dataSource: { | ||
| transport: { | ||
| read: { | ||
| url: "@Html.Raw(Url.Action("ListGlobal", "MessageTemplate", new { area = Constants.AreaStore }))", | ||
| type: "POST", | ||
| dataType: "json", | ||
| data: addAntiForgeryToken | ||
| } | ||
| }, | ||
| schema: { | ||
| data: "Data", | ||
| total: "Total", | ||
| errors: "Errors" | ||
| }, | ||
| error: function(e) { | ||
| display_kendoui_grid_error(e); | ||
| this.cancelChanges(); | ||
| }, | ||
| pageSize: @(adminAreaSettings.DefaultGridPageSize), | ||
| serverPaging: true, | ||
| serverFiltering: true, | ||
| serverSorting: true | ||
| }, | ||
| pageable: { | ||
| refresh: true, | ||
| pageSizes: [@(adminAreaSettings.GridPageSizes)] | ||
| }, | ||
| scrollable: false, | ||
| columns: [{ | ||
| field: "Name", | ||
| title: "@Loc["Admin.Content.MessageTemplates.Fields.Name"]", | ||
| width: 300 | ||
| }, { | ||
| field: "Subject", | ||
| title: "@Loc["Admin.Content.MessageTemplates.Fields.Subject"]", | ||
| width: 200 | ||
| }, { | ||
| field: "IsActive", | ||
| title: "@Loc["Admin.Content.MessageTemplates.Fields.IsActive"]", | ||
| width: 80, | ||
| headerAttributes: { style: "text-align:center" }, | ||
| attributes: { style: "text-align:center" }, | ||
| template: '# if(IsActive) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #' | ||
| }, { | ||
| title: "@Loc["Admin.Common.Copy"]", | ||
| width: 100, | ||
| headerAttributes: { style: "text-align:center" }, | ||
| attributes: { style: "text-align:center" }, | ||
| template: '<form method="post" action="@Url.Action("CopyTemplate", "MessageTemplate", new { area = Constants.AreaStore })"><input type="hidden" name="Id" value="#=Id#"/><button type="submit" class="btn btn-sm btn-info" onclick="return confirm(\'@Loc["Admin.Common.AreYouSure"]\')" title="@Loc["Admin.Content.MessageTemplates.Copy"]"><i class="fa fa-copy"></i></button>@Html.AntiForgeryToken()</form>' | ||
| }] | ||
|
KrzysztofPajak marked this conversation as resolved.
|
||
| }); | ||
| }); | ||
| </script> | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.