mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-07-15 17:38:47 +08:00
Add AutorouteSettings.AllowSetAsHomePage to control whether user can set a content to display on a home page (#8424)
* Add AutorouteSettings.AllowSetAsHomePage to control whether user can set a content to display on a home page * Extending the description of the AllowSetAsHomePage setting * Updating setting label --------- Co-authored-by: Benedek Farkas <benedek.farkas@lombiq.com>
This commit is contained in:
parent
6e4fefd873
commit
32e7d862f9
@ -18,6 +18,7 @@ namespace Orchard.Autoroute.Settings {
|
|||||||
public AutorouteSettings() {
|
public AutorouteSettings() {
|
||||||
PerItemConfiguration = false;
|
PerItemConfiguration = false;
|
||||||
AllowCustomPattern = true;
|
AllowCustomPattern = true;
|
||||||
|
AllowSetAsHomePage = true;
|
||||||
UseCulturePattern = false;
|
UseCulturePattern = false;
|
||||||
AutomaticAdjustmentOnEdit = false;
|
AutomaticAdjustmentOnEdit = false;
|
||||||
PatternDefinitions = "[]";
|
PatternDefinitions = "[]";
|
||||||
@ -27,6 +28,7 @@ namespace Orchard.Autoroute.Settings {
|
|||||||
|
|
||||||
public bool PerItemConfiguration { get; set; }
|
public bool PerItemConfiguration { get; set; }
|
||||||
public bool AllowCustomPattern { get; set; }
|
public bool AllowCustomPattern { get; set; }
|
||||||
|
public bool AllowSetAsHomePage { get; set; }
|
||||||
public bool UseCulturePattern { get; set; }
|
public bool UseCulturePattern { get; set; }
|
||||||
public bool AutomaticAdjustmentOnEdit { get; set; }
|
public bool AutomaticAdjustmentOnEdit { get; set; }
|
||||||
public bool? IsDefault { get; set; }
|
public bool? IsDefault { get; set; }
|
||||||
@ -100,6 +102,7 @@ namespace Orchard.Autoroute.Settings {
|
|||||||
public void Build(ContentTypePartDefinitionBuilder builder) {
|
public void Build(ContentTypePartDefinitionBuilder builder) {
|
||||||
builder.WithSetting("AutorouteSettings.PerItemConfiguration", PerItemConfiguration.ToString(CultureInfo.InvariantCulture));
|
builder.WithSetting("AutorouteSettings.PerItemConfiguration", PerItemConfiguration.ToString(CultureInfo.InvariantCulture));
|
||||||
builder.WithSetting("AutorouteSettings.AllowCustomPattern", AllowCustomPattern.ToString(CultureInfo.InvariantCulture));
|
builder.WithSetting("AutorouteSettings.AllowCustomPattern", AllowCustomPattern.ToString(CultureInfo.InvariantCulture));
|
||||||
|
builder.WithSetting("AutorouteSettings.AllowSetAsHomePage", AllowSetAsHomePage.ToString(CultureInfo.InvariantCulture));
|
||||||
builder.WithSetting("AutorouteSettings.UseCulturePattern", UseCulturePattern.ToString(CultureInfo.InvariantCulture));
|
builder.WithSetting("AutorouteSettings.UseCulturePattern", UseCulturePattern.ToString(CultureInfo.InvariantCulture));
|
||||||
builder.WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", AutomaticAdjustmentOnEdit.ToString(CultureInfo.InvariantCulture));
|
builder.WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", AutomaticAdjustmentOnEdit.ToString(CultureInfo.InvariantCulture));
|
||||||
builder.WithSetting("AutorouteSettings.PatternDefinitions", PatternDefinitions);
|
builder.WithSetting("AutorouteSettings.PatternDefinitions", PatternDefinitions);
|
||||||
|
@ -15,7 +15,15 @@
|
|||||||
<div>
|
<div>
|
||||||
@Html.CheckBoxFor(m => m.AllowCustomPattern)
|
@Html.CheckBoxFor(m => m.AllowCustomPattern)
|
||||||
<label class="forcheckbox" for="@Html.FieldIdFor(m => m.AllowCustomPattern)">@T("Allow custom patterns")</label>
|
<label class="forcheckbox" for="@Html.FieldIdFor(m => m.AllowCustomPattern)">@T("Allow custom patterns")</label>
|
||||||
<span class="hint">@T("Allow the user to change the pattern on each item")</span>
|
<span class="hint">@T("Allow the user to change the pattern on each item.")</span>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset>
|
||||||
|
<div>
|
||||||
|
@Html.CheckBoxFor(m => m.AllowSetAsHomePage)
|
||||||
|
<label class="forcheckbox" for="@Html.FieldIdFor(m => m.AllowSetAsHomePage)">@T("Allow \"Set as home page\"")</label>
|
||||||
|
<span class="hint">@T("Allow the user to set a content item of this type as the home page.")</span>
|
||||||
|
<span class="hint">@T("NOTE: Certain combinations of content type definitions and permission settings can create circumstances for non-Admin users with Dashboard access to remove the home page without the ability to set another one. Use this option with caution.")</span>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
@if (!Model.IsHomePage) {
|
@if (!Model.IsHomePage) {
|
||||||
if (AuthorizedFor(Permissions.SetHomePage)) {
|
if (AuthorizedFor(Permissions.SetHomePage) && Model.Settings.AllowSetAsHomePage) {
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<span class="checkbox-and-label">
|
<span class="checkbox-and-label">
|
||||||
@Html.CheckBoxFor(m => m.PromoteToHomePage)
|
@Html.CheckBoxFor(m => m.PromoteToHomePage)
|
||||||
|
Loading…
Reference in New Issue
Block a user