app/assets/javascripts/iqvoc/treeview.js in iqvoc-4.5.1 vs app/assets/javascripts/iqvoc/treeview.js in iqvoc-4.5.2
- old
+ new
@@ -23,10 +23,11 @@
var item = $(this);
return {
label: item.children('a').html(),
load_on_demand: item.data('has-children'),
+ locked: item.data('locked'),
id: item.attr('id'),
url: item.children('a').attr('href'),
update_url: item.data('update-url'),
published: item.data('published'),
additionalText: item.children('span.additional_info')
@@ -59,14 +60,20 @@
}
if (dragabbleSupport) {
// mark locked items
if (typeof node.locked !== 'undefined' && node.locked) {
- link.after(' <i class="fa fa-lock"/>');
- } else {
- link.after(' <i class="fa fa-arrows"/>');
+ // add icon only to the first element of the collection.
+ // the second one could be a nodelist for parents nodes.
+ $(link[0]).after(' <i class="fa fa-lock"/>');
}
+
+ if (typeof node.locked !== 'undefined' && !node.locked) {
+ // add icon only to the first element of the collection.
+ // the second one could be a nodelist for parents nodes.
+ $(link[0]).after(' <i class="fa fa-arrows"/>');
+ }
}
if(node.moved) {
$li.data('node-id', node.id);
$li.data('old-parent-node-id', node.old_parent_id);
@@ -75,10 +82,13 @@
$li.data('update-url', node.update_url);
var saveButton = $('<button type="button" class="btn btn-primary btn-xs node-btn" data-tree-action="move"><i class="fa fa-save"></i> ' + saveLabel + '</button>');
var copyButton = $('<button type="button" class="btn btn-primary btn-xs node-btn" data-tree-action="copy"><i class="fa fa-copy"></i> ' + copyLabel + '</button>');
var undoButton = $('<button type="button" class="btn btn-primary btn-xs reset-node-btn"><i class="fa fa-undo"></i> ' + undoLabel + '</button>');
- link.after(saveButton, undoButton);
+
+ // add icon only to the first element of the collection.
+ // the second one could be a nodelist for parents nodes.
+ $(link[0]).after(saveButton, undoButton);
if(polyhierarchySupport) {
saveButton.after(copyButton);
}
}