Improved the style for the labels in the context column.
This commit is contained in:
parent
3b5251c1b4
commit
a8699db268
@ -263,22 +263,33 @@ class IDF_Project extends Pluf_Model
|
||||
*
|
||||
* Return an array of tags sorted class, then name. Each tag get
|
||||
* the extra property 'nb_use' for the number of use in the
|
||||
* project. Only open issues are used to generate the cloud.
|
||||
* project. For issues, only open issues are used to generate the
|
||||
* cloud.
|
||||
*
|
||||
* @param string ('issues') or 'downloads'
|
||||
* @return ArrayObject of IDF_Tag
|
||||
*/
|
||||
public function getTagCloud()
|
||||
public function getTagCloud($what='issues')
|
||||
{
|
||||
$tag_t = Pluf::factory('IDF_Tag')->getSqlTable();
|
||||
$issue_t = Pluf::factory('IDF_Issue')->getSqlTable();
|
||||
$asso_t = $this->_con->pfx.'idf_issue_idf_tag_assoc';
|
||||
$ostatus = $this->getTagIdsByStatus('open');
|
||||
if (count($ostatus) == 0) $ostatus[] = 0;
|
||||
$sql = sprintf('SELECT '.$tag_t.'.id AS id, COUNT(*) AS nb_use FROM '.$tag_t.' '."\n".
|
||||
if ($what == 'issues') {
|
||||
$what_t = Pluf::factory('IDF_Issue')->getSqlTable();
|
||||
$asso_t = $this->_con->pfx.'idf_issue_idf_tag_assoc';
|
||||
$ostatus = $this->getTagIdsByStatus('open');
|
||||
if (count($ostatus) == 0) $ostatus[] = 0;
|
||||
$sql = sprintf('SELECT '.$tag_t.'.id AS id, COUNT(*) AS nb_use FROM '.$tag_t.' '."\n".
|
||||
'LEFT JOIN '.$asso_t.' ON idf_tag_id='.$tag_t.'.id '."\n".
|
||||
'LEFT JOIN '.$issue_t.' ON idf_issue_id='.$issue_t.'.id '."\n".
|
||||
'WHERE idf_tag_id IS NOT NULL AND '.$issue_t.'.status IN (%s) AND '.$issue_t.'.project='.$this->id.' GROUP BY '.$tag_t.'.id, '.$tag_t.'.class, '.$tag_t.'.name ORDER BY '.$tag_t.'.class ASC, '.$tag_t.'.name ASC',
|
||||
'LEFT JOIN '.$what_t.' ON idf_issue_id='.$what_t.'.id '."\n".
|
||||
'WHERE idf_tag_id IS NOT NULL AND '.$what_t.'.status IN (%s) AND '.$what_t.'.project='.$this->id.' GROUP BY '.$tag_t.'.id, '.$tag_t.'.class, '.$tag_t.'.name ORDER BY '.$tag_t.'.class ASC, '.$tag_t.'.name ASC',
|
||||
implode(', ', $ostatus));
|
||||
} else {
|
||||
$what_t = Pluf::factory('IDF_Upload')->getSqlTable();
|
||||
$asso_t = $this->_con->pfx.'idf_tag_idf_upload_assoc';
|
||||
$sql = 'SELECT '.$tag_t.'.id AS id, COUNT(*) AS nb_use FROM '.$tag_t.' '."\n".
|
||||
'LEFT JOIN '.$asso_t.' ON idf_tag_id='.$tag_t.'.id '."\n".
|
||||
'LEFT JOIN '.$what_t.' ON idf_upload_id='.$what_t.'.id '."\n".
|
||||
'WHERE idf_tag_id IS NOT NULL AND '.$what_t.'.project='.$this->id.' GROUP BY '.$tag_t.'.id, '.$tag_t.'.class, '.$tag_t.'.name ORDER BY '.$tag_t.'.class ASC, '.$tag_t.'.name ASC';
|
||||
}
|
||||
$tags = array();
|
||||
foreach ($this->_con->select($sql) as $idc) {
|
||||
$tag = new IDF_Tag($idc['id']);
|
||||
|
@ -63,10 +63,12 @@ class IDF_Views_Download
|
||||
$pag->no_results_text = __('No downloads were found.');
|
||||
$pag->sort_order = array('file', 'ASC');
|
||||
$pag->setFromRequest($request);
|
||||
$tags = $prj->getTagCloud('downloads');
|
||||
return Pluf_Shortcuts_RenderToResponse('downloads/index.html',
|
||||
array('project' => $prj,
|
||||
array(
|
||||
'page_title' => $title,
|
||||
'downloads' => $pag,
|
||||
'tags' => $tags,
|
||||
),
|
||||
$request);
|
||||
|
||||
@ -219,11 +221,13 @@ class IDF_Views_Download
|
||||
$pag->no_results_text = __('No downloads were found.');
|
||||
$pag->sort_order = array('file', 'ASC');
|
||||
$pag->setFromRequest($request);
|
||||
$tags = $prj->getTagCloud('downloads');
|
||||
return Pluf_Shortcuts_RenderToResponse('downloads/index.html',
|
||||
array(
|
||||
'page_title' => $title,
|
||||
'label' => $tag,
|
||||
'downloads' => $pag,
|
||||
'tags' => $tags,
|
||||
),
|
||||
$request);
|
||||
}
|
||||
|
@ -9,5 +9,11 @@
|
||||
{/block}
|
||||
{block context}
|
||||
<p><strong>{trans 'Number of files:'}</strong> {$downloads.nb_items}</p>
|
||||
{assign $class = ''}{assign $i = 0}
|
||||
<p class="smaller">{foreach $tags as $label}
|
||||
{aurl 'url', 'IDF_Views_Download::listLabel', array($project.shortname, $label.id)}
|
||||
{if $class != $label.class}{if $i != 0}<br />{/if}<strong class="label">{$label.class}:</strong> {/if}
|
||||
<a href="{$url}" class="label">{$label.name}</a>,{assign $i = $i + 1}{assign $class = $label.class}{/foreach}</p>
|
||||
|
||||
{/block}
|
||||
|
||||
|
@ -12,9 +12,9 @@
|
||||
{aurl 'closed_url', 'IDF_Views_Issue::listStatus', array($project.shortname, 'closed')}
|
||||
{blocktrans}<p><strong>Open issues:</strong> <a href="{$open_url}">{$open}</a></p>
|
||||
<p><strong>Closed issues:</strong> <a href="{$closed_url}">{$closed}</a></p>{/blocktrans}
|
||||
|
||||
{assign $class = ''}{assign $i = 0}
|
||||
<p class="smaller">{foreach $project.getTagCloud() as $label}
|
||||
{aurl 'url', 'IDF_Views_Issue::listLabel', array($project.shortname, $label.id, 'open')}
|
||||
<a href="{$url}" class="label"><strong>{$label.class}:</strong>{$label.name}</a>{/foreach}</p>
|
||||
|
||||
{if $class != $label.class}{if $i != 0}<br />{/if}<strong class="label">{$label.class}:</strong> {/if}
|
||||
<a href="{$url}" class="label">{$label.name}</a>,{assign $class = $label.class}{assign $i = $i + 1}{/foreach}</p>
|
||||
{/block}
|
||||
|
@ -188,6 +188,10 @@ a.label {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.label {
|
||||
color: #204a87;
|
||||
}
|
||||
|
||||
span.nobrk {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user