Skip to content

Instantly share code, notes, and snippets.

@MattisOlsson
Last active September 9, 2019 11:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MattisOlsson/b25298f7c501183fb51e535da4f6a7ee to your computer and use it in GitHub Desktop.
Save MattisOlsson/b25298f7c501183fb51e535da4f6a7ee to your computer and use it in GitHub Desktop.
ContentSelectorWithIcons
define([
'dojo/_base/declare',
'dojo/_base/lang',
'epi-cms/widget/ContentSelectorDialog',
'epi-cms/widget/ContentTree',
"epi-cms/component/_ContentNavigationTreeNode"
], function(
declare,
lang,
ContentSelectorDialog,
ContentTree,
_ContentNavigationTreeNode
) {
return declare('app/widgets/ContentSelectorDialogWithIcons', [ContentSelectorDialog], {
nodeConstructor: _ContentNavigationTreeNode,
addChild: function(child) {
if (child instanceof ContentTree) {
child.nodeConstructor = this.nodeConstructor;
child._createTreeNode = function (args) {
var params = lang.mixin({}, args, {
dndData: args.item,
hasContextMenu: false
});
return this.buildNodeFromTemplate(params);
};
}
this.inherited(arguments);
}
});
});
define([
'dojo/_base/declare',
'epi-cms/widget/ContentSelector',
'app/widgets/ContentSelectorDialogWithIcons'
], function(
declare,
ContentSelector,
ContentSelectorDialogWithIcons
) {
return declare('app/widgets/ContentSelectorWithIcons', [ContentSelector], {
createDialogContent: function () {
return new ContentSelectorDialogWithIcons({
canSelectOwnerContent: this.canSelectOwnerContent,
showButtons: false,
roots: this.roots,
allowedTypes: this.allowedTypes,
restrictedTypes: this.restrictedTypes,
showAllLanguages: this.showAllLanguages,
showSearchBox: this.showSearchBox,
searchArea: this.searchArea
});
},
});
});
[EditorDescriptorRegistration(TargetType = typeof(ContentReference), EditorDescriptorBehavior = EditorDescriptorBehavior.OverrideDefault)]
public class EnhancedContentReferenceEditorDescriptor : ContentReferenceEditorDescriptor
{
public EnhancedContentReferenceEditorDescriptor()
{
ClientEditingClass = "app/widgets/ContentSelectorWithIcons";
}
protected override void SetEditorConfiguration(ExtendedMetadata metadata)
{
base.SetEditorConfiguration(metadata);
metadata.EditorConfiguration["searchArea"] = "cms/pages";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment