Skip to content

Instantly share code, notes, and snippets.

@gregwiechec
Created June 1, 2015 09:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregwiechec/7cef25c6364860e4b3c9 to your computer and use it in GitHub Desktop.
Save gregwiechec/7cef25c6364860e4b3c9 to your computer and use it in GitHub Desktop.
Related contents tool
define([
"dojo",
"dojo/_base/declare",
"epi/_Module",
"epi/dependency",
"epi/routes",
"commands/samples/relatedPagesCommandProvider"
], function(
dojo,
declare,
_Module,
dependency,
routes,
RelatedPagesCommandProvider
) {
return declare([_Module], {
initialize: function() {
this.inherited(arguments);
var relatedPagesCommandProvider = new RelatedPagesCommandProvider();
var commandregistry = dependency.resolve("epi.globalcommandregistry");
var area = "epi.cms.publishmenu";
commandregistry.registerProvider(area, relatedPagesCommandProvider);
}
});
});
<?xml version="1.0" encoding="utf-8"?>
<module>
<clientResources>
<add dependency="epi-cms.widgets.base" path="Scripts/samples/commandsInitializer.js" resourceType="Script" />
</clientResources>
<clientModule initializer="commands.samples.commandsInitializer">
<moduleDependencies>
<add dependency="CMS" type="RunAfter" />
</moduleDependencies>
</clientModule>
<dojo>
<paths>
<add name="commands" path="Scripts" />
</paths>
</dojo>
</module>
define([
"dojo",
"dojo/_base/declare",
"epi/shell/command/_CommandProviderMixin",
"commands/samples/showRelatedPagesCommand"
], function (dojo, declare, _CommandProviderMixin, ShowRelatedPagesCommand) {
return declare([_CommandProviderMixin], {
constructor: function () {
this.inherited(arguments);
var showRelatedPagesCommand = new ShowRelatedPagesCommand();
this.add("commands", showRelatedPagesCommand);
}
});
});
define([
"dojo/_base/declare",
"epi/shell/command/_Command",
"epi-cms/widget/ContentReferences",
"epi/shell/widget/dialog/Dialog",
"epi/shell/TypeDescriptorManager",
"epi/i18n!epi/cms/nls/episerver.cms.widget.contentreferences"
],
function(
declare,
_Command,
ContentReferences,
Dialog,
TypeDescriptorManager) {
return declare([_Command], {
name: "ContentReferences",
label: "Content references",
tooltip: "Show content references",
iconClass: "epi-iconReferences",
canExecute: true,
_execute: function() {
var content = new ContentReferences({
model: {
contentData: this.model.contentData,
mode: "show",
}
});
content.startup();
var dialog = new Dialog({
defaultActionsVisible: false,
focusActionsOnLoad: true,
destroyOnHide: true,
dialogClass: "epi-dialog-contentReferences",
title: TypeDescriptorManager.getResourceValue(this.model.contentData.typeIdentifier, "references"),
content: content
});
dialog.definitionConsumer.add({
name: "close",
label: epi.resources.action.close,
action: dialog.onCancel
});
dialog.show();
var handle = content.on("viewReference", function() {
dialog.hide();
handle.remove();
});
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment