Merge pull request #890 from Lucas-C/taglist-cloud_improvments

Tagcloud/list improvments
This commit is contained in:
ArthurHoaro 2017-06-11 14:14:59 +02:00 committed by GitHub
commit d5d22a6d07
3 changed files with 19 additions and 3 deletions

View file

@ -805,6 +805,9 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history)
$tagList = array(); $tagList = array();
foreach($tags as $key => $value) { foreach($tags as $key => $value) {
if (in_array($key, $filteringTags)) {
continue;
}
// Tag font size scaling: // Tag font size scaling:
// default 15 and 30 logarithm bases affect scaling, // default 15 and 30 logarithm bases affect scaling,
// 22 and 6 are arbitrary font sizes for max and min sizes. // 22 and 6 are arbitrary font sizes for max and min sizes.
@ -829,12 +832,17 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history)
exit; exit;
} }
// -------- Tag cloud // -------- Tag list
if ($targetPage == Router::$PAGE_TAGLIST) if ($targetPage == Router::$PAGE_TAGLIST)
{ {
$visibility = ! empty($_SESSION['privateonly']) ? 'private' : 'all'; $visibility = ! empty($_SESSION['privateonly']) ? 'private' : 'all';
$filteringTags = isset($_GET['searchtags']) ? explode(' ', $_GET['searchtags']) : []; $filteringTags = isset($_GET['searchtags']) ? explode(' ', $_GET['searchtags']) : [];
$tags = $LINKSDB->linksCountPerTag($filteringTags, $visibility); $tags = $LINKSDB->linksCountPerTag($filteringTags, $visibility);
foreach ($filteringTags as $tag) {
if (array_key_exists($tag, $tags)) {
unset($tags[$tag]);
}
}
if (! empty($_GET['sort']) && $_GET['sort'] === 'alpha') { if (! empty($_GET['sort']) && $_GET['sort'] === 'alpha') {
alphabetical_sort($tags, false, true); alphabetical_sort($tags, false, true);

View file

@ -13,6 +13,11 @@
<div class="pure-u-lg-2-3 pure-u-22-24 page-form page-visitor"> <div class="pure-u-lg-2-3 pure-u-22-24 page-form page-visitor">
{$countTags=count($tags)} {$countTags=count($tags)}
<h2 class="window-title">{'Tag cloud'|t} - {$countTags} {'tags'|t}</h2> <h2 class="window-title">{'Tag cloud'|t} - {$countTags} {'tags'|t}</h2>
{if="!empty($search_tags)"}
<p class="enter">
<a href="?searchtags={$search_tags|urlencode}">{'List all links with those tags'|t}</a>
</p>
{/if}
<div id="search-tagcloud" class="pure-g"> <div id="search-tagcloud" class="pure-g">
<div class="pure-u-lg-1-4"></div> <div class="pure-u-lg-1-4"></div>
@ -40,7 +45,7 @@ <h2 class="window-title">{'Tag cloud'|t} - {$countTags} {'tags'|t}</h2>
<div id="cloudtag"> <div id="cloudtag">
{loop="tags"} {loop="tags"}
<a href="?searchtags={$key|urlencode}" style="font-size:{$value.size}em;">{$key}</a <a href="?searchtags={$key|urlencode} {$search_tags|urlencode}" style="font-size:{$value.size}em;">{$key}</a
><a href="?addtag={$key|urlencode}" title="{'Filter by tag'|t}" class="count">{$value.count}</a> ><a href="?addtag={$key|urlencode}" title="{'Filter by tag'|t}" class="count">{$value.count}</a>
{loop="$value.tag_plugin"} {loop="$value.tag_plugin"}
{$value} {$value}

View file

@ -13,6 +13,9 @@
<div class="pure-u-lg-2-3 pure-u-22-24 page-form page-visitor"> <div class="pure-u-lg-2-3 pure-u-22-24 page-form page-visitor">
{$countTags=count($tags)} {$countTags=count($tags)}
<h2 class="window-title">{'Tag list'|t} - {$countTags} {'tags'|t}</h2> <h2 class="window-title">{'Tag list'|t} - {$countTags} {'tags'|t}</h2>
<p style="text-align: center">
<a href="?searchtags={$search_tags|urlencode}">{'List all links with those tags'|t}</a>
</p>
<div id="search-tagcloud" class="pure-g"> <div id="search-tagcloud" class="pure-g">
<div class="pure-u-lg-1-4"></div> <div class="pure-u-lg-1-4"></div>
@ -50,7 +53,7 @@ <h2 class="window-title">{'Tag list'|t} - {$countTags} {'tags'|t}</h2>
{/if} {/if}
<a href="?addtag={$key|urlencode}" title="{'Filter by tag'|t}" class="count">{$value}</a> <a href="?addtag={$key|urlencode}" title="{'Filter by tag'|t}" class="count">{$value}</a>
<a href="?searchtags={$key|urlencode}" class="tag-link">{$key}</a> <a href="?searchtags={$key|urlencode} {$search_tags|urlencode}" class="tag-link">{$key}</a>
{loop="$value.tag_plugin"} {loop="$value.tag_plugin"}
{$value} {$value}