CRM-19943 - Add deselect button
authorColeman Watts <coleman@civicrm.org>
Mon, 6 Feb 2017 18:03:02 +0000 (13:03 -0500)
committerColeman Watts <coleman@civicrm.org>
Mon, 6 Feb 2017 18:15:24 +0000 (13:15 -0500)
templates/CRM/Tag/Page/Tag.tpl

index 374fbb889560ef29f83f0f4baff3d60c8e6a1a9f..2a522df4c54402ec503cb08d90bc308dde6e3dac 100644 (file)
           $infoBox.trigger('crmLoad');
         }
 
+        function clearSelection(e) {
+          e.preventDefault();
+          $('.tag-tree', $panel).jstree(true).deselect_all();
+        }
+
         function changeUsedFor() {
           var vals = $('input[name=used_for]:checked', $panel).map(function(i, el) {
             return $(el).val();
           .append('<div class="tag-tree-wrapper"><div class="tag-tree"></div><div class="tag-info"></div></div>')
           .on('change', 'input[type=color]', changeColor)
           .on('change', 'input[name=used_for]', changeUsedFor)
+          .on('click', '.clear-tag-selection', clearSelection)
           .on('click', '.used-for-toggle', function() {
             $(this).attr('style', 'display: none !important;').next().show();
           })
     box-sizing: border-box;
     background: white;
   }
+  div.tag-info .clear-tag-selection {
+    position: absolute;
+    top: 10px;
+    right: 12px;
+    color: inherit;
+    opacity: .5;
+  }
+  div.tag-info .clear-tag-selection:hover,
+  div.tag-info .clear-tag-selection:active {
+    opacity: 1;
+  }
   .tag-tree-wrapper .tag-tree a.crm-tag-item {
     border-radius: 3px;
     margin: 2px 0;
   div.tag-info .crm-editable-enabled[data-field=description] {
     min-width: 60%;
   }
+  div.tag-info input[type=color] {
+    cursor: pointer;
+  }
   div.tag-info .tdl {
     font-weight: bold;
     color: #999;
       </div>
     <% {rdelim} %>
     <div><span class="tdl">{ts}Usage Count:{/ts}</span> <%= data.usages %></div>
+    <a class="clear-tag-selection" href="#" title="{ts}Clear selection{/ts}"><i class="crm-i fa-ban"></i></a>
   </div>
   <div class="crm-submit-buttons">
     <% if(!tagset) {ldelim} %>
       <p>* {ts 1="<%= reserved %>"}%1 reserved.{/ts}</p>
     <% {rdelim} %>
   <p><span class="tdl">{ts}Total Usage:{/ts}</span> <%= usages %></p>
+  <a class="clear-tag-selection" href="#" title="{ts}Clear selection{/ts}"><i class="crm-i fa-ban"></i></a>
   <div class="crm-submit-buttons">
     <a href="{crmURL p="civicrm/tag/merge" q="id="}<%= items.join() %>" class="button crm-popup small-popup" title="{ts}Combine tags into one{/ts}">
       <span><i class="crm-i fa-compress"></i>&nbsp; {ts}Merge Tags{/ts}</span>