mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 19:04:51 +08:00
Add setting to hide Container editor
This commit is contained in:
@@ -88,6 +88,10 @@ namespace Orchard.Core.Containers.Drivers {
|
||||
|
||||
protected override DriverResult Editor(ContainerPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
return ContentShape("Parts_Container_Edit", () => {
|
||||
if(!part.ContainerSettings.DisplayContainerEditor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var containables = !part.ContainerSettings.RestrictItemContentTypes ? _containerService.GetContainableTypes().ToList() : new List<ContentTypeDefinition>(0);
|
||||
var model = new ContainerViewModel {
|
||||
AdminMenuPosition = part.AdminMenuPosition,
|
||||
|
@@ -48,6 +48,10 @@ namespace Orchard.Core.Containers.Settings {
|
||||
}
|
||||
|
||||
public class ContainerTypePartSettings {
|
||||
public ContainerTypePartSettings() {
|
||||
DisplayContainerEditor = true;
|
||||
}
|
||||
|
||||
public bool? ItemsShownDefault { get; set; }
|
||||
public int? PageSizeDefault { get; set; }
|
||||
public bool? PaginatedDefault { get; set; }
|
||||
@@ -55,6 +59,7 @@ namespace Orchard.Core.Containers.Settings {
|
||||
public bool RestrictItemContentTypes { get; set; }
|
||||
public bool? EnablePositioning { get; set; }
|
||||
public string AdminListViewName { get; set; }
|
||||
public bool DisplayContainerEditor { get; set; }
|
||||
}
|
||||
|
||||
public class ContainerSettingsHooks : ContentDefinitionEditorEventsBase {
|
||||
@@ -93,7 +98,8 @@ namespace Orchard.Core.Containers.Settings {
|
||||
EnablePositioning = model.EnablePositioning,
|
||||
AdminListViewName = model.AdminListViewName,
|
||||
AvailableItemContentTypes = _containerService.GetContainableTypes().ToList(),
|
||||
ListViewProviders = _listViewService.Providers.ToList()
|
||||
ListViewProviders = _listViewService.Providers.ToList(),
|
||||
DisplayContainerEditor = model.DisplayContainerEditor
|
||||
};
|
||||
|
||||
yield return DefinitionTemplate(viewModel);
|
||||
@@ -122,6 +128,7 @@ namespace Orchard.Core.Containers.Settings {
|
||||
builder.WithSetting("ContainerTypePartSettings.RestrictItemContentTypes", viewModel.RestrictItemContentTypes.ToString());
|
||||
builder.WithSetting("ContainerTypePartSettings.EnablePositioning", viewModel.EnablePositioning.ToString());
|
||||
builder.WithSetting("ContainerTypePartSettings.AdminListViewName", viewModel.AdminListViewName);
|
||||
builder.WithSetting("ContainerTypePartSettings.DisplayContainerEditor", viewModel.DisplayContainerEditor.ToString());
|
||||
yield return DefinitionTemplate(viewModel);
|
||||
}
|
||||
|
||||
|
@@ -16,5 +16,6 @@ namespace Orchard.Core.Containers.ViewModels {
|
||||
|
||||
[UIHint("ListViewPicker")]
|
||||
public string AdminListViewName { get; set; }
|
||||
public bool DisplayContainerEditor { get; set; }
|
||||
}
|
||||
}
|
@@ -2,6 +2,11 @@
|
||||
@{
|
||||
Script.Require("ShapesBase");
|
||||
}
|
||||
<fieldset>
|
||||
@Html.CheckBoxFor(m => m.DisplayContainerEditor)
|
||||
@Html.LabelFor(m => m.DisplayContainerEditor, @T("Display settings editor").ToString(), new { @class = "forcheckbox" })
|
||||
<span class="hint">@T("When checked, users can change the settings for each content item.")</span>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<label for="@Html.FieldIdFor(m => m.ItemsShownDefault)">@T("Default Items Shown")</label>
|
||||
@Html.EditorFor(m => m.ItemsShownDefault)
|
||||
|
Reference in New Issue
Block a user