From 6c5da013193a225966443bc077bbbf61c0659aff Mon Sep 17 00:00:00 2001 From: Loic d'Anterroches Date: Fri, 5 Dec 2008 14:51:51 +0100 Subject: [PATCH] Added the link to the author profile when possible. --- src/IDF/Middleware.php | 1 + src/IDF/Template/AssignShowUser.php | 55 +++++++++++++++++++++ src/IDF/Views/Source.php | 9 ++-- src/IDF/templates/idf/downloads/view.html | 2 +- src/IDF/templates/idf/issues/view.html | 16 +++--- src/IDF/templates/idf/source/changelog.html | 10 ++-- src/IDF/templates/idf/source/commit.html | 2 +- 7 files changed, 77 insertions(+), 18 deletions(-) create mode 100644 src/IDF/Template/AssignShowUser.php diff --git a/src/IDF/Middleware.php b/src/IDF/Middleware.php index 48eda3e..2028055 100644 --- a/src/IDF/Middleware.php +++ b/src/IDF/Middleware.php @@ -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( diff --git a/src/IDF/Template/AssignShowUser.php b/src/IDF/Template/AssignShowUser.php new file mode 100644 index 0000000..1b30cb3 --- /dev/null +++ b/src/IDF/Template/AssignShowUser.php @@ -0,0 +1,55 @@ +context); + $this->context->set($var, + Pluf_Template::markSafe($t->start($user, $request, $text, false))); + } +} diff --git a/src/IDF/Views/Source.php b/src/IDF/Views/Source.php index c0b0958..1ea0b14 100644 --- a/src/IDF/Views/Source.php +++ b/src/IDF/Views/Source.php @@ -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); } diff --git a/src/IDF/templates/idf/downloads/view.html b/src/IDF/templates/idf/downloads/view.html index 660aa82..d509e63 100644 --- a/src/IDF/templates/idf/downloads/view.html +++ b/src/IDF/templates/idf/downloads/view.html @@ -47,7 +47,7 @@ {/if} {/block} {block context} -{assign $submitter = $file.get_submitter()} +{ashowuser 'submitter', $file.get_submitter(), $request}

{trans 'Uploaded:'} {$file.creation_dtime|dateago} {blocktrans}by {$submitter}{/blocktrans}

{if $file.modif_dtime != $file.creation_dtime}

{trans 'Updated:'} {$file.modif_dtime|dateago}

{/if} diff --git a/src/IDF/templates/idf/issues/view.html b/src/IDF/templates/idf/issues/view.html index 8280376..a9d9d8a 100644 --- a/src/IDF/templates/idf/issues/view.html +++ b/src/IDF/templates/idf/issues/view.html @@ -3,15 +3,15 @@ {block body} {assign $i = 0} {assign $nc = $comments.count()} -{foreach $comments as $c} -
{assign $who = $c.get_submitter()}{aurl 'whourl', 'IDF_Views_User::view', array($who.login)} +{foreach $comments as $c}{ashowuser 'submitter', $c.get_submitter(), $request}{assign $who = $c.get_submitter()} +
 {if $i == 0} -

{blocktrans}Reported by {$who}, {$c.creation_dtime|date}{/blocktrans}

+

{blocktrans}Reported by {$submitter}, {$c.creation_dtime|date}{/blocktrans}

{else} {aurl 'url', 'IDF_Views_Issue::view', array($project.shortname, $issue.id)} {assign $id = $c.id} {assign $url = $url~'#ic'~$c.id} -

{blocktrans}Comment {$i} by {$who}, {$c.creation_dtime|date}{/blocktrans}

+

{blocktrans}Comment {$i} by {$submitter}, {$c.creation_dtime|date}{/blocktrans}

{/if} @@ -118,14 +118,14 @@ {/block} {block context}
-{assign $submitter = $issue.get_submitter()}{aurl 'url', 'IDF_Views_User::view', array($submitter.login)} -

{trans 'Created:'} {$issue.creation_dtime|dateago} {blocktrans}by {$submitter}{/blocktrans}

+{ashowuser 'submitter', $issue.get_submitter(), $request} +

{trans 'Created:'} {$issue.creation_dtime|dateago} {blocktrans}by {$submitter}{/blocktrans}

{if $issue.modif_dtime != $issue.creation_dtime}

{trans 'Updated:'} {$issue.modif_dtime|dateago}

{/if}

{trans 'Status:'} {$issue.get_status.name}

-{if $issue.get_owner != null}

{aurl 'url', 'IDF_Views_User::view', array($issue.get_owner().login)} -{trans 'Owner:'} {$issue.get_owner} +{if $issue.get_owner != null}

+{trans 'Owner:'} {showuser $issue.get_owner(), $request}

{/if}{assign $tags = $issue.get_tags_list()}{if $tags.count()}

{trans 'Labels:'}
diff --git a/src/IDF/templates/idf/source/changelog.html b/src/IDF/templates/idf/source/changelog.html index 124657d..9a594f5 100644 --- a/src/IDF/templates/idf/source/changelog.html +++ b/src/IDF/templates/idf/source/changelog.html @@ -10,15 +10,15 @@ {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)} -{$change.date|dateago:"wihtout"} -{issuetext $change.title, $request}{if $change.full_message}

{issuetext $change.full_message, $request}{/if} +{$change.creation_dtime|dateago:"wihtout"} +{issuetext $change.summary, $request}{if $change.fullmessage}

{issuetext $change.fullmessage, $request}{/if} -

{trans 'Commit'} {$change.commit}, -{trans 'by'} {$change.author|strip_tags} {* this remove the email address *} +
{trans 'Commit'} {$change.scm_id}, +{trans 'by'} {showuser $change.get_author(), $request, $change.origauthor}
diff --git a/src/IDF/templates/idf/source/commit.html b/src/IDF/templates/idf/source/commit.html index b81c1bd..5e40c03 100644 --- a/src/IDF/templates/idf/source/commit.html +++ b/src/IDF/templates/idf/source/commit.html @@ -7,7 +7,7 @@ {trans 'Date:'}{$cobject.date|date:"%Y-%m-%d %H:%M:%S"} ({$cobject.date|dateago}) -{trans 'Author:'}{$cobject.author|strip_tags} +{trans 'Author:'}{showuser $rcommit.get_author(), $request} {trans 'Commit:'}{$cobject.commit}