Skip to content

Commit

Permalink
CRM-20621 - Initial cleanup toward performance improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
colemanw committed Jun 4, 2018
1 parent 26bd959 commit deab9b8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
38 changes: 19 additions & 19 deletions CRM/Admin/Page/AJAX.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,37 +340,37 @@ public static function getTagTree() {
}
}
else {
$style = '';
if ($dao->color) {
$style = "background-color: {$dao->color}; color: " . CRM_Utils_Color::getContrast($dao->color);
}
$hasChildTags = empty($childTagIDs[$dao->id]) ? FALSE : TRUE;
$usedFor = (array) explode(',', $dao->used_for);
$result[] = array(
$tag = [
'id' => $dao->id,
'text' => $dao->name,
'icon' => FALSE,
'li_attr' => array(
'title' => ((string) $dao->description) . ($dao->is_reserved ? ' (*' . ts('Reserved') . ')' : ''),
'class' => $dao->is_reserved ? 'is-reserved' : '',
),
'a_attr' => array(
'style' => $style,
'a_attr' => [
'class' => 'crm-tag-item',
),
],
'children' => $hasChildTags,
'data' => array(
'data' => [
'description' => (string) $dao->description,
'is_selectable' => (bool) $dao->is_selectable,
'is_reserved' => (bool) $dao->is_reserved,
'used_for' => $usedFor,
'color' => $dao->color ? $dao->color : '#ffffff',
'usages' => civicrm_api3('EntityTag', 'getcount', array(
'entity_table' => array('IN' => $usedFor),
'usages' => civicrm_api3('EntityTag', 'getcount', [
'entity_table' => ['IN' => $usedFor],
'tag_id' => $dao->id,
)),
),
);
]),
],
];
if ($dao->description || $dao->is_reserved) {
$tag['li_attr']['title'] = ((string) $dao->description) . ($dao->is_reserved ? ' (*' . ts('Reserved') . ')' : '');
}
if ($dao->is_reserved) {
$tag['li_attr']['class'] = 'is_reserved';
}
if ($dao->color) {
$tag['a_attr']['style'] = "background-color: {$dao->color}; color: " . CRM_Utils_Color::getContrast($dao->color);
}
$result[] = $tag;
}
}

Expand Down
1 change: 1 addition & 0 deletions templates/CRM/Tag/Page/Tag.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@
return {parent_id: node.id === '#' ? tagset : node.id};
}
},
themes: {icons: false},
check_callback: true
},
'search': {
Expand Down

0 comments on commit deab9b8

Please sign in to comment.