Created
September 18, 2015 18:37
-
-
Save gregwiechec/bf0fc8bccde4aa575309 to your computer and use it in GitHub Desktop.
Allow to disable preview options on specific ContentAreas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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