mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#5467: Fixes the issue where the "Set as homepage" setting is not retained when saving,
The issue was that when you save a content item (without publishing it) while checking the "Set as homepage" checkbox, it would lose its checked status after save. With this change, the checkbox is again rendered but in a checked status, so that when you do publish, it will become the homepage. Fixes #5467
This commit is contained in:
@@ -67,9 +67,8 @@ namespace Orchard.Autoroute.Drivers {
|
||||
var homepage = _aliasService.Get(string.Empty);
|
||||
var displayRouteValues = _contentManager.GetItemMetadata(part).DisplayRouteValues;
|
||||
|
||||
if(homepage.Match(displayRouteValues)) {
|
||||
viewModel.PromoteToHomePage = true;
|
||||
}
|
||||
viewModel.IsHomePage = homepage.Match(displayRouteValues);
|
||||
viewModel.PromoteToHomePage = viewModel.IsHomePage || part.DisplayAlias == "/";
|
||||
|
||||
if (settings.PerItemConfiguration) {
|
||||
// if enabled, the list of all available patterns is displayed, and the user can
|
||||
|
@@ -4,6 +4,7 @@ namespace Orchard.Autoroute.ViewModels {
|
||||
|
||||
public class AutoroutePartEditViewModel {
|
||||
public AutorouteSettings Settings { get; set; }
|
||||
public bool IsHomePage { get; set; }
|
||||
public bool PromoteToHomePage { get; set; }
|
||||
public string CurrentUrl { get; set; }
|
||||
public string CustomPattern { get; set; }
|
||||
|
@@ -16,7 +16,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@if (!Model.PromoteToHomePage) {
|
||||
@if (!Model.IsHomePage) {
|
||||
<fieldset class="permalink">
|
||||
<label>@T("Permalink")</label>
|
||||
@if (Model.Settings.AllowCustomPattern) {
|
||||
@@ -24,7 +24,7 @@
|
||||
<span>@Url.MakeAbsolute("/")@urlPrefix</span>
|
||||
<span>@Html.TextBoxFor(m => m.CurrentUrl, new { @class = "text is-url" })</span>
|
||||
</span>
|
||||
<span class="hint">@T("Save the current item and leave the input empty to have it automatically generated using the pattern {0} e.g., {1}", defaultPattern.Name, defaultPattern.Description)</span>
|
||||
<span class="hint">@T("Save the current item and leave the input empty to have it automatically generated using the pattern {0} e.g., {1}.", defaultPattern.Name, defaultPattern.Description)</span>
|
||||
}
|
||||
else {
|
||||
var hintClass = string.Empty;
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
if (string.IsNullOrEmpty(Model.CurrentUrl)
|
||||
|| (!string.IsNullOrEmpty(Model.CurrentUrl) && Model.Settings.AutomaticAdjustmentOnEdit)) {
|
||||
<span class="@hintClass">@T("Save the current item and the url will be generated using the pattern {0} e.g., {1}", defaultPattern.Name, defaultPattern.Description)</span>
|
||||
<span class="@hintClass">@T("Save the current item and the url will be generated using the pattern {0} e.g., {1}.", defaultPattern.Name, defaultPattern.Description)</span>
|
||||
}
|
||||
}
|
||||
@if (!String.IsNullOrEmpty(Model.CurrentUrl)) {
|
||||
@@ -54,10 +54,10 @@
|
||||
@Html.EditorFor(m => m.PromoteToHomePage)
|
||||
<label for="@Html.FieldIdFor(m => m.PromoteToHomePage)" class="forcheckbox">@T("Set as home page")</label>
|
||||
</span>
|
||||
<span class="hint">@T("Check to promote this content as the home page")</span>
|
||||
<span class="hint">@T("Check to promote this content as the home page.")</span>
|
||||
</fieldset>
|
||||
}
|
||||
}
|
||||
else {
|
||||
<span>@T("This content is the current home page")</span>
|
||||
<span>@T("This content is the current home page.")</span>
|
||||
}
|
||||
|
Reference in New Issue
Block a user