Make the hide/unhide actions a checkbox in the project settings

[?]
Feb 21, 2013, 12:45 AM
A6XVP6FE3CO7BVZR23HQS2GFDNF3FK7KBDSOB4YIPRISZHEWQJKAC

Dependencies

  • [2] I4K2UPCW Tweaks
  • [3] TLJC6BJ3 Add a menu item for deleting jobsets
  • [4] JARRBLZD Bootstrapify the Hydra forms (except the project and jobset edit pages)
  • [5] BHJ62LYE * Allow authorised users to create projects.
  • [6] 7ZQAHJQM Fix indentation
  • [7] LZO3C2KI * Hack around those SQLite timeouts: just retry the transaction.
  • [8] FPK5LF53 * Put the project-related actions in a separate controller. Put the
  • [9] 3PNG7NIB Remove trailing whitespace
  • [10] UWVMQIAC * Refactoring.
  • [11] JY7BXXOP Split viewing and editing a project
  • [12] QTFVCDIF added hide feature for project/jobset
  • [13] 7UJ5YV4V * Provide a channel for each project containing all the latest
  • [14] ODNCGFQ5 * Improved the navigation bar: don't include all projects (since that
  • [15] OEPUOUNB Using twitter bootstrap for more consistent looks for Hydra
  • [*] QL55ECJ6 - adapted ui for hydra, more in line with nixos.org website

Change contents

  • edit in src/lib/Hydra/Controller/Project.pm at line 61
    [3.886][3.886:962]()
    sub hide : Chained('project') PathPart Args(0) {
    my ($self, $c) = @_;
  • edit in src/lib/Hydra/Controller/Project.pm at line 62
    [3.963][3.963:1014]()
    requireProjectOwner($c, $c->stash->{project});
  • edit in src/lib/Hydra/Controller/Project.pm at line 63
    [3.2221][3.1019:1138](),[3.1019][3.1019:1138](),[3.1138][3.2222:2223](),[3.2223][3.1143:1184](),[3.1143][3.1143:1184](),[3.1184][3.2550:2552](),[3.4746][3.2550:2552](),[3.2550][3.2550:2552](),[3.2552][3.793:794](),[3.794][3.2552:2553](),[3.2552][3.2552:2553](),[3.2553][3.1185:1261](),[3.1261][3.2553:2554](),[3.2553][3.2553:2554](),[3.2554][3.1262:1313](),[3.1313][3.2224:2225](),[3.2225][3.1318:1415](),[3.1318][3.1318:1415](),[3.974][3.2849:2857](),[3.2849][3.2849:2857](),[3.2857][3.2226:2227](),[3.2227][3.2862:2903](),[3.2862][3.2862:2903](),[3.2903][3.0:4]()
    txn_do($c->model('DB')->schema, sub {
    $c->stash->{project}->update({ hidden => 1, enabled => 0 });
    });
    $c->res->redirect($c->uri_for("/"));
    }
    sub unhide : Chained('project') PathPart Args(0) {
    my ($self, $c) = @_;
    requireProjectOwner($c, $c->stash->{project});
    txn_do($c->model('DB')->schema, sub {
    $c->stash->{project}->update({ hidden => 0 });
    });
    $c->res->redirect($c->uri_for("/"));
    }
  • replacement in src/lib/Hydra/Controller/Project.pm at line 164
    [3.6076][3.6076:6149]()
    , enabled => trim($c->request->params->{enabled}) eq "1" ? 1 : 0
    [3.6076]
    [3.6149]
    , enabled => defined $c->request->params->{enabled} ? 1 : 0
    , hidden => defined $c->request->params->{visible} ? 0 : 1
  • edit in src/root/edit-project.tt at line 3
    [3.399]
    [3.399]
    <form class="form-horizontal" action="[% IF create %][% c.uri_for('/create-project/submit') %][% ELSE %][% c.uri_for('/project' project.name 'submit') %][% END %]" method="post">
    <fieldset>
  • replacement in src/root/edit-project.tt at line 8
    [3.400][3.400:555]()
    <form action="[% IF create %][% c.uri_for('/create-project/submit') %][% ELSE %][% c.uri_for('/project' project.name 'submit') %][% END %]" method="post">
    [3.400]
    [3.555]
    <div class="control-group">
    <div class="controls">
    <label class="checkbox">
    <input type="checkbox" name="enabled" value="enabled" [% IF project.enabled; 'checked="checked"'; END %]></input>Enabled
    </label>
    </div>
    <div class="controls">
    <label class="checkbox">
    <input type="checkbox" name="visible" value="visible" [% IF !project.hidden; 'checked="checked"'; END %]></input>Visible in the list of projects
    </label>
    </div>
    </div>
  • replacement in src/root/edit-project.tt at line 21
    [3.556][3.556:1479]()
    <table class="layoutTable">
    <tr>
    <th>Identifier:</th>
    <td><tt>[% INCLUDE editString param="name" value=project.name %]</tt></td>
    </tr>
    <tr>
    <th>Display name:</th>
    <td>[% INCLUDE editString param="displayname" value=project.displayname %]</td>
    </tr>
    <tr>
    <th>Description:</th>
    <td>[% INCLUDE editString param="description" value=project.description %]</td>
    </tr>
    <tr>
    <th>Homepage:</th>
    <td>
    [% INCLUDE editString param="homepage" value=project.homepage %]
    </td>
    </tr>
    <tr>
    <th>Owner:</th>
    <td><tt>[% INCLUDE editString param="owner" value=(project.owner.username || c.user.username) %]</tt></td>
    </tr>
    <tr>
    <th>Enabled:</th>
    <td>
    [% INCLUDE renderSelection param="enabled" curValue=project.enabled radiobuttons=1 options={"1" = "Yes", "0" = "No"} %]
    </td>
    </tr>
    </table>
    [3.556]
    [3.1479]
    <div class="control-group">
    <label class="control-label">Identifier</label>
    <div class="controls">
    <input type="text" class="span3" name="name" [% HTML.attributes(value => project.name) %]></input>
    </div>
    </div>
    <div class="control-group">
    <label class="control-label">Display name</label>
    <div class="controls">
    <input type="text" class="span3" name="displayname" [% HTML.attributes(value => project.displayname) %]></input>
    </div>
    </div>
    <div class="control-group">
    <label class="control-label">Description</label>
    <div class="controls">
    <input type="text" class="span3" name="description" [% HTML.attributes(value => project.description) %]></input>
    </div>
    </div>
    <div class="control-group">
    <label class="control-label">Homepage</label>
    <div class="controls">
    <input type="text" class="span3" name="homepage" [% HTML.attributes(value => project.homepage) %]></input>
    </div>
    </div>
    <div class="control-group">
    <label class="control-label">Owner</label>
    <div class="controls">
    <input type="text" class="span3" name="owner" [% HTML.attributes(value => project.owner.username || c.user.username) %]></input>
    </div>
    </div>
  • replacement in src/root/edit-project.tt at line 56
    [3.1480][3.1480:1870]()
    <div class="form-actions">
    <button type="submit" class="btn btn-primary">
    <i class="icon-ok icon-white"></i>
    [%IF create %]Create[% ELSE %]Apply changes[% END %]
    </button>
    [% IF !create %]
    <button id="delete-project" type="submit" class="btn btn-danger" name="submit" value="delete">
    <i class="icon-trash icon-white"></i>
    Delete this project
    [3.1480]
    [3.1870]
    <div class="form-actions">
    <button type="submit" class="btn btn-primary">
    <i class="icon-ok icon-white"></i>
    [%IF create %]Create[% ELSE %]Apply changes[% END %]
  • replacement in src/root/edit-project.tt at line 61
    [3.1886][3.1886:2098]()
    <script type="text/javascript">
    $("#delete-project").click(function() {
    return confirm("Are you sure you want to delete this project?");
    });
    </script>
    [% END %]
    </div>
    [3.1886]
    [3.2098]
    [% IF !create %]
    <button id="delete-project" type="submit" class="btn btn-danger" name="submit" value="delete">
    <i class="icon-trash icon-white"></i>
    Delete this project
    </button>
    <script type="text/javascript">
    $("#delete-project").click(function() {
    return confirm("Are you sure you want to delete this project?");
    });
    </script>
    [% END %]
    </div>
  • edit in src/root/edit-project.tt at line 74
    [3.2099]
    [3.2099]
    </fieldset>
  • edit in src/root/topbar.tt at line 55
    [2.182][3.814:1079](),[3.814][3.814:1079]()
    [% IF project.hidden %]
    [% INCLUDE menuItem uri = c.uri_for('/project' project.name 'unhide') title = "Unhide" %]
    [% ELSE %]
    [% INCLUDE menuItem uri = c.uri_for('/project' project.name 'hide') title = "Hide" %]
    [% END %]