hydra/src/root/edit-project.tt
2013-10-14 17:35:14 +02:00

84 lines
2.5 KiB
Plaintext

[% WRAPPER layout.tt title=(create ? "New project" : "Editing project $project.name") %]
[% PROCESS common.tt %]
<form class="form-horizontal">
<fieldset>
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input type="checkbox" name="enabled" [% IF project.enabled; 'checked="checked"'; END %]/>Enabled
</label>
</div>
<div class="controls">
<label class="checkbox">
<input type="checkbox" name="visible" [% IF !project.hidden; 'checked="checked"'; END %]/>Visible in the list of projects
</label>
</div>
</div>
<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) %]/>
</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) %]/>
</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) %]/>
</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) %]/>
</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) %]/>
</div>
</div>
<div class="form-actions">
<button id="submit-project" type="submit" class="btn btn-primary">
<i class="icon-ok icon-white"></i>
[%IF create %]Create project[% ELSE %]Apply changes[% END %]
</button>
</div>
</fieldset>
</form>
<script type="text/javascript">
$("#submit-project").click(function() {
redirectJSON({
[% IF create %]
url: "[% c.uri_for('/project' '.new') %]",
[% ELSE %]
url: "[% c.uri_for('/project' project.name) %]",
[% END %]
data: $(this).parents("form").serialize(),
type: 'PUT'
});
return false;
});
</script>
[% END %]