diff --git a/src/lib/Hydra/Controller/Build.pm b/src/lib/Hydra/Controller/Build.pm index d62a4634..964d9670 100644 --- a/src/lib/Hydra/Controller/Build.pm +++ b/src/lib/Hydra/Controller/Build.pm @@ -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 $releaseName."; + + $c->res->redirect($c->uri_for($self->action_for("view_build"), $c->req->captures)); +} + + 1; diff --git a/src/root/build.tt b/src/root/build.tt index fd28cdc7..2460380c 100644 --- a/src/root/build.tt +++ b/src/root/build.tt @@ -206,6 +206,15 @@ +[% IF c.user_exists %] +
+

Add to release: +

+
+[% END %] + + + [% IF build.buildproducts %]

Build products

diff --git a/src/root/edit-release.tt b/src/root/edit-release.tt index f63b1977..c8af301e 100644 --- a/src/root/edit-release.tt +++ b/src/root/edit-release.tt @@ -17,6 +17,9 @@ +

Note: to add a build to this release, go to the build’s + information page and click on “Add to release”.

+

@@ -24,7 +27,7 @@ [% IF !create %]
-

+

Delete this release