Commit 9938c6ed authored by Michael Seaholm's avatar Michael Seaholm

Merge branch 'feature/cos-39' of gitlab.entropy.cc:blacklight/bl-edit into release

parents 6f938d50 459dab51
......@@ -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({
......@@ -134,7 +137,7 @@ module.exports={
initialPathLoaded = true;
//do we need to select a field?
var loadedPath = data.node.key;
var loadedPath = data.node.key;
if(loadedPath && loadedPath.length < initialPath.length && loadedPath.indexOf('jcr:content') > -1){
var fieldPath = initialPath.substring(loadedPath.length + 1);
if(fieldPath){
......@@ -142,6 +145,8 @@ module.exports={
allRows.filter("[data-name='" + fieldPath + "']").click();
})(event, data);
}
} else if(loadedPath) {
onTreeClickFactory('click')(event, data);
}
}
},
......
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