Also use proper bootstrap layout for the project settings form.
A6XVP6FE3CO7BVZR23HQS2GFDNF3FK7KBDSOB4YIPRISZHEWQJKAC
I4K2UPCWTK4EEPPQYBZ6UEGLF2HIUR5X6GJH34JEKPVKRBVWFCVAC
QTFVCDIFHTF36AGU4UGNCTWSHQYTM2KERXS26TPAJK7IDJHL7BVAC
FPK5LF53CFUEKFYJ3IYXT4UTVC6IITWJOCFATMC4PLHEUP5SIEAAC
3PNG7NIBQQURUUPRVQXYL342OT7JUUYOMY2JJNP6YDX7SYJDZMYAC
ODNCGFQ5FPKFI624BVMLW7PJ2EFJOR3TY66OCZM42UNNTWBCF2TQC
JARRBLZDQ2JZWY7IUVPTOT7WJMBPMLFLF2MGLVGOYROAAISYGLSAC
UWVMQIAC2HQNSG2JQOPZGUOCQ5V2JFP2F7RCTF3WJLK7NHSD5PAAC
BHJ62LYETTTVB53IGPMYJ4H2BT26AKZBGDI32DIVHBX7ZMFOXILAC
JY7BXXOP3EZCDT5RSMVE4Y6IECXGYL4GEBJOZHR7H3Z35XZ3NIVQC
7ZQAHJQMEEREYP3PZAPO5JUMEDX4CNNJCCHTFQNEPOZZUJCIOVHQC
QL55ECJ6KMMBUOWQ6LKSOVN7L43CH4S6SPE2AQ3VX3KSGC32RP4AC
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("/"));
}
<form action="[% IF create %][% c.uri_for('/create-project/submit') %][% ELSE %][% c.uri_for('/project' project.name 'submit') %][% END %]" method="post">
<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>
<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>
<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>
<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
<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 %]
<script type="text/javascript">
$("#delete-project").click(function() {
return confirm("Are you sure you want to delete this project?");
});
</script>
[% END %]
</div>
[% 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>