Show releases in a tab on the project page

This commit is contained in:
Eelco Dolstra 2013-02-21 01:23:42 +01:00
parent d9f6e662d8
commit cea17fd57e
5 changed files with 42 additions and 49 deletions

View file

@ -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});

View file

@ -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 {

View file

@ -4,6 +4,7 @@
<ul class="nav nav-tabs">
<li class="active"><a href="#tabs-project" data-toggle="tab">Jobsets</a></li>
<li><a href="#tabs-settings" data-toggle="tab">Configuration</a></li>
<li><a href="#tabs-releases" data-toggle="tab">Releases</a></li>
<li><a href="#tabs-views" data-toggle="tab">Views</a></li>
</ul>
@ -108,6 +109,44 @@
</table>
</div>
<div id="tabs-releases" class="tab-pane">
[% IF releases.size == 0 %]
<p><em>This project has no releases yet.</em></p>
[% ELSE %]
<p>This project has made the following releases:</p>
<table class="tablesorter table table-condensed table-striped">
<thead>
<tr>
<th>Name</th>
<th>Date</th>
</tr>
</thead>
<tbody>
[% FOREACH release IN releases %]
[% link = c.uri_for('/release' project.name release.name) %]
<tr class="clickable" onclick="window.location = '[% link %]'">
<td><a href="[% link %]"><tt>[% release.name %]</tt></a></td>
<td>[% INCLUDE renderDateTime timestamp = release.timestamp %]</td>
</tr>
[% END %]
</tbody>
</table>
[% END %]
[% IF c.user_exists %]
<p><a class="btn" href="[% c.uri_for('/project' project.name 'create-release') %]">
<i class="icon-plus"></i> Create a release
</a></p>
[% END %]
</div>
<div id="tabs-views" class="tab-pane">
[% IF views.size > 0 %]

View file

@ -1,39 +0,0 @@
[% WRAPPER layout.tt title="Releases for project $project.name" %]
[% PROCESS common.tt %]
[% USE HTML %]
[% IF releases.size == 0 %]
<p><em>This project has no releases yet.</em></p>
[% ELSE %]
<p>This project has made the following releases:</p>
<table class="tablesorter table table-condensed table-striped">
<thead>
<tr>
<th>Name</th>
<th>Date</th>
</tr>
</thead>
<tbody>
[% FOREACH release IN releases %]
[% link = c.uri_for('/release' project.name release.name) %]
<tr class="clickable" onclick="window.location = '[% link %]'">
<td><a href="[% link %]"><tt>[% release.name %]</tt></a></td>
<td>[% INCLUDE renderDateTime timestamp = release.timestamp %]</td>
</tr>
[% END %]
</tbody>
</table>
[% END %]
[% IF c.user_exists %]
<p><a class="btn" href="[% c.uri_for('/project' project.name 'create-release') %]">
<i class="icon-plus"></i> Create a release
</a></p>
[% END %]
[% END %]

View file

@ -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" %]
<li class="divider"></li>
[% 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 %]
<li class="divider"></li>