Skip to content

Commit

Permalink
CRM-21499 - Add clear button to search form and cleanup/bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
colemanw authored and sluc23 committed Jan 10, 2018
1 parent 524ef7d commit a5aae84
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions templates/CRM/Tag/Page/Tag.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
{ts}Organize the tag hierarchy by clicking and dragging. Shift-click to select multiple tags to merge/move/delete.{/ts}
</div>
<input class="crm-form-text big" name="filter_tag_tree" placeholder="{ts}Filter List{/ts}" allowclear="1"/>
<a class="crm-hover-button crm-clear-link" style="visibility:hidden;" title="{ts}Clear{/ts}"><i class="crm-i fa-times"></i></a>
</div>
{foreach from=$tagsets item=set}
<div id="tagset-{$set.id}">
Expand All @@ -77,7 +78,7 @@
noneSelectedTpl = _.template($('#noneSelectedTpl').html()),
oneSelectedTpl = _.template($('#oneSelectedTpl').html()),
moreSelectedTpl = _.template($('#moreSelectedTpl').html()),
tagsetHelpTpl = _.template($('#tagsetHelpTpl').html());
tagsetHeaderTpl = _.template($('#tagsetHeaderTpl').html());

function formatTagSet(info) {
info.date = CRM.utils.formatDate(info.created_date);
Expand Down Expand Up @@ -183,20 +184,20 @@
tagSets[tagset].used_for = info.used_for;
tagSets[tagset].is_reserved = info.is_reserved;
formatTagSet(tagSets[tagset]);
$('.help', $panel).remove();
addHelp();
addTagsetHeader();
$(".tag-tree", $panel).jstree("search", '');
}

function addHelp() {
$panel.prepend(tagsetHelpTpl(tagSets[tagset]));
function addTagsetHeader() {
$('.tagset-header', $panel).remove();
$panel.prepend(tagsetHeaderTpl(tagSets[tagset]));
$("a[href='#tagset-" + tagset + "']").text(tagSets[tagset].name)
.parent().toggleClass('is-reserved', tagSets[tagset].is_reserved == 1)
.attr('title', ts('{/literal}{ts escape='js' 1='%1'}Tag Set for %1{/ts}{literal}', {'1': tagSets[tagset].used_for_label.join(', ')}));
}

if (tagset) {
addHelp();
$panel.append('<input class="crm-form-text big" name="filter_tag_tree" placeholder="' + ts('Filter List') + '" allowclear="1"/>');
addTagsetHeader();
}

function moveTagDialog(e) {
Expand Down Expand Up @@ -531,11 +532,15 @@
</div>
</script>

<script type="text/template" id="tagsetHelpTpl">
<div class="help">
<% if(is_reserved == 1) {ldelim} %><strong>{ts}Reserved{/ts}</strong><% {rdelim} %>
<% if(undefined === display_name) {ldelim} var display_name = null; {rdelim} %>
{ts 1="<%= used_for_label.join(', ') %>" 2="<%= date %>" 3="<%= display_name %>"}Tag Set for %1 (created %2 by %3).{/ts}
<% if(typeof description === 'string' && description.length) {ldelim} %><p><em><%- description %></em></p><% {rdelim} %>
<script type="text/template" id="tagsetHeaderTpl">
<div class="tagset-header">
<div class="help">
<% if(is_reserved == 1) {ldelim} %><strong>{ts}Reserved{/ts}</strong><% {rdelim} %>
<% if(undefined === display_name) {ldelim} var display_name = null; {rdelim} %>
{ts 1="<%= used_for_label.join(', ') %>" 2="<%= date %>" 3="<%= display_name %>"}Tag Set for %1 (created %2 by %3).{/ts}
<% if(typeof description === 'string' && description.length) {ldelim} %><p><em><%- description %></em></p><% {rdelim} %>
</div>
<input class="crm-form-text big" name="filter_tag_tree" placeholder="{ts}Filter List{/ts}" allowclear="1"/>
<a class="crm-hover-button crm-clear-link" style="visibility:hidden;" title="{ts}Clear{/ts}"><i class="crm-i fa-times"></i></a>
</div>
</script>

0 comments on commit a5aae84

Please sign in to comment.