Enable setting checkresponsible in the edit jobset form

Signed-off-by: Shea Levy <shea@shealevy.com>
This commit is contained in:
Shea Levy 2013-10-07 10:46:10 -04:00
parent 3e1f930928
commit 58ad3b4b6c
2 changed files with 11 additions and 3 deletions

View file

@ -229,7 +229,11 @@ sub updateJobset {
error($c, "Invalid input name $name.") unless $name =~ /^[[:alpha:]][\w-]*$/;
error($c, "Invalid input type $type.") unless defined $c->stash->{inputTypes}->{$type};
my $input = $jobset->jobsetinputs->create({ name => $name, type => $type });
my $input = $jobset->jobsetinputs->create({
name => $name,
type => $type,
checkresponsible => $c->stash->{params}->{"input-$baseName-checkresponsible"}
});
# Set the values for this input.
my @values = ref($values) eq 'ARRAY' ? @{$values} : ($values);

View file

@ -25,20 +25,23 @@
[% END %]
[% IF edit %]<button type="button" class="add-inputalt btn btn-success" onclick='return false'><i class="icon-plus icon-white"></i></button>[% END %]
</td>
<td>
<input type="checkbox" id="[% baseName %]-checkresponsible" name="[% baseName %]-checkresponsible" [% if input.checkresponsible; 'checked="checked"'; END %]/>
</td>
</tr>
[% END %]
[% BLOCK renderJobsetInputs %]
<table class="table table-striped table-condensed">
<thead>
<tr><th>Input name</th><th>Type</th><th>Values</th></tr>
<tr><th>Input name</th><th>Type</th><th>Values</th><th>Check for responsible commits?</tr>
</thead>
<tbody class="inputs">
[% FOREACH input IN jobset.jobsetinputs %]
[% INCLUDE renderJobsetInput input=input baseName="input-$input.name" %]
[% END %]
<tr>
<td colspan="3" style="text-align: center;"><button type="button" class="add-input btn btn-success"><i class="icon-plus icon-white"></i> Add a new input</button></td>
<td colspan="4" style="text-align: center;"><button type="button" class="add-input btn btn-success"><i class="icon-plus icon-white"></i> Add a new input</button></td>
</tr>
</tbody>
</table>
@ -164,6 +167,7 @@
var x = $("#input-template").clone(true).attr("id", "").insertBefore($(this).parents("tr")).show();
$("#input-template-name", x).attr("name", newid + "-name");
$("#input-template-type", x).attr("name", newid + "-type");
$("#input-template-checkresponsible", x).attr("name", newid + "-checkresponsible");
$("#input-template", x).attr("id", newid);
return false;
});