* A quick (non-Web 2.0) interface to manually add builds to a release.

This commit is contained in:
Eelco Dolstra 2009-10-23 15:57:18 +00:00
parent a515c5fef2
commit 7e81fbd56a
5 changed files with 67 additions and 8 deletions

View file

@ -357,4 +357,28 @@ sub keep : Chained('build') PathPart Args(1) {
} }
sub add_to_release : Chained('build') PathPart('add-to-release') Args(0) {
my ($self, $c) = @_;
my $build = $c->stash->{build};
requireProjectOwner($c, $build->project);
my $releaseName = trim $c->request->params->{name};
my $release = $build->project->releases->find({name => $releaseName});
error($c, "This project has no release named `$releaseName'.") unless $release;
error($c, "This build is already a part of release `$releaseName'.")
if $release->releasemembers->find({build => $build->id});
$release->releasemembers->create({build => $build->id, description => $build->description});
$c->flash->{buildMsg} = "Build added to project <tt>$releaseName</tt>.";
$c->res->redirect($c->uri_for($self->action_for("view_build"), $c->req->captures));
}
1; 1;

View file

@ -206,6 +206,15 @@
</table> </table>
[% IF c.user_exists %]
<form action="[% c.uri_for('/build' build.id 'add-to-release') %]" method="post">
<p>Add to release: <input type="text" class="string" name="name" />
<button type="submit"><img src="/static/images/success.gif" />Apply</button></p>
</form>
[% END %]
[% IF build.buildproducts %] [% IF build.buildproducts %]
<h2>Build products</h2> <h2>Build products</h2>

View file

@ -17,6 +17,9 @@
</tr> </tr>
</table> </table>
<p><em>Note:</em> to add a build to this release, go to the builds
information page and click on “Add to release”.</p>
<p><button type="submit"><img src="/static/images/success.gif" />[%IF create %]Create[% ELSE %]Apply changes[% END %]</button></p> <p><button type="submit"><img src="/static/images/success.gif" />[%IF create %]Create[% ELSE %]Apply changes[% END %]</button></p>
</form> </form>
@ -24,7 +27,7 @@
[% IF !create %] [% IF !create %]
<form action="[% c.uri_for('/release' project.name release.name 'delete') %]" method="post"> <form action="[% c.uri_for('/release' project.name release.name 'delete') %]" method="post">
<p><button id="delete-release" type="submit"><img src="/static/images/failure.gif" />Delete this release</button></p> <p><a id="delete-release" type="submit"><img src="/static/images/failure.gif" />Delete this release</button></p>
</form> </form>
<script type="text/javascript"> <script type="text/javascript">

View file

@ -1,10 +1,32 @@
[% WRAPPER layout.tt title="Release $release.name" %] [% WRAPPER layout.tt title="Release $release.name" %]
[% PROCESS common.tt %] [% PROCESS common.tt %]
[% PROCESS "product-list.tt" %]
[% USE HTML %] [% USE HTML %]
<h1>Release <tt>[% release.name %]</tt> <a <h1>Release <tt>[% release.name %]</tt> <a
class="smallLink" href="[% c.uri_for('/release' project.name release.name "edit") %]">[Edit]</a></h1> class="smallLink" href="[% c.uri_for('/release' project.name release.name "edit") %]">[Edit]</a></h1>
<p><em>Released on [% INCLUDE renderDateTime timestamp = release.timestamp %].</em></p> <p><em>Released on [% INCLUDE renderDateTime timestamp =
release.timestamp %].</em></p>
[% IF !release.releasemembers %]
<p><em>No builds have been added to this release yet.</em></p>
[% ELSE %]
[% FOREACH m IN release.releasemembers %]
<h2>
<a href="[% c.uri_for('/build' m.build.id) %]">
[% HTML.escape(m.description) %]
</a>
</h2>
[% INCLUDE renderProductList build=m.build latestRoot=['/view!!!' project.name view.name 'latest' j.job.job] %]
[% END %]
[% END %]
[% END %] [% END %]

View file

@ -4,18 +4,14 @@
<h1>Releases for Project <tt>[% project.name %]</tt></h1> <h1>Releases for Project <tt>[% project.name %]</tt></h1>
[% IF c.user_exists %]
<p>
[<a href="[% c.uri_for('/project' project.name 'create-release') %]">Create a release</a>]
</p>
[% END %]
[% IF releases.size == 0 %] [% IF releases.size == 0 %]
<p><em>This project has no releases yet.</em></p> <p><em>This project has no releases yet.</em></p>
[% ELSE %] [% ELSE %]
<p>This project has made the following releases:</p>
<ul> <ul>
[% FOREACH release IN releases %] [% FOREACH release IN releases %]
<li><a href="[% c.uri_for('/release' project.name release.name) %]"><tt>[% release.name %]</tt></a></li> <li><a href="[% c.uri_for('/release' project.name release.name) %]"><tt>[% release.name %]</tt></a></li>
@ -24,5 +20,10 @@
[% END %] [% END %]
[% IF c.user_exists %]
<p>
[<a href="[% c.uri_for('/project' project.name 'create-release') %]">Create a release</a>]
</p>
[% END %]
[% END %] [% END %]