Commit 5830f08e authored by Robert Lyon's avatar Robert Lyon

Bug 1825611: Don't show tag count beside tag on file list page

Allow choice for showing the tag count

behatnotneeded

Change-Id: Ic54ba03c5f52da4ca0c4c791b0bb1a217193ad4c
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 92e9c147
......@@ -42,7 +42,7 @@ while ($more && count($tmptag) < $tagsperpage) {
}
$tmptag[] = (object) array('id' => $tag->tag,
'text' => display_tag($tag->tag, $tags['tags'])
'text' => display_tag($tag->tag, $tags['tags'], true)
);
}
$page++;
......
......@@ -78,7 +78,7 @@ function translate_tags_to_names(array $ids) {
$tagname = remove_prefix($id);
if (isset($alltags['tags'][$tagname])) {
$results[] = (object) array('id' => $tagname, 'text' => display_tag($tagname, $alltags['tags']));
$results[] = (object) array('id' => $tagname, 'text' => display_tag($tagname, $alltags['tags'], true));
}
else {
$results[] = (object) array('id' => $tagname, 'text' => $tagname);
......@@ -91,16 +91,23 @@ function translate_tags_to_names(array $ids) {
* Display formatted tag
* Currently is tag name plus the usage count
*
* @param string $name Tag name
* @param string $alltags Array of tags to get the information from
* @param string $name Tag name
* @param string $alltags Array of tags to get the information from
* @param boolean $showcount Whether or not to add the tag count to output
* @return $tag Formatted tag
*/
function display_tag($name, $alltags) {
function display_tag($name, $alltags, $showcount = false) {
if ($alltags[$name]->prefix && !empty($alltags[$name]->prefix)) {
$prefix = $alltags[$name]->prefix;
return $prefix . ': '. $alltags[$name]->tag . ' (' . $alltags[$name]->count . ')';
$tag = $prefix . ': '. $alltags[$name]->tag;
}
return $alltags[$name]->tag . ' (' . $alltags[$name]->count . ')';
else {
$tag = $alltags[$name]->tag;
}
if ($showcount) {
$tag .= ' (' . $alltags[$name]->count . ')';
}
return $tag;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment