This commit is contained in:
parent
58cb6fbea5
commit
f742871910
|
@ -286,6 +286,8 @@ sub updateReleaseSet {
|
||||||
my $description = trim $c->request->params->{"job-$baseName-description"};
|
my $description = trim $c->request->params->{"job-$baseName-description"};
|
||||||
my $attrs = trim $c->request->params->{"job-$baseName-attrs"};
|
my $attrs = trim $c->request->params->{"job-$baseName-attrs"};
|
||||||
|
|
||||||
|
die "Invalid job name: $name" unless $name =~ /^\w+$/;
|
||||||
|
|
||||||
$releaseSet->releasesetjobs->create(
|
$releaseSet->releasesetjobs->create(
|
||||||
{ job => $name
|
{ job => $name
|
||||||
, description => $description
|
, description => $description
|
||||||
|
|
|
@ -4,6 +4,23 @@
|
||||||
|
|
||||||
<h1>Release Set <tt>[% curProject.name %]:[% releaseSet.name %]</tt></h1>
|
<h1>Release Set <tt>[% curProject.name %]:[% releaseSet.name %]</tt></h1>
|
||||||
|
|
||||||
|
|
||||||
|
[% BLOCK renderJob %]
|
||||||
|
<tr id="[% id %]" >
|
||||||
|
<td>
|
||||||
|
<button type="button" onclick='$(this).parents("tr").remove()'>
|
||||||
|
<img src="/static/images/failure.gif" alt="Delete job" />
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
<td><input type="radio" id="[% "$baseName-primary" %]" name="primary" [% IF job.isprimary %]
|
||||||
|
checked="checked" [% END %] [% HTML.attributes(value => "$n") %] /> [% n %]</td>
|
||||||
|
<td><input type="text" class="string" [% HTML.attributes(id => "$baseName-name", name => "$baseName-name", value => job.job) %] /></td>
|
||||||
|
<td><input type="text" class="string" [% HTML.attributes(id => "$baseName-description", name => "$baseName-description", value => job.description) %] /></td>
|
||||||
|
<td><input type="text" class="string" [% HTML.attributes(id => "$baseName-attrs", name => "$baseName-attrs", value => job.attrs) %] /></td>
|
||||||
|
</tr>
|
||||||
|
[% END %]
|
||||||
|
|
||||||
|
|
||||||
<form action="[% IF create %][% ELSE %][% c.uri_for('/releases' curProject.name releaseSet.name 'submit') %][% END %]" method="post">
|
<form action="[% IF create %][% ELSE %][% c.uri_for('/releases' curProject.name releaseSet.name 'submit') %][% END %]" method="post">
|
||||||
|
|
||||||
<table class="layoutTable">
|
<table class="layoutTable">
|
||||||
|
@ -20,6 +37,7 @@
|
||||||
<table class="tablesorter">
|
<table class="tablesorter">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th></th>
|
||||||
<th>Primary job</th>
|
<th>Primary job</th>
|
||||||
<th>Job name</th>
|
<th>Job name</th>
|
||||||
<th>Description</th>
|
<th>Description</th>
|
||||||
|
@ -29,15 +47,12 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
[% n = 0 %]
|
[% n = 0 %]
|
||||||
[% FOREACH job IN jobs %]
|
[% FOREACH job IN jobs %]
|
||||||
<tr>
|
[% INCLUDE renderJob baseName="job-$n" %]
|
||||||
<td><input type="radio" name="primary" [% IF job.isprimary %]
|
|
||||||
checked="checked" [% END %] [% HTML.attributes(value => "$n") %] /> [% n %]</td>
|
|
||||||
<td><input type="text" class="string" [% HTML.attributes(name => "job-$n-name", value => job.job) %] /></td>
|
|
||||||
<td><input type="text" class="string" [% HTML.attributes(name => "job-$n-description", value => job.description) %] /></td>
|
|
||||||
<td><input type="text" class="string" [% HTML.attributes(name => "job-$n-attrs", value => job.attrs) %] /></td>
|
|
||||||
</tr>
|
|
||||||
[% n = n + 1 %]
|
[% n = n + 1 %]
|
||||||
[% END %]
|
[% END %]
|
||||||
|
<tr>
|
||||||
|
<td colspan="5"><button type="button" class="add-job">Add a new job</button></td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
@ -46,4 +61,27 @@
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
<table class="template"> <!-- dummy wrapper needed because “hidden” trs are visible anyway -->
|
||||||
|
[% INCLUDE renderJob job="" id="job-template" baseName="job-template" %]
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
var id = [% n %];
|
||||||
|
|
||||||
|
$(".add-job").click(function() {
|
||||||
|
var newnr = id++;
|
||||||
|
var newid = "job-" + newnr;
|
||||||
|
var x = $("#job-template").clone(true).attr("id", "").insertBefore($(this).parents("tr")).show();
|
||||||
|
$("#job-template-name", x).attr("name", newid + "-name");
|
||||||
|
$("#job-template-description", x).attr("name", newid + "-description");
|
||||||
|
$("#job-template-attrs", x).attr("name", newid + "-attrs");
|
||||||
|
$("#job-template-primary", x).attr("value", newnr);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|
Loading…
Reference in a new issue