Turn hiding/unhiding a jobset into a checkbox

This commit is contained in:
Eelco Dolstra 2013-02-21 02:36:51 +01:00
parent 547e41263d
commit 8db83d2017
3 changed files with 6 additions and 33 deletions

View file

@ -135,34 +135,6 @@ sub submit : Chained('jobset') PathPart Args(0) {
} }
sub hide : Chained('jobset') PathPart Args(0) {
my ($self, $c) = @_;
requireProjectOwner($c, $c->stash->{project});
txn_do($c->model('DB')->schema, sub {
$c->stash->{jobset}->update({ hidden => 1, enabled => 0 });
});
$c->res->redirect($c->uri_for($c->controller('Project')->action_for("view"),
[$c->stash->{project}->name]));
}
sub unhide : Chained('jobset') PathPart Args(0) {
my ($self, $c) = @_;
requireProjectOwner($c, $c->stash->{project});
txn_do($c->model('DB')->schema, sub {
$c->stash->{jobset}->update({ hidden => 0 });
});
$c->res->redirect($c->uri_for($c->controller('Project')->action_for("view"),
[$c->stash->{project}->name]));
}
sub delete : Chained('jobset') PathPart Args(0) { sub delete : Chained('jobset') PathPart Args(0) {
my ($self, $c) = @_; my ($self, $c) = @_;
@ -238,6 +210,7 @@ sub updateJobset {
, enabled => defined $c->request->params->{enabled} ? 1 : 0 , enabled => defined $c->request->params->{enabled} ? 1 : 0
, enableemail => defined $c->request->params->{enableemail} ? 1 : 0 , enableemail => defined $c->request->params->{enableemail} ? 1 : 0
, emailoverride => trim($c->request->params->{emailoverride}) || "" , emailoverride => trim($c->request->params->{emailoverride}) || ""
, hidden => defined $c->request->params->{visible} ? 0 : 1
, keepnr => trim($c->request->params->{keepnr}) || 3 , keepnr => trim($c->request->params->{keepnr}) || 3
}); });

View file

@ -53,6 +53,11 @@
<input type="checkbox" name="enabled" [% IF jobset.enabled; 'checked="checked"'; END %]></input>Enabled <input type="checkbox" name="enabled" [% IF jobset.enabled; 'checked="checked"'; END %]></input>Enabled
</label> </label>
</div> </div>
<div class="controls">
<label class="checkbox">
<input type="checkbox" name="visible" [% IF !jobset.hidden; 'checked="checked"'; END %]></input>Visible
</label>
</div>
</div> </div>
<div class="control-group"> <div class="control-group">

View file

@ -94,11 +94,6 @@
[% INCLUDE menuItem uri = c.uri_for('/jobset' project.name jobset.name 'clone') title="Clone" %] [% INCLUDE menuItem uri = c.uri_for('/jobset' project.name jobset.name 'clone') title="Clone" %]
[% INCLUDE maybeLink uri = c.uri_for(c.controller('Admin').action_for('force_eval'), project.name, jobset.name) [% INCLUDE maybeLink uri = c.uri_for(c.controller('Admin').action_for('force_eval'), project.name, jobset.name)
content = "Evaluate" confirmmsg = ("Are you sure you want to force evaluation of jobset " _ project.name _ ":" _ jobset.name _ "?") class = "" %] content = "Evaluate" confirmmsg = ("Are you sure you want to force evaluation of jobset " _ project.name _ ":" _ jobset.name _ "?") class = "" %]
[% IF jobset.hidden %]
[% INCLUDE menuItem uri = c.uri_for('/jobset' project.name jobset.name 'unhide') title = "Unhide" %]
[% ELSE %]
[% INCLUDE menuItem uri = c.uri_for('/jobset' project.name jobset.name 'hide') title = "Hide" %]
[% END %]
[% END %] [% END %]
[% END %] [% END %]
[% END %] [% END %]