Commit 04bb1efe authored by Tim Rogers's avatar Tim Rogers

COS-39 updated reference widget to accept initialPath option

parent 96caa295
......@@ -11,20 +11,23 @@ module.exports={
if(_.isFunction(root)){
root = root($el, utils);
}
var initialPath = utils.widget.initialPath;
if(_.isFunction(initialPath)) {
initialPath = initialPath($el, utils);
}
if(!root){
//get the default root
var moduleRootKey = (_.get($,"page.resourceType") || "").split("/").slice(0,2).join(".") + ".defaultReferenceRoot";
var defaultReferenceKey = window.BL.config.defaultModule + ".defaultReferenceRoot";
root = _.get(window.BL.modules, moduleRootKey) || _.get(window.BL.modules, defaultReferenceKey) || "/content/" + window.BL.config.defaultModule.split('.')[0] + '/collections';
console.log('root', root);
}
var $targetInput=$el.find("input");
$targetInput.on("click", function(ev){
var initialPath = $targetInput.val() || root;
initialPath = $targetInput.val() || initialPath || root;
//open two panel dialog
var $dialog = dialogBuilder({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment