Indefero

Indefero Commit Details


Date:2011-12-26 20:34:53 (13 years 4 months ago)
Author:Thomas Keller
Branch:develop, release-1.3
Commit:91dcc787964671e3e32212214fc1568393c0eb03
Parents: 5c04c87ff631662e8d55c57701c9c2a07c394618
Message:Render tags that are set on many projects larger and tags that are set on only few projects smaller.

Changes:

File differences

src/IDF/Forge.php
6060
6161
6262
63
64
65
66
67
6368
6469
6570
6671
6772
6873
74
6975
7076
7177
            'order' => 'class ASC, lcname ASC'
        ));
        $maxProjectCount = 0;
        foreach ($tagList as $tag) {
            $maxProjectCount = max($maxProjectCount, $tag->project_count);
        }
        $tags = array();
        foreach ($tagList as $tag) {
            // group by class
            if (!array_key_exists($tag->class, $tags)) {
                $tags[$tag->class] = array();
            }
            $tag->rel_project_count = $tag->project_count / (double) $maxProjectCount;
            $tags[$tag->class][] = $tag;
        }
        return $tags;
src/IDF/templates/idf/listProjects.html
1919
2020
2121
22
22
23
24
25
26
27
2328
2429
2530
    <dl class="tagscloud smaller">{foreach $projectLabels as $class => $labels}
        <dt class="label">{$class}</dt>
        {foreach $labels as $idx => $label}
            <dd><a href="{url 'IDF_Views::listProjectsByLabel', array($label->id, $order)}" class="label" title="{blocktrans $label.project_count}1 project{plural}{$label.project_count} projects{/blocktrans}">{$label.name}{if $idx != count($labels) - 1},{/if}</a></dd>
            {* 0.75 - or 75% - is the minimum font size we'd like to see in this tag cloud *}
            {assign $fontScale = round($label.rel_project_count * 100) + 75}
            <dd><a href="{url 'IDF_Views::listProjectsByLabel', array($label->id, $order)}"
                   class="label"
                   title="{blocktrans $label.project_count}1 project{plural}{$label.project_count} projects{/blocktrans}"
                   style="font-size: {$fontScale}%">{$label.name}{if $idx != count($labels) - 1},{/if}</a></dd>
        {/foreach}
    {/foreach}</dl>
    {if $tag}

Archive Download the corresponding diff file

Page rendered in 0.17770s using 13 queries.