Commit ad43ce2d authored by Jerome Mariette's avatar Jerome Mariette
Browse files

Allow from the ui interface to set some values

parent 12b1c11d
......@@ -143,7 +143,7 @@
}
$this.$element.html("");
$.tmpl($this.options.template, {workflow: workflow, display_run_button: $this.options.displayRunButton,
display_reset_button: $this.options.displayResetButton}).appendTo($this.$element);
display_reset_button: $this.options.displayResetButton, parameters: $this.options.parameters}).appendTo($this.$element);
$('.date').datepicker().on('changeDate', function(ev){ $('.date').datepicker('hide');} );
for (var i in workflow.parameters) {
if (workflow.parameters[i].type == "int") {
......@@ -198,6 +198,8 @@
template: ['<form id="workflow_form" class="form-horizontal">',
'<fieldset>',
' {{each(index, param) workflow.parameters}}',
// it the parameter has ne already been settled
' {{if Object.keys(parameters).indexOf(param.name) == -1 }}',
' <div class="control-group">',
' <label class="control-label">${param.name}</label>',
' <div class="controls">',
......@@ -213,20 +215,20 @@
' {{/each}}',
' </select>',
// if param is a date
' {{else param.type == "date"}}',
' <div class="input-append date" data-date="${param.default}" data-date-format="dd/mm/yyyy">',
' <input name="${param.name}" class="input-xlarge span2" type="text" value="${param.default}">',
' <button class="btn" type="button"><i class="icon-calendar"></i></button>',
' </div>',
' {{else param.type == "date"}}',
' <div class="input-append date" data-date="${param.default}" data-date-format="dd/mm/yyyy">',
' <input name="${param.name}" class="input-xlarge span2" type="text" value="${param.default}">',
' <button class="btn" type="button"><i class="icon-calendar"></i></button>',
' </div>',
// if param is a boolean
' {{else param.type == "bool"}}',
' <label class="checkbox">',
' {{if param.default == true}}',
' <input name="${param.name}" value="${param.default}" type="checkbox" checked>',
' {{else}}',
' <input name="${param.name}" value="${param.default}" type="checkbox">',
' {{else param.type == "bool"}}',
' <label class="checkbox">',
' {{if param.default == true}}',
' <input name="${param.name}" value="${param.default}" type="checkbox" checked>',
' {{else}}',
' <input name="${param.name}" value="${param.default}" type="checkbox">',
' {{/if}}',
' </label>',
' </label>',
// else a simple text input
' {{else}}',
' <input name="${param.name}" value="${param.default}" class="input-xlarge" type="text">',
......@@ -234,6 +236,10 @@
' <span class="help-block">${param.help}</span>',
' </div>',
' </div>',
' {{else}}',
// if the param is already settled, hide it
' <input name="${param.name}" value="${parameters[param.name]}" type="hidden">',
' {{/if}}',
' {{/each}}',
// for all workflow add the workflowClass
' <input name="workflow_class" value="${workflow.class}" type="hidden">',
......@@ -255,7 +261,8 @@
'</form>'].join('\n'),
workflowClass: null,
displayRunButton: true,
displayResetButton: true
displayResetButton: true,
parameters: {}
}
$.fn.wfform.Constructor = WFForm
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment