{* this template is used for adding/editing tags *}
{literal}
<style>
- #tagtree .highlighted > label {
- background-color: #FEFD7B;
+ #tagtree .highlighted > span {
+ background-color: #fefca6;
}
#tagtree .helpicon ins {
display: none;
{literal}
CRM.updateContactSummaryTags = function() {
var tags = [];
- $('#tagtree input:checkbox:checked+label').each(function() {
+ $('#tagtree input:checkbox:checked+span label').each(function() {
tags.push($(this).text());
});
$('input.crm-contact-tagset').each(function() {
};
$(function() {
- $("#tagtree ul input:checked").each (function(){
- $(this).closest("li").addClass('highlighted');
- });
+ function highlightSelected() {
+ $("ul input:not(:checked)", '#tagtree').each(function () {
+ $(this).closest("li").removeClass('highlighted');
+ });
+ $("ul input:checked", '#tagtree').each(function () {
+ $(this).parents("li[id^=tag]").addClass('highlighted');
+ });
+ }
+ highlightSelected();
$("#tagtree input").change(function(){
var tagid = this.id.replace("check_", "");
var op = (this.checked) ? 'create' : 'delete';
var api = CRM.api3('entity_tag', op, {entity_table: entityTable, entity_id: entityID, tag_id: tagid}, true);
- $(this).closest("li").toggleClass('highlighted');
+ highlightSelected();
CRM.updateContactSummaryTags();
});
<div id="Tag" class="view-content">
<h3>{if !$hideContext}{ts}Tags{/ts}{/if}</h3>
<div id="tagtree">
- {include file="CRM/Tag/Form/Tagtree.tpl"}
+ {include file="CRM/Tag/Form/Tagtree.tpl" level=1}
</div>
<br />
{include file="CRM/common/Tagset.tpl"}
+--------------------------------------------------------------------+
*}
{* This tpl runs recursively to build each level of the tag tree *}
-<ul>
+<ul class="tree-level-{$level}">
{foreach from=$tree item="node" key="id"}
<li id="tag_{$id}">
<input name="tagList[{$id}]" id="check_{$id}" type="checkbox" {if $tagged[$id]}checked="checked"{/if}/>
- <label for="check_{$id}" id="tagLabel_{$id}">
- {$node.name}
+ <span>
+ <label for="check_{$id}" id="tagLabel_{$id}">{$node.name}</label>
{if $node.description}{help id=$id title=$node.name file="CRM/Tag/Form/Tagtree"}{/if}
- </label>
+ </span>
{if $node.children}
{* Recurse... *}
- {include file="CRM/Tag/Form/Tagtree.tpl" tree=$node.children}
+ {include file="CRM/Tag/Form/Tagtree.tpl" tree=$node.children level=$level+1}
{/if}
</li>
{/foreach}