* Adding input value alternatives.

This commit is contained in:
Eelco Dolstra 2008-11-17 13:36:58 +00:00
parent 2650094643
commit 0c0175d88e
5 changed files with 61 additions and 27 deletions

View file

@ -196,7 +196,7 @@
<ul class="productList">
[% FOREACH product IN build.buildproducts -%]
<li>
<li class="product">
[% SWITCH product.type %]
[% CASE "nix-build" %]
@ -213,8 +213,8 @@
File <tt>[% product.name %]</tt> of type <tt>[% product.subtype %]</tt>
[% END %]
</a>
[<a href="javascript:" onclick="javascript:$('#foo-[% product.productnr %]').toggle()">details</a>]
<div class="productDetails" id="foo-[% product.productnr %]">
[<a class="productDetailsToggle" href="javascript:">details</a>]
<div class="productDetails">
<table>
<tr>
<th>URL:</th>
@ -262,12 +262,21 @@
</ul>
<script>
$(document).ready(function() {
$('.productDetailsToggle').toggle(
function () { $(".productDetails", $(this).parents(".product")).fadeIn(); },
function () { $(".productDetails", $(this).parents(".product")).hide(); }
);
});
</script>
[% END %]
[% IF build.buildlogs %]
<div id="bla">
<div>
<h2>Logs</h2>

View file

@ -26,6 +26,7 @@ table {
empty-cells: show;
border-collapse: collapse;
border-spacing: 0px;
margin-bottom: 1em;
}
th {
@ -179,24 +180,21 @@ tr.runningJob {
margin-left: 3em;
}
div.template {
.template {
display: none;
}
div.jobset {
border: solid black 1px;
-moz-border-radius: 1em;
border-radius: 1em;
padding-left: 1em;
padding-right: 1em;
padding-bottom: 1em;
margin-bottom: 1em;
}
div.jobset-edit {
border: solid black 1px;
background-color: #f8f8f8;
padding-left: 1em;
padding-right: 1em;
margin-bottom: 1em;
}
div.jobset-edit h3, div.jobset h3 {

View file

@ -14,7 +14,7 @@
<head>
<title>[% title %]</title>
<link rel="stylesheet" href="/hydra.css" type="text/css" />
<script type="text/javascript" src="/static/js/tablesorter/jquery-latest.js"></script>
<script type="text/javascript" src="/static/js/jquery-pack.js"></script>
<script type="text/javascript" src="/static/js/tablesorter/jquery.tablesorter.js"></script>
<script type="text/javascript">
$(document).ready(

View file

@ -57,14 +57,25 @@
<h4>Inputs</h4>
[% IF edit %]
<p><button onclick='$(this).parents(".jobset").remove()'>Add a new input</button></p>
[% END %]
<table class="tablesorter">
<thead>
<tr><th>Input name</th><th>Type</th><th>Values</th></tr>
<tr>[% IF edit %]<th></th>[% END %]<th>Input name</th><th>Type</th><th>Values</th></tr>
</thead>
<tbody>
[% FOREACH input IN jobset.jobsetinputs -%]
<tr>
<td><tt>[% INCLUDE maybeEditString param="jobset-$baseName-input-$input.name-name" value=input.name extraClass="shortString" %]</tt></td>
<tr class="input">
[% IF edit %]
<td>
[% IF edit %]<a href="javascript:" onclick='$(this).parents(".input").remove()'>[X]</a>[% END -%]
</td>
[% END %]
<td>
<tt>[% INCLUDE maybeEditString param="jobset-$baseName-input-$input.name-name" value=input.name extraClass="shortString" %]</tt>
</td>
<td>
[% IF edit %]
<select name="[% "jobset-$baseName-input-$input.name-type" %]">
@ -78,16 +89,18 @@
[% INCLUDE renderInputType type=input.type %]
[% END %]
</td>
<td>
<td class="inputalts" id="[% "jobset-$baseName-input-$input.name" %]">
[% FOREACH alt IN input.jobsetinputalts -%]
<tt>
<tt class="inputalt">
[% IF input.type == "string" && !edit %]
"[% HTML.escape(alt.value) %]"
[% ELSE %]
[% INCLUDE maybeEditString param="jobset-$baseName-input-$input.name-values" value=alt.value %]
[% IF edit %]<a href="javascript:" onclick='$(this).parents(".inputalt").remove()'>[X]</a>[% END %]
[% END %]
</tt>
[% END %]
[% IF edit %]<a href="javascript:" class="addinputalt">[+]</a>[% END %]
</td>
</tr>
[% END %]
@ -95,7 +108,8 @@
</table>
[% IF edit %]
<p><button onclick='$(this).parents(".jobset").remove()' id="jobset-[% baseName %]-delete">Delete this jobset</button></p>
<hr />
<p><button onclick='$(this).parents(".jobset").remove()'>Delete this jobset</button></p>
[% END %]
</div>
@ -145,17 +159,30 @@
<div id="jobset-template" class="template">
[% INCLUDE renderJobset jobset="" baseName="template" %]
</div>
<tt id="inputalt-template" class="inputalt template">
<input type="text" class="string" />
<a href="javascript:" onclick='$(this).parents(".inputalt").remove()'>[X]</a>
</tt>
<script>
var id = 0;
$("#add-jobset").click(function() {
var newid = "jobset-" + id++;
$("#jobset-template").clone(true).attr("id", newid).insertAfter($("#jobset-template")).show();
$("#jobset-template-name", $("#" + newid)).attr("name", newid + "-name");
$("#jobset-template-description", $("#" + newid)).attr("name", newid + "-description");
$("#jobset-template-nixexprpath", $("#" + newid)).attr("name", newid + "-nixexprpath");
$("#jobset-template-nixexprinput", $("#" + newid)).attr("name", newid + "-nixexprinput");
return false;
$(document).ready(function() {
var id = 0;
$("#add-jobset").click(function() {
var newid = "jobset-" + id++;
$("#jobset-template").clone(true).attr("id", newid).insertAfter($("#jobset-template")).slideDown("fast");
$("#jobset-template-name", $("#" + newid)).attr("name", newid + "-name");
$("#jobset-template-description", $("#" + newid)).attr("name", newid + "-description");
$("#jobset-template-nixexprpath", $("#" + newid)).attr("name", newid + "-nixexprpath");
$("#jobset-template-nixexprinput", $("#" + newid)).attr("name", newid + "-nixexprinput");
return false;
});
$(".addinputalt").click(function() {
var x = $("#inputalt-template").clone(true).insertBefore($(this)).show();
$("input", x).attr("name", x.parent(".inputalts").attr("id") + "-values");
});
});
</script>
[% END %]

View file

@ -35,7 +35,7 @@ sub fetchInput {
my $type = $input->type;
if ($type eq "path") {
my $uri = $alt->uri;
my $uri = $alt->value;
my $storePath = `nix-store --add "$uri"`
or die "cannot copy path $uri to the Nix store";
chomp $storePath;