Added the link to the author profile when possible.
This commit is contained in:
parent
b660c6782f
commit
6c5da01319
@ -86,6 +86,7 @@ class IDF_Middleware
|
||||
'timeline' => 'IDF_Template_TimelineFragment',
|
||||
'markdown' => 'IDF_Template_Markdown',
|
||||
'showuser' => 'IDF_Template_ShowUser',
|
||||
'ashowuser' => 'IDF_Template_AssignShowUser',
|
||||
));
|
||||
$params['modifiers'] = array_merge($params['modifiers'],
|
||||
array(
|
||||
|
55
src/IDF/Template/AssignShowUser.php
Normal file
55
src/IDF/Template/AssignShowUser.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# This file is part of InDefero, an open source project management application.
|
||||
# Copyright (C) 2008 Céondo Ltd and contributors.
|
||||
#
|
||||
# InDefero is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# InDefero is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# ***** END LICENSE BLOCK ***** */
|
||||
|
||||
Pluf::loadFunction('Pluf_HTTP_URL_urlForView');
|
||||
|
||||
/**
|
||||
* Show the name of a user in a template.
|
||||
*
|
||||
* It will automatically make the link to the profile if needed. In
|
||||
* the future it will allow us to add little badges on the side of the
|
||||
* user based on karma or whatever.
|
||||
*
|
||||
* This will also provide a consistent display of a user name in the
|
||||
* application.
|
||||
*/
|
||||
class IDF_Template_AssignShowUser extends Pluf_Template_Tag
|
||||
{
|
||||
/**
|
||||
* We need the user object and the request.
|
||||
*
|
||||
* If the user object is null (for example a non associated
|
||||
* commit), we can use the $text value for an alternative display.
|
||||
*
|
||||
* @param string Which variable to assign
|
||||
* @param Pluf_User
|
||||
* @param Pluf_HTTP_Request
|
||||
* @param string Alternate text ('')
|
||||
*/
|
||||
function start($var, $user, $request, $text='')
|
||||
{
|
||||
$t = new IDF_Template_ShowUser($this->context);
|
||||
$this->context->set($var,
|
||||
Pluf_Template::markSafe($t->start($user, $request, $text, false)));
|
||||
}
|
||||
}
|
@ -53,17 +53,18 @@ class IDF_Views_Source
|
||||
return new Pluf_HTTP_Response_Redirect($url);
|
||||
}
|
||||
$changes = $scm->getChangeLog($commit, 25);
|
||||
$rchanges = array();
|
||||
// Sync with the database
|
||||
foreach ($changes as $change) {
|
||||
IDF_Commit::getOrAdd($change, $request->project);
|
||||
$rchanges[] = IDF_Commit::getOrAdd($change, $request->project);
|
||||
}
|
||||
$changes = new Pluf_Template_ContextVars($changes);
|
||||
$rchanges = new Pluf_Template_ContextVars($rchanges);
|
||||
$scmConf = $request->conf->getVal('scm', 'git');
|
||||
return Pluf_Shortcuts_RenderToResponse('idf/source/changelog.html',
|
||||
array(
|
||||
'page_title' => $title,
|
||||
'title' => $title,
|
||||
'changes' => $changes,
|
||||
'changes' => $rchanges,
|
||||
'commit' => $commit,
|
||||
'branches' => $branches,
|
||||
'scm' => $scmConf,
|
||||
@ -216,6 +217,7 @@ class IDF_Views_Source
|
||||
$title = sprintf(__('%s Commit Details'), (string) $request->project);
|
||||
$page_title = sprintf(__('%s Commit Details - %s'), (string) $request->project, $commit);
|
||||
$cobject = $scm->getCommit($commit);
|
||||
$rcommit = IDF_Commit::getOrAdd($cobject, $request->project);
|
||||
$diff = new IDF_Diff($cobject->changes);
|
||||
$diff->parse();
|
||||
$scmConf = $request->conf->getVal('scm', 'git');
|
||||
@ -228,6 +230,7 @@ class IDF_Views_Source
|
||||
'commit' => $commit,
|
||||
'branches' => $branches,
|
||||
'scm' => $scmConf,
|
||||
'rcommit' => $rcommit,
|
||||
),
|
||||
$request);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@
|
||||
{/if}
|
||||
{/block}
|
||||
{block context}
|
||||
{assign $submitter = $file.get_submitter()}
|
||||
{ashowuser 'submitter', $file.get_submitter(), $request}
|
||||
<p><strong>{trans 'Uploaded:'}</strong> <span class="nobrk">{$file.creation_dtime|dateago}</span> <span class="nobrk">{blocktrans}by {$submitter}{/blocktrans}</span></p>
|
||||
{if $file.modif_dtime != $file.creation_dtime}<p>
|
||||
<strong>{trans 'Updated:'}</strong> <span class="nobrk">{$file.modif_dtime|dateago}</span></p>{/if}
|
||||
|
@ -3,15 +3,15 @@
|
||||
{block body}
|
||||
{assign $i = 0}
|
||||
{assign $nc = $comments.count()}
|
||||
{foreach $comments as $c}
|
||||
<div class="issue-comment{if $i == 0} issue-comment-first{/if}{if $i == ($nc-1)} issue-comment-last{/if}" id="ic{$c.id}">{assign $who = $c.get_submitter()}{aurl 'whourl', 'IDF_Views_User::view', array($who.login)}<img style="float:right; position: relative;" src="http://www.gravatar.com/avatar/{$who.email|md5}.jpg?s=60&d={media}/idf/img/spacer.gif" alt=" " />
|
||||
{foreach $comments as $c}{ashowuser 'submitter', $c.get_submitter(), $request}{assign $who = $c.get_submitter()}
|
||||
<div class="issue-comment{if $i == 0} issue-comment-first{/if}{if $i == ($nc-1)} issue-comment-last{/if}" id="ic{$c.id}"><img style="float:right; position: relative;" src="http://www.gravatar.com/avatar/{$who.email|md5}.jpg?s=60&d={media}/idf/img/spacer.gif" alt=" " />
|
||||
{if $i == 0}
|
||||
<p>{blocktrans}Reported by <a href="{$whourl}">{$who}</a>, {$c.creation_dtime|date}{/blocktrans}</p>
|
||||
<p>{blocktrans}Reported by {$submitter}, {$c.creation_dtime|date}{/blocktrans}</p>
|
||||
{else}
|
||||
{aurl 'url', 'IDF_Views_Issue::view', array($project.shortname, $issue.id)}
|
||||
{assign $id = $c.id}
|
||||
{assign $url = $url~'#ic'~$c.id}
|
||||
<p>{blocktrans}Comment <a href="{$url}">{$i}</a> by <a href="{$whourl}">{$who}</a>, {$c.creation_dtime|date}{/blocktrans}</p>
|
||||
<p>{blocktrans}Comment <a href="{$url}">{$i}</a> by {$submitter}, {$c.creation_dtime|date}{/blocktrans}</p>
|
||||
{/if}
|
||||
|
||||
|
||||
@ -118,14 +118,14 @@
|
||||
{/block}
|
||||
{block context}
|
||||
<div class="issue-info">
|
||||
{assign $submitter = $issue.get_submitter()}{aurl 'url', 'IDF_Views_User::view', array($submitter.login)}
|
||||
<p><strong>{trans 'Created:'}</strong> <span class="nobrk">{$issue.creation_dtime|dateago}</span> <span class="nobrk">{blocktrans}by <a href="{$url}">{$submitter}</a>{/blocktrans}</span></p>
|
||||
{ashowuser 'submitter', $issue.get_submitter(), $request}
|
||||
<p><strong>{trans 'Created:'}</strong> <span class="nobrk">{$issue.creation_dtime|dateago}</span> <span class="nobrk">{blocktrans}by {$submitter}{/blocktrans}</span></p>
|
||||
{if $issue.modif_dtime != $issue.creation_dtime}<p>
|
||||
<strong>{trans 'Updated:'}</strong> <span class="nobrk">{$issue.modif_dtime|dateago}</span></p>{/if}
|
||||
<p>
|
||||
<strong>{trans 'Status:'}</strong> {$issue.get_status.name}</p>
|
||||
{if $issue.get_owner != null}<p>{aurl 'url', 'IDF_Views_User::view', array($issue.get_owner().login)}
|
||||
<strong>{trans 'Owner:'}</strong> <a href="{$url}">{$issue.get_owner}</a>
|
||||
{if $issue.get_owner != null}<p>
|
||||
<strong>{trans 'Owner:'}</strong> {showuser $issue.get_owner(), $request}
|
||||
</p>{/if}{assign $tags = $issue.get_tags_list()}{if $tags.count()}
|
||||
<p>
|
||||
<strong>{trans 'Labels:'}</strong><br />
|
||||
|
@ -10,15 +10,15 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $changes as $change}
|
||||
{aurl 'url', 'IDF_Views_Source::commit', array($project.shortname, $change.commit)}
|
||||
{aurl 'url', 'IDF_Views_Source::commit', array($project.shortname, $change.scm_id)}
|
||||
<tr class="log">
|
||||
<td><a href="{$url}">{$change.date|dateago:"wihtout"}</a></td>
|
||||
<td>{issuetext $change.title, $request}{if $change.full_message}<br /><br />{issuetext $change.full_message, $request}{/if}</td>
|
||||
<td><a href="{$url}">{$change.creation_dtime|dateago:"wihtout"}</a></td>
|
||||
<td>{issuetext $change.summary, $request}{if $change.fullmessage}<br /><br />{issuetext $change.fullmessage, $request}{/if}</td>
|
||||
</tr>
|
||||
<tr class="extra">
|
||||
<td colspan="2">
|
||||
<div class="helptext right">{trans 'Commit'} <a href="{$url}" class="mono">{$change.commit}</a>,
|
||||
{trans 'by'} {$change.author|strip_tags} {* this remove the email address *}
|
||||
<div class="helptext right">{trans 'Commit'} <a href="{$url}" class="mono">{$change.scm_id}</a>,
|
||||
{trans 'by'} {showuser $change.get_author(), $request, $change.origauthor}
|
||||
</div>
|
||||
|
||||
</td>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<th><strong>{trans 'Date:'}</strong></th><td>{$cobject.date|date:"%Y-%m-%d %H:%M:%S"} ({$cobject.date|dateago})</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><strong>{trans 'Author:'}</strong></th><td>{$cobject.author|strip_tags}</td>
|
||||
<th><strong>{trans 'Author:'}</strong></th><td>{showuser $rcommit.get_author(), $request}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><strong>{trans 'Commit:'}</strong></th><td class="mono"><a href="{url 'IDF_Views_Source::treeBase', array($project.shortname, $commit)}" title="{trans 'View corresponding source tree'}">{$cobject.commit}</a></td>
|
||||
|
Loading…
Reference in New Issue
Block a user