From a8de3afc0f6d89bb328d0188d45072c15f9d1e6b Mon Sep 17 00:00:00 2001 From: Andrea Piovanelli <83577153+AndreaPiovanelliLaser@users.noreply.github.com> Date: Mon, 25 Oct 2021 09:19:50 +0200 Subject: [PATCH] Fix/editmenulink (#8515) * Removed useless spaces * Corrections on ProjectionPart query link (it didn't update the link when changing the selected query). Added edit link for menu in MenuWidget. * Added menuId parameter to menu edit link --- .../Parts.MenuWidget.Edit.cshtml | 29 ++++++++++++++++++- .../Parts/ProjectionPart.cshtml | 16 +++++++++- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/src/Orchard.Web/Core/Navigation/Views/EditorTemplates/Parts.MenuWidget.Edit.cshtml b/src/Orchard.Web/Core/Navigation/Views/EditorTemplates/Parts.MenuWidget.Edit.cshtml index c9a6aa8ef..f00790a18 100644 --- a/src/Orchard.Web/Core/Navigation/Views/EditorTemplates/Parts.MenuWidget.Edit.cshtml +++ b/src/Orchard.Web/Core/Navigation/Views/EditorTemplates/Parts.MenuWidget.Edit.cshtml @@ -2,13 +2,23 @@ @using Orchard.ContentManagement +@{ + var selectedMenuId = -1; +} +
@Html.LabelFor(m => m.CurrentMenuId, T("For Menu")) + @if (selectedMenuId != -1) { + @Html.ActionLink(T("Edit Menu").Text, "Index", new { area = "Navigation", menuId = selectedMenuId }, new { id = "editMenuLink" }) + } @T("Select which menu you want to display")
@@ -48,4 +58,21 @@ @Html.EditorFor(m => m.ShowFullMenu) @T("Check for the menu to be displayed without filtering the selected current page.") - \ No newline at end of file + + +@using (Script.Foot()) { + +} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Projections/Views/EditorTemplates/Parts/ProjectionPart.cshtml b/src/Orchard.Web/Modules/Orchard.Projections/Views/EditorTemplates/Parts/ProjectionPart.cshtml index faef261e1..de113faba 100644 --- a/src/Orchard.Web/Modules/Orchard.Projections/Views/EditorTemplates/Parts/ProjectionPart.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Projections/Views/EditorTemplates/Parts/ProjectionPart.cshtml @@ -52,7 +52,7 @@ } } @if (selectedQueryRecordId != -1) { - @Html.ActionLink(T("Edit Query").Text, "Edit", new { area = "Orchard.Projections", id = selectedQueryRecordId }, new { }) + @Html.ActionLink(T("Edit Query").Text, "Edit", new { area = "Orchard.Projections", id = selectedQueryRecordId }, new { id = "editQueryLink-" + Model.PartId.ToString() }) } @T("The query to display.") @@ -137,7 +137,21 @@ // m.QueryLayoutRecordId)").change(function (sender) { + var selected = $(this).val(); + // Removing layout id + selected = selected.substr(0, selected.indexOf(';')); + + var anchor = $("#editQueryLink-@Model.PartId.ToString()"); + var url = anchor.attr("href"); + // Now I need to replace the last part of the url (which is the QueryLayoutRecordId) with the selected id to make to link work properly. + var newUrl = url.substr(0, url.lastIndexOf("/") + 1); + newUrl = newUrl + selected; + anchor.attr("href", newUrl); + }); })(jQuery); + //]]> } \ No newline at end of file