Commit 65b0662c authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Shorten long tag names for display; don't wrap tags with spaces in them


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent f93e95aa
......@@ -39,7 +39,7 @@ $owner = (object) array('type' => 'user', 'id' => $USER->get('id'));
$data = get_portfolio_items_by_tag($tag, $owner, $limit, $offset, $sort, $type);
build_portfolio_search_html($data);
$data->tagdisplay = hsc($tag);
$data->tagdisplay = hsc(str_shorten_text($tag, 50));
json_reply(false, array('data' => $data));
?>
......@@ -30,7 +30,7 @@ function smarty_function_list_tags($params, &$smarty) {
}
foreach ($params['tags'] as &$t) {
$t = '<a class="tag" href="' . get_config('wwwroot') . 'tags.php?tag=' . urlencode($t) . '">' . hsc($t) . '</a>';
$t = '<a class="tag" href="' . get_config('wwwroot') . 'tags.php?tag=' . urlencode($t) . '">' . hsc(str_shorten_text($t, 50)) . '</a>';
}
return join(', ', $params['tags']);
}
......
......@@ -85,7 +85,12 @@ function rewriteTagSortLink(elem) {
var params = parseQueryString(href.substring(href.indexOf('?')+1, href.length));
var elems = getElementsByTagAndClassName('a', 'tag', mytags_container);
elems.sort(sort_functions[params.ts]);
replaceChildNodes(mytags_container, elems);
// FF needs spaces in between each element for wrapping
replaceChildNodes(mytags_container, []);
forEach(elems, function (a) {
appendChildNodes(mytags_container, a, ' ');
});
forEach(getElementsByTagAndClassName('a', 'current-tab'), function(selected) {
removeElementClass(selected, 'current-tab');
......
......@@ -828,23 +828,30 @@ div.sideblock #friendscontrol label {
font-size: 1em;
}
/* Tags */
.mytags {
padding: .5em 0;
}
a.tag {
text-decoration: none;
}
.mytags a.tag {
padding: 0 5px;
white-space: nowrap;
}
.sidebar-content.tags {
text-align: center;
padding: 0;
}
.mytags {
padding: .5em 0;
}
.sidebar-content.tags .tag,
.mytags .tag {
.sidebar-content.tags .tag {
padding: 0 5px;
vertical-align: middle;
}
/* .tag-sort.selected, */
.tag-results .selected,
.mytags .selected {
color: #444;
font-weight: bold;
text-decoration: none;
}
.mytags .tagfreq {
font-weight: normal;
......
......@@ -5,11 +5,7 @@
<div><strong><a href="{$result->url}">{$result->title|escape}</a></strong></div>
<div>{$result->description|str_shorten_html:100}</div>
{if !empty($result->tags)}
<div>{str tag=tags}:
{foreach from=$result->tags item=tag name=ftags}
<a class="tag" href="{$WWWROOT}tags.php?tag={$tag|urlencode}">{$tag|escape}</a>{if !$smarty.foreach.ftags.last},{/if}
{/foreach}
</div>
<div>{str tag=tags}: {list_tags tags=$result->tags owner=1}</div>
{/if}
</td>
<td class="right s">{$result->typestr}<div class="ctime">{$result->ctime}</div></td>
......
......@@ -2,7 +2,7 @@
<div class="sidebar-content tags">
{if $data.tags}
{foreach from=$data.tags item=tag}
<a class="tag" style="font-size: {$tag->size}em;" href="{$WWWROOT}tags.php?tag={$tag->tag|urlencode}" title="{str tag=numitems arg1=$tag->count}">{$tag->tag|escape}</a>
<a class="tag" style="font-size: {$tag->size}em;" href="{$WWWROOT}tags.php?tag={$tag->tag|urlencode}" title="{str tag=numitems arg1=$tag->count}">{$tag->tag|str_shorten_text:20|escape}</a>
{/foreach}
{else}
{str tag=youhavenottaggedanythingyet}
......
......@@ -8,7 +8,7 @@
</ul>
<div class="subpage mytags">
{foreach from=$tags item=t}
<a id="tag:{$t->tag}" class="tag{if $t->tag == $tag} selected{/if}" href="{$WWWROOT}tags.php?tag={$t->tag|urlencode}">{$t->tag|escape}&nbsp;<span class="tagfreq">({$t->count})</span></a>
<a id="tag:{$t->tag}" class="tag{if $t->tag == $tag} selected{/if}" href="{$WWWROOT}tags.php?tag={$t->tag|urlencode}">{$t->tag|str_shorten_text:30|escape}&nbsp;<span class="tagfreq">({$t->count})</span></a>
{/foreach}
</div>
{else}
......@@ -16,7 +16,7 @@
{/if}
<div id="results_container" class="tag-results{if !$tag} hidden{/if}">
<h2 id="results_heading">{str tag=searchresultsfor} <a class="tag" href="{$WWWROOT}tags.php?tag={$tag|urlencode}">{$tag|escape}</a></h4>
<h2 id="results_heading">{str tag=searchresultsfor} <a class="tag" href="{$WWWROOT}tags.php?tag={$tag|urlencode}">{$tag|str_shorten_text:50|escape}</a></h4>
<div id="results_sort">{str tag=sortresultsby}
{foreach from=$results->sortcols item=sortfield name=sortcols}
<a href="{$results->baseurl}&type={$results->filter}&sort={$sortfield}"{if $results->sort == $sortfield} class="selected"{/if}>{str tag=$sortfield}</a>{if !$smarty.foreach.sortcols.last} | {/if}
......
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