784c9718eb
Changes with respect to the original patch: - use Gconf instead of separate table / data scheme - better form validation for URLs and emails - no htmlentity-encoded contents in the database (pluf automatically safe-encodes stuff before it writes out contents into templates) - add visual separators in the form views to have a distinct view of basic (important) data and other data which are only displayed in the public profile - give a hint about the maximum display size of 60x60 px^2 and use max-width and max-height in the templates to avoid nasty distortions by the browser - use target=_blank and rel=nofollow on the twitter and website links in the profile - some whitespace / formatting / code style fixes
177 lines
7.2 KiB
HTML
177 lines
7.2 KiB
HTML
{extends "idf/review/base-full.html"}
|
|
{block extraheader}<link rel="stylesheet" type="text/css" href="{media '/idf/css/prettify.css'}" />{/block}
|
|
{block docclass}yui-t1{assign $inCreate = true}{/block}
|
|
{block body}
|
|
{if !$user.isAnonymous() and $form.errors}
|
|
<div class="px-message-error">
|
|
<p>{trans 'The form contains some errors. Please correct them to submit your review.'}</p>
|
|
{if $form.get_top_errors}
|
|
{$form.render_top_errors|unsafe}
|
|
{/if}
|
|
</div>
|
|
{/if}
|
|
<table class="disp" summary="">
|
|
<tr><td>
|
|
<table class="commit" summary="">
|
|
<tr>
|
|
<th><strong>{trans 'Created:'}</strong></th><td>{$patch.creation_dtime|date:"%Y-%m-%d %H:%M:%S"} ({$patch.creation_dtime|dateago})</td>
|
|
</tr>
|
|
<tr>
|
|
<th><strong>{trans 'Updated:'}</strong></th><td>{$review.modif_dtime|dateago}</td>
|
|
</tr>
|
|
<tr>
|
|
<th><strong>{trans 'Author:'}</strong></th><td>{$review.get_submitter()}</td>
|
|
</tr>
|
|
<tr>
|
|
<th><strong>{trans 'Commit:'}</strong></th><td class="mono"><a href="{url 'IDF_Views_Source::treeBase', array($project.shortname, $patch.get_commit().scm_id)}" title="{trans 'View corresponding source tree'}">{$patch.get_commit().scm_id}</a></td>
|
|
</tr>
|
|
<tr>
|
|
<th><strong>{trans 'Description:'}</strong></th><td>{issuetext $review.summary, $request}<br /><br />{issuetext $patch.description, $request}</td>
|
|
</tr>
|
|
<tr>
|
|
<th><strong>{trans 'Reviewers:'}</strong></th><td>{if count($reviewers)}{foreach $reviewers as $r}{$r}, {/foreach}{else}{trans 'No reviewers at the moment.'}{/if}</td>
|
|
</tr>{if count($diff.files)}
|
|
<tr>
|
|
<th><strong>{trans 'Files:'}</strong></th>
|
|
<td>
|
|
{foreach $diff.files as $filename=>$diffdef}
|
|
{assign $ndiff = count($diffdef['chunks'])}
|
|
{assign $nc = $files[$filename][2]->count()}
|
|
<a href="{url 'IDF_Views_Source::tree', array($project.shortname, $patch.get_commit().scm_id, $filename)}">{$filename}</a> (<a href="#diff-{$filename|md5}">{blocktrans $ndiff}{$ndiff} diff{plural}{$ndiff} diffs{/blocktrans}</a>{if $nc}, <a href="#ct-{$filename|md5}">{blocktrans $nc}{$nc} comment{plural}{$nc} comments{/blocktrans}</a>{/if})<br />
|
|
{/foreach}
|
|
</td>
|
|
</tr>{/if}
|
|
<tr>{aurl 'url', 'IDF_Views_Review::getPatch', array($project.shortname, $patch.id)}
|
|
<th> </th><td><a href="{$url}"><img style="vertical-align: text-bottom;" src="{media '/idf/img/package-grey.png'}" alt="{trans 'Archive'}" align="bottom" /></a> <a href="{$url}" class="soft">{trans 'Download the corresponding diff file'}</a></td>
|
|
</tr>
|
|
</table>
|
|
</td><td>
|
|
{if !$user.isAnonymous()}
|
|
<div class="issue-submit-info" style="width: 90%; float: right; position: relative;">
|
|
<p><strong>{trans 'How to Participate in a Code Review'}</strong></p>
|
|
|
|
<p>{blocktrans}Code review is a process in which
|
|
after or before changes are commited into the code repository,
|
|
different people discuss the code changes. The goal is
|
|
to <strong>improve the quality of the code and the
|
|
contributions</strong>, as such, you must be pragmatic when writing
|
|
your review. Correctly mention the line numbers (in the old or in the
|
|
new file) and try to keep a good balance between seriousness and fun.
|
|
{/blocktrans}</p>
|
|
<p>{blocktrans}
|
|
<strong>Proposing code for review is intimidating</strong>, you know
|
|
you will receive critics, so please, as a reviewer, <strong>keep this
|
|
process fun</strong>, use it to help your contributor learn your
|
|
coding standards and the structure of the code and <strong>make them want
|
|
to propose more contributions</strong>.
|
|
{/blocktrans}</p></div>
|
|
{/if}
|
|
</td></tr>
|
|
</table>
|
|
|
|
<form method="post" action=".">
|
|
{foreach $files as $file=>$def}
|
|
<table class="diff" summary=" ">
|
|
<tbody>
|
|
<tr id="diff-{$file|md5}"><th colspan="4">{$file}</th></tr>
|
|
<tr><th colspan="2">{trans 'Old'}</th><th colspan="2">{trans 'New'}</th></tr>
|
|
{$def[0]}
|
|
</tbody>
|
|
</table>
|
|
{assign $fcomments = $def[2]}
|
|
{assign $nc = $fcomments.count()}
|
|
{assign $i = 1}
|
|
{foreach $fcomments as $c}
|
|
<div class="issue-comment{if $i == 1} issue-comment-first{/if}{if $i == $nc} issue-comment-last{/if}" id="ic{$c.id}">{assign $who = $c.get_comment().get_submitter()}{aurl 'whourl', 'IDF_Views_User::view', array($who.login)}
|
|
{aurl 'url', 'IDF_Views_Review::view', array($project.shortname, $review.id)}
|
|
{assign $id = $c.id}
|
|
{assign $url = $url~'#ic'~$c.id}
|
|
<p{if $i == 1} id="ct-{$file|md5}"{/if}>{blocktrans}Comment <a href="{$url}">{$i}</a> by <a href="{$whourl}">{$who}</a>, {$c.creation_dtime|date}{/blocktrans}</p>
|
|
|
|
<pre class="issue-comment-text">{issuetext $c.content, $request}</pre>
|
|
</div> {assign $i = $i + 1}
|
|
{/foreach}
|
|
{if !$user.isAnonymous()}
|
|
<table class="form" summary=" ">
|
|
<tr>
|
|
<td> </td>
|
|
<td>
|
|
<p>{blocktrans}Your comments on the changes in file <em>{$file}</em>:{/blocktrans}<br />{$def[1]|safe}</p>
|
|
</td>
|
|
</tr></table>{/if}
|
|
{/foreach}
|
|
|
|
{assign $i = 1}
|
|
{assign $nc = $comments.count()}
|
|
{if $nc}<hr align="left" class="attach" />
|
|
<h2>{trans 'General Comments'}</h2>
|
|
{/if}
|
|
{foreach $comments as $c}{ashowuser 'submitter', $c.get_submitter(), $request}{assign $submitter = $c.get_submitter()}{assign $submitter_data = $c.get_submitter_data()}
|
|
<div class="issue-comment{if $i == 1} issue-comment-first{/if}{if $i == ($nc)} issue-comment-last{/if}" id="ic{$c.id}">
|
|
{if $submitter_data.avatar != ''}
|
|
<img style="float:right; position: relative; max-height: 60px; max-width: 60px;" src="{media}/upload/avatars/{$submitter_data.avatar}" alt=" " />
|
|
{else}
|
|
<img style="float:right; position: relative;" src="http://www.gravatar.com/avatar/{$submitter.email|md5}.jpg?s=60&d={media}/idf/img/spacer.gif" alt=" " />
|
|
{/if}
|
|
{aurl 'url', 'IDF_Views_Review::view', array($project.shortname, $review.id)}
|
|
{assign $id = $c.id}
|
|
{assign $url = $url~'#ic'~$c.id}
|
|
<p>{blocktrans}Comment <a href="{$url}">{$i}</a> by {$submitter}, {$c.creation_dtime|date}{/blocktrans}</p>
|
|
|
|
|
|
|
|
{if strlen($c.content) > 0}<pre class="issue-comment-text">{issuetext $c.content, $request}</pre>{/if}
|
|
|
|
{if $c.changedReview()}
|
|
<div class="issue-changes">
|
|
{foreach $c.changes as $w => $v}
|
|
<strong>{if $w == 'su'}{trans 'Summary:'}{/if}{if $w == 'st'}{trans 'Status:'}{/if}</strong> {$v}<br />
|
|
{/foreach}
|
|
</div>
|
|
{/if}
|
|
</div>{assign $i = $i + 1}{if $i == $nc+1 and $user.isAnonymous()}
|
|
<div class="issue-comment-signin">
|
|
{aurl 'url', 'IDF_Views::login'}{blocktrans}<a href="{$url}">Sign in</a> to participate in the review.{/blocktrans}
|
|
</div>
|
|
{/if}
|
|
{/foreach}
|
|
|
|
{if !$user.isAnonymous()}
|
|
{if !$nc}<hr align="left" class="attach" />{/if}
|
|
<table class="form" summary=" ">
|
|
<tr>
|
|
<th><strong>{$form.f.content.labelTag}:</strong></th>
|
|
<td>{if $form.f.content.errors}{$form.f.content.fieldErrors}{/if}
|
|
{$form.f.content|unsafe}
|
|
</td>
|
|
</tr>
|
|
{if $isOwner or $isMember}
|
|
<tr>
|
|
<th><strong>{$form.f.summary.labelTag}:</strong></th>
|
|
<td>{if $form.f.summary.errors}{$form.f.summary.fieldErrors}{/if}
|
|
{$form.f.summary|unsafe}
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th><strong>{$form.f.status.labelTag}:</strong></th>
|
|
<td>{if $form.f.status.errors}{$form.f.status.fieldErrors}{/if}
|
|
{$form.f.status|unsafe}
|
|
</td>
|
|
</tr>{/if}
|
|
<tr>
|
|
<td> </td>
|
|
<td><input type="submit" value="{trans 'Submit Code Review'}" name="submit" /> | <a href="{url 'IDF_Views_Review::index', array($project.shortname)}">{trans 'Cancel'}</a>
|
|
</td>
|
|
</tr></table>
|
|
{/if}
|
|
</form>
|
|
{/block}
|
|
|
|
{block javascript}
|
|
<script type="text/javascript" src="{media '/idf/js/prettify.js'}"></script>
|
|
<script type="text/javascript">
|
|
prettyPrint();
|
|
</script>
|
|
{if $isOwner or $isMember}{include 'idf/issues/js-autocomplete.html'}{/if}
|
|
{/block}
|