QU5I5GCLSKUEKWPQBFPEHHLH3OODK6KSFHDAIDN52U45U6FNTFNAC
[% 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 %]
<tr>
<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>
[% INCLUDE renderJob baseName="job-$n" %]
<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>