Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
define([
"dojo",
    'dojo/_base/declare',
    'epi-cms/plugin-area/navigation-tree',
    // Parent class
    'epi/_Module',
    // Commands
    'alloy/ReloadChildren/ReloadChildren'
], function (
   // Dojo
dojo,
declare,
    navigationTreePluginArea,
    // Parent class
    _Module,
    // Commands
    ReloadChildren
) {
 
return declare([_Module], {
 
initialize: function () {
this.inherited(arguments);
navigationTreePluginArea.add(ReloadChildren);
}
});
});
<?xml version="1.0" encoding="utf-8"?>
<module>
<assemblies>
<!--This adds the Alloy template assembly to the "default module"-->
<add assembly="EpiserverSite1" />
</assemblies>
<clientResources>
<add name="epi-cms.widgets.base" path="Styles/Styles.css" resourceType="Style"/>
</clientResources>
<dojo>
<!--Add a mapping from alloy to ~/ClientResources/Scripts to the dojo loader configuration-->
<paths>
<add name="alloy" path="Scripts" />
</paths>
</dojo>
<clientModule initializer="alloy.Initializer">
<moduleDependencies>
<add dependency="CMS" type="RunAfter" />
</moduleDependencies>
</clientModule>
</module>
define([
"dojo/topic",
"dojo/_base/declare",
"epi/dependency",
"epi/shell/command/_Command"
], function (topic, declare, dependency, _Command) {
return declare([_Command], {
label: "Reload Children",
iconClass: "epi-iconReload",
constructor: function () {
// summary:
// Constructs the object and sets up a reference to the content data store.
// tags:
// public
var registry = dependency.resolve("epi.storeregistry");
this.store = registry.get("epi.cms.contentdata");
},
_execute: function () {
// summary:
// Executes this command assuming canExecute has been checked.
// tags:
// protected
//debugger;
var model = this.model;
topic.publish("/epi/cms/contentdata/childrenchanged", this.model);
// model.isCommonDraft = true;
// return this.store.put(model);
},
_onModelChange: function () {
// summary:
// Updates canExecute after the model has been updated.
// tags:
// protected
//debugger;
//var model = this.model,
// canExecute = model && !model.isCommonDraft;
this.set("canExecute", true);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment