From 8db83d2017c5cb1cdf61ff938c2eb8cec632bf04 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 21 Feb 2013 02:36:51 +0100 Subject: [PATCH] Turn hiding/unhiding a jobset into a checkbox --- src/lib/Hydra/Controller/Jobset.pm | 29 +---------------------------- src/root/edit-jobset.tt | 5 +++++ src/root/topbar.tt | 5 ----- 3 files changed, 6 insertions(+), 33 deletions(-) diff --git a/src/lib/Hydra/Controller/Jobset.pm b/src/lib/Hydra/Controller/Jobset.pm index 5ee9cd5f..59ed7bb8 100644 --- a/src/lib/Hydra/Controller/Jobset.pm +++ b/src/lib/Hydra/Controller/Jobset.pm @@ -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) { my ($self, $c) = @_; @@ -238,6 +210,7 @@ sub updateJobset { , enabled => defined $c->request->params->{enabled} ? 1 : 0 , enableemail => defined $c->request->params->{enableemail} ? 1 : 0 , emailoverride => trim($c->request->params->{emailoverride}) || "" + , hidden => defined $c->request->params->{visible} ? 0 : 1 , keepnr => trim($c->request->params->{keepnr}) || 3 }); diff --git a/src/root/edit-jobset.tt b/src/root/edit-jobset.tt index 83bcd025..6d9ef596 100644 --- a/src/root/edit-jobset.tt +++ b/src/root/edit-jobset.tt @@ -53,6 +53,11 @@ Enabled +
+ +
diff --git a/src/root/topbar.tt b/src/root/topbar.tt index df95e023..f3164ef4 100644 --- a/src/root/topbar.tt +++ b/src/root/topbar.tt @@ -94,11 +94,6 @@ [% 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) 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 %]