Skip to content

Commit

Permalink
Merge pull request civicrm#11469 from colemanw/CRM-21614
Browse files Browse the repository at this point in the history
CRM-21614 - Tag UI doesn't appear to respect reserved tags permission
  • Loading branch information
monishdeb authored and sluc23 committed Jan 10, 2018
2 parents 4a6283b + 45a6998 commit 9ee9588
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions templates/CRM/Tag/Page/Tag.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,16 @@
});
}

function isDraggable(nodes, event) {
var draggable = true;
_.each(nodes, function(node) {
if (node.data.is_reserved && !CRM.checkPerm('administer reserved tags')) {
draggable = false;
}
});
return draggable;
}

$panel
.append('<div class="tag-tree-wrapper"><div class="tag-tree"></div><div class="tag-info"></div></div>')
.on('change', 'input[type=color]', changeColor)
Expand Down Expand Up @@ -283,6 +293,7 @@
},
plugins: plugins,
dnd: {
is_draggable: isDraggable,
copy: false
}
});
Expand Down Expand Up @@ -393,6 +404,14 @@
li.is-reserved > a:after {
content: ' *';
}
{/literal}{if !call_user_func(array('CRM_Core_Permission', 'check'), 'administer reserved tags')}{literal}
#tree li.is-reserved > a.crm-tag-item {
cursor: not-allowed;
}
li.is-reserved > a:after {
color: #8A1F11;
}
{/literal}{/if}{literal}
.tag-tree-wrapper ul {
margin: 0;
padding: 0;
Expand Down

0 comments on commit 9ee9588

Please sign in to comment.