Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Allow to disable preview options on specific ContentAreas
define([
"dojo/_base/declare",
"dojo/_base/lang",
"epi-cms/contentediting/command/BlockRemove",
"epi-cms/contentediting/command/BlockEdit",
"epi-cms/contentediting/command/MoveToPrevious",
"epi-cms/contentediting/command/MoveToNext",
"epi-cms/contentediting/command/MoveOutsideGroup",
"epi-cms/contentediting/command/Personalize",
"epi-cms/contentediting/command/SelectDisplayOption",
"epi-cms/contentediting/editors/ContentAreaEditor"
],
function(
declare,
lang,
RemoveCommand,
EditCommand,
MoveToPrevious,
MoveToNext,
MoveOutsideGroup,
Personalize,
SelectDisplayOption,
_ContentAreaEditor
) {
return declare("alloy.editors.contentAreaWithNoOptions", [_ContentAreaEditor], {
postMixInProperties: function () {
this._commands = [
new EditCommand(),
// new SelectDisplayOption(),
new Personalize({ category: null }),
new MoveOutsideGroup(),
new MoveToPrevious(),
new MoveToNext(),
new RemoveCommand()
];
this.inherited(arguments);
}
});
});
define( [
// General application modules
"dojo/_base/declare",
"dojo/_base/event",
"dojo/_base/lang",
"epi-cms/widget/overlay/Block",
"epi-cms/contentediting/command/ContentAreaCommands"
], function (
// General application modules
declare,
event,
lang,
Block,
ContentAreaCommands
) {
return declare([Block], {
postCreate: function () {
var contentAreaCommands = new ContentAreaCommands({ model: this.viewModel });
contentAreaCommands.commands.splice(1, 1); // remove Display options menu
this.commandProvider = contentAreaCommands;
this.inherited(arguments);
}
});
});
define( [
// Dojo
"dojo/_base/array",
"dojo/_base/declare",
"dojo/_base/lang",
"./contentAreaWithNoOptionsBlock",
"epi-cms/widget/overlay/ContentArea"
], function (
// Dojo
array,
declare,
lang,
CustomBlock,
ContentArea
) {
return declare([ContentArea], {
blockClass: CustomBlock
});
});
[EditorDescriptorRegistration(TargetType = typeof(ContentArea), UIHint = UIHint)]
public class NoPreviewContentAreaEditorDescriptor : EditorDescriptor
{
public const string UIHint = "NoPreviewContentArea";
public NoPreviewContentAreaEditorDescriptor()
{
this.ClientEditingClass = "alloy.editors.contentAreaWithNoOptions";
}
public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
{
base.ModifyMetadata(metadata, attributes);
metadata.OverlayConfiguration["customType"] = "alloy.editors.contentAreaWithNoOptionsOverlay";
}
}
public class ProductPage : StandardPage
{
[Display(
GroupName = SystemTabNames.Content,
Order = 330)]
[CultureSpecific]
[AllowedTypes(new[] { typeof(IContentData) }, new[] { typeof(JumbotronBlock) })]
[UIHint(NoPreviewContentAreaEditorDescriptor.UIHint)]
public virtual ContentArea RelatedContentArea { get; set; }
//
// other properties
//
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.