From cea17fd57e12371a28c3c2004096284dc0970a0b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 21 Feb 2013 01:23:42 +0100 Subject: [PATCH] Show releases in a tab on the project page --- src/lib/Hydra/Controller/Project.pm | 10 ++------ src/lib/Hydra/Controller/Release.pm | 2 +- src/root/project.tt | 39 +++++++++++++++++++++++++++++ src/root/releases.tt | 39 ----------------------------- src/root/topbar.tt | 1 - 5 files changed, 42 insertions(+), 49 deletions(-) delete mode 100644 src/root/releases.tt diff --git a/src/lib/Hydra/Controller/Project.pm b/src/lib/Hydra/Controller/Project.pm index 8cdd912b..d9f686a3 100644 --- a/src/lib/Hydra/Controller/Project.pm +++ b/src/lib/Hydra/Controller/Project.pm @@ -26,6 +26,8 @@ sub view : Chained('project') PathPart('') Args(0) { $c->stash->{views} = [$c->stash->{project}->views->all]; $c->stash->{jobsets} = [jobsetOverview($c, $c->stash->{project})]; + $c->stash->{releases} = [$c->stash->{project}->releases->search({}, + {order_by => ["timestamp DESC"]})]; } @@ -235,14 +237,6 @@ sub create_view : Chained('project') PathPart('create-view') Args(0) { } -sub releases : Chained('project') PathPart('releases') Args(0) { - my ($self, $c) = @_; - $c->stash->{template} = 'releases.tt'; - $c->stash->{releases} = [$c->stash->{project}->releases->search({}, - {order_by => ["timestamp DESC"]})]; -} - - sub create_release : Chained('project') PathPart('create-release') Args(0) { my ($self, $c) = @_; requireProjectOwner($c, $c->stash->{project}); diff --git a/src/lib/Hydra/Controller/Release.pm b/src/lib/Hydra/Controller/Release.pm index 322dd417..665de3bc 100644 --- a/src/lib/Hydra/Controller/Release.pm +++ b/src/lib/Hydra/Controller/Release.pm @@ -66,7 +66,7 @@ sub submit : Chained('release') PathPart('submit') Args(0) { txn_do($c->model('DB')->schema, sub { $c->stash->{release}->delete; }); - $c->res->redirect($c->uri_for($c->controller('Project')->action_for('releases'), + $c->res->redirect($c->uri_for($c->controller('Project')->action_for('view'), [$c->stash->{project}->name])); } else { txn_do($c->model('DB')->schema, sub { diff --git a/src/root/project.tt b/src/root/project.tt index 4dd8fcae..5dafa589 100644 --- a/src/root/project.tt +++ b/src/root/project.tt @@ -4,6 +4,7 @@ @@ -108,6 +109,44 @@ +
+ + [% IF releases.size == 0 %] + +

This project has no releases yet.

+ + [% ELSE %] + +

This project has made the following releases:

+ + + + + + + + + + [% FOREACH release IN releases %] + [% link = c.uri_for('/release' project.name release.name) %] + + + + + [% END %] + +
NameDate
[% release.name %][% INCLUDE renderDateTime timestamp = release.timestamp %]
+ + [% END %] + + [% IF c.user_exists %] +

+ Create a release +

+ [% END %] + +
+
[% IF views.size > 0 %] diff --git a/src/root/releases.tt b/src/root/releases.tt deleted file mode 100644 index c82f5507..00000000 --- a/src/root/releases.tt +++ /dev/null @@ -1,39 +0,0 @@ -[% WRAPPER layout.tt title="Releases for project $project.name" %] -[% PROCESS common.tt %] -[% USE HTML %] - -[% IF releases.size == 0 %] - -

This project has no releases yet.

- -[% ELSE %] - -

This project has made the following releases:

- - - - - - - - - - [% FOREACH release IN releases %] - [% link = c.uri_for('/release' project.name release.name) %] - - - - - [% END %] - -
NameDate
[% release.name %][% INCLUDE renderDateTime timestamp = release.timestamp %]
- -[% END %] - -[% IF c.user_exists %] -

- Create a release -

-[% END %] - -[% END %] diff --git a/src/root/topbar.tt b/src/root/topbar.tt index 2994681c..9dedfbe5 100644 --- a/src/root/topbar.tt +++ b/src/root/topbar.tt @@ -48,7 +48,6 @@ [% INCLUDE menuItem uri = c.uri_for(c.controller('Project').action_for('jobstatus'), [project.name]) title = "Job status" %] [% INCLUDE menuItem uri = c.uri_for(c.controller('Project').action_for('errors'), [project.name]) title = "Errors" %]
  • - [% INCLUDE menuItem uri = c.uri_for(c.controller('Project').action_for('releases'), [project.name]) title = "Releases" %] [% INCLUDE menuItem uri = c.uri_for('/project' project.name 'channel' 'latest') title = "Channel" %] [% IF c.user_exists %]