Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
genotoul-bioinfo
jflow
Commits
d12e4f2e
Commit
d12e4f2e
authored
Feb 23, 2015
by
Jerome Mariette
Browse files
do not allow to overload the globalTemplate
parent
75499001
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/js/jflow-wfform.js
View file @
d12e4f2e
...
...
@@ -530,7 +530,7 @@ Handsontable.cellTypes["bootdate"] = Handsontable.BootstrapDateCell;
$this
.
$element
.
html
(
""
);
$
.
tmpl
(
$this
.
options
.
t
emplate
,
{
globalT
emplate
,
{
workflow
:
$this
.
workflow
,
display_run_button
:
$this
.
options
.
displayRunButton
,
display_reset_button
:
$this
.
options
.
displayResetButton
,
...
...
@@ -1035,6 +1035,121 @@ Handsontable.cellTypes["bootdate"] = Handsontable.BootstrapDateCell;
})
}
var
globalTemplate
=
[
'
<form id="workflow_form" class="form-horizontal" role="form">
'
,
'
{{each(gindex, group) workflow.groups}}
'
,
'
<fieldset>
'
,
'
{{if group != "default" && group.indexOf("exclude-") != 0 }}
'
,
'
<legend>${group}</legend>
'
,
'
{{/if}}
'
,
'
{{each(index, param) workflow.parameters_per_groups[group]}}
'
,
// it the parameter has not already been settled
'
{{if Object.keys(parameters).indexOf(param.name) == -1 }}
'
,
// if this is an exclusion group, only display one label and make only one structure
'
{{if (group.indexOf("exclude-") == 0 && index ==0) || group.indexOf("exclude-") != 0}}
'
,
'
<div class="form-group param-field">
'
,
'
<label id="label_${param.group}" class="col-sm-2 control-label" for="${param.name}">${param.display_name}</label>
'
,
'
{{/if}}
'
,
'
{{if group.indexOf("exclude-") == 0 }}
'
,
'
<div id="content_${param.name}" class="col-sm-9 ${param.group}{{if index != 0}} hidden hidden-exclude{{/if}}">
'
,
'
{{else}}
'
,
'
<div class="col-sm-10">
'
,
'
{{/if}}
'
,
// if it's a multiple type
'
{{if param.type == "MultipleParameters"}}
'
,
'
<blockquote style="font-size:14px;">
'
,
'
{{if param.action == "MiltipleAppendAction"}}
'
,
// if it's an append and multiple type
'
<div id="handsontable_${param.name}" > </div>
'
,
'
<span id="error_handsontable_${param.name}" class="help-block" for="read_2"></span>
'
,
'
<span id="help_handsontable_${param.name}" class="help-block">${param.help}</span>
'
,
'
{{else}}
'
,
// if it's a single and multiple type
'
{{each(spindex, sub_param) param.sub_parameters}}
'
,
'
<div class="param-field">
'
,
'
{{if sub_param.type == "bool"}}
'
,
'
{{html getParameterDisplay(templates, getTplName(sub_param), sub_param, sub_param.display_name)}}
'
,
'
{{else}}
'
,
'
<div class="input-group">
'
,
'
<span class="input-group-addon">${sub_param.display_name}</span>
'
,
'
{{html getParameterDisplay(templates, getTplName(sub_param), sub_param)}}
'
,
'
</div>
'
,
'
{{/if}}
'
,
'
<span class="help-block">${sub_param.help}</span> <br />
'
,
'
</div>
'
,
'
{{/each}}
'
,
'
{{/if}}
'
,
'
</blockquote>
'
,
// if it's a single type
'
{{else}}
'
,
'
{{html getParameterDisplay(templates, getTplName(param), param)}}
'
,
'
<span class="help-block">${param.help}</span>
'
,
'
{{/if}}
'
,
'
</div>
'
,
'
{{if group.indexOf("exclude-") == 0 && index == workflow.parameters_per_groups[group].length-1 }}
'
,
'
{{if group.indexOf("exclude-") == 0 }}
'
,
'
<div class="col-sm-1">
'
,
'
<span class="input-group-btn btn-group-xs">
'
,
'
<button id="prev_btn_${param.group}" class="btn btn-default" type="button"><span class="glyphicon glyphicon-chevron-left"></span> </button>
'
,
'
<button id="next_btn_${param.group}" class="btn btn-default" type="button"><span class="glyphicon glyphicon-chevron-right"></span> </button>
'
,
'
</span>
'
,
'
</div>
'
,
'
{{/if}}
'
,
'
</div>
'
,
'
{{else group.indexOf("exclude-") != 0}}
'
,
'
</div>
'
,
'
{{/if}}
'
,
'
{{else}}
'
,
// if the param is already settled, hide it
'
<input id="${param.name}" name="${param.name}" value="${parameters[param.name]}" type="hidden">
'
,
'
{{/if}}
'
,
'
{{/each}}
'
,
'
</fieldset>
'
,
'
{{/each}}
'
,
'
<fieldset>
'
,
// for all workflow add the workflowClass
'
<input name="workflow_class" value="${workflow.class}" type="hidden">
'
,
// add buttons if requested
'
{{if display_reset_button || display_run_button}}
'
,
'
<div class="row"> <div class="col-md-3 col-md-offset-9">
'
,
'
<div class="btn-group">
'
,
'
{{if display_reset_button}}
'
,
'
<button id="wfform_reset_btn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-refresh"></span> Reset</button>
'
,
'
{{/if}}
'
,
'
{{if display_run_button}}
'
,
'
<button id="wfform_run_btn" type="button" class="btn btn-primary"><span class="glyphicon glyphicon-cog"></span> Run</button>
'
,
'
{{/if}}
'
,
'
</div>
'
,
'
</div>
'
,
'
{{/if}}
'
,
'
</fieldset>
'
,
'
</form>
'
,
// add a second form for the files to upload
'
<form method="post" enctype="multipart/form-data" style="display:none;">
'
,
'
{{each(gindex, group) workflow.groups}}
'
,
'
{{each(index, param) workflow.parameters_per_groups[group]}}
'
,
// if param is an inputfile or just a browsefile
'
{{if param.type.indexOf("inputfile") === 0 || param.type.indexOf("browsefile") === 0}}
'
,
'
{{if param.action == "append"}}
'
,
'
<input name="browse_${param.name}" id="browse_${param.name}" class="fileupload" multiple type="file">
'
,
'
{{else}}
'
,
'
<input name="browse_${param.name}" id="browse_${param.name}" class="fileupload" type="file">
'
,
'
{{/if}}
'
,
// if it's a multiple type
'
{{else param.type == "MultipleParameters"}}
'
,
'
{{each(spindex, sub_param) param.sub_parameters}}
'
,
'
{{if sub_param.type.indexOf("inputfile") === 0 || sub_param.type.indexOf("browsefile") === 0}}
'
,
'
{{if param.action == "append"}}
'
,
'
<input name="browse_${sub_param.name}" id="browse_${sub_param.name}" multiple class="fileupload" type="file">
'
,
'
{{else}}
'
,
'
<input name="browse_${sub_param.name}" id="browse_${sub_param.name}" class="fileupload" type="file">
'
,
'
{{/if}}
'
,
'
{{/if}}
'
,
'
{{/each}}
'
,
'
{{/if}}
'
,
'
{{/each}}
'
,
'
{{/each}}
'
,
'
</form>
'
,
'
<div id="progress"></div>
'
].
join
(
'
\n
'
);
$
.
fn
.
wfform
.
defaults
=
{
serverURL
:
"
http://localhost:8080
"
,
dateTemplate
:
[
...
...
@@ -1150,121 +1265,6 @@ Handsontable.cellTypes["bootdate"] = Handsontable.BootstrapDateCell;
'
{{/if}}
'
,
'
</div>
'
].
join
(
'
\n
'
),
template
:
[
'
<form id="workflow_form" class="form-horizontal" role="form">
'
,
'
{{each(gindex, group) workflow.groups}}
'
,
'
<fieldset>
'
,
'
{{if group != "default" && group.indexOf("exclude-") != 0 }}
'
,
'
<legend>${group}</legend>
'
,
'
{{/if}}
'
,
'
{{each(index, param) workflow.parameters_per_groups[group]}}
'
,
// it the parameter has not already been settled
'
{{if Object.keys(parameters).indexOf(param.name) == -1 }}
'
,
// if this is an exclusion group, only display one label and make only one structure
'
{{if (group.indexOf("exclude-") == 0 && index ==0) || group.indexOf("exclude-") != 0}}
'
,
'
<div class="form-group param-field">
'
,
'
<label id="label_${param.group}" class="col-sm-2 control-label" for="${param.name}">${param.display_name}</label>
'
,
'
{{/if}}
'
,
'
{{if group.indexOf("exclude-") == 0 }}
'
,
'
<div id="content_${param.name}" class="col-sm-9 ${param.group}{{if index != 0}} hidden hidden-exclude{{/if}}">
'
,
'
{{else}}
'
,
'
<div class="col-sm-10">
'
,
'
{{/if}}
'
,
// if it's a multiple type
'
{{if param.type == "MultipleParameters"}}
'
,
'
<blockquote style="font-size:14px;">
'
,
'
{{if param.action == "MiltipleAppendAction"}}
'
,
// if it's an append and multiple type
'
<div id="handsontable_${param.name}" > </div>
'
,
'
<span id="error_handsontable_${param.name}" class="help-block" for="read_2"></span>
'
,
'
<span id="help_handsontable_${param.name}" class="help-block">${param.help}</span>
'
,
'
{{else}}
'
,
// if it's a single and multiple type
'
{{each(spindex, sub_param) param.sub_parameters}}
'
,
'
<div class="param-field">
'
,
'
{{if sub_param.type == "bool"}}
'
,
'
{{html getParameterDisplay(templates, getTplName(sub_param), sub_param, sub_param.display_name)}}
'
,
'
{{else}}
'
,
'
<div class="input-group">
'
,
'
<span class="input-group-addon">${sub_param.display_name}</span>
'
,
'
{{html getParameterDisplay(templates, getTplName(sub_param), sub_param)}}
'
,
'
</div>
'
,
'
{{/if}}
'
,
'
<span class="help-block">${sub_param.help}</span> <br />
'
,
'
</div>
'
,
'
{{/each}}
'
,
'
{{/if}}
'
,
'
</blockquote>
'
,
// if it's a single type
'
{{else}}
'
,
'
{{html getParameterDisplay(templates, getTplName(param), param)}}
'
,
'
<span class="help-block">${param.help}</span>
'
,
'
{{/if}}
'
,
'
</div>
'
,
'
{{if group.indexOf("exclude-") == 0 && index == workflow.parameters_per_groups[group].length-1 }}
'
,
'
{{if group.indexOf("exclude-") == 0 }}
'
,
'
<div class="col-sm-1">
'
,
'
<span class="input-group-btn btn-group-xs">
'
,
'
<button id="prev_btn_${param.group}" class="btn btn-default" type="button"><span class="glyphicon glyphicon-chevron-left"></span> </button>
'
,
'
<button id="next_btn_${param.group}" class="btn btn-default" type="button"><span class="glyphicon glyphicon-chevron-right"></span> </button>
'
,
'
</span>
'
,
'
</div>
'
,
'
{{/if}}
'
,
'
</div>
'
,
'
{{else group.indexOf("exclude-") != 0}}
'
,
'
</div>
'
,
'
{{/if}}
'
,
'
{{else}}
'
,
// if the param is already settled, hide it
'
<input id="${param.name}" name="${param.name}" value="${parameters[param.name]}" type="hidden">
'
,
'
{{/if}}
'
,
'
{{/each}}
'
,
'
</fieldset>
'
,
'
{{/each}}
'
,
'
<fieldset>
'
,
// for all workflow add the workflowClass
'
<input name="workflow_class" value="${workflow.class}" type="hidden">
'
,
// add buttons if requested
'
{{if display_reset_button || display_run_button}}
'
,
'
<div class="row"> <div class="col-md-3 col-md-offset-9">
'
,
'
<div class="btn-group">
'
,
'
{{if display_reset_button}}
'
,
'
<button id="wfform_reset_btn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-refresh"></span> Reset</button>
'
,
'
{{/if}}
'
,
'
{{if display_run_button}}
'
,
'
<button id="wfform_run_btn" type="button" class="btn btn-primary"><span class="glyphicon glyphicon-cog"></span> Run</button>
'
,
'
{{/if}}
'
,
'
</div>
'
,
'
</div>
'
,
'
{{/if}}
'
,
'
</fieldset>
'
,
'
</form>
'
,
// add a second form for the files to upload
'
<form method="post" enctype="multipart/form-data" style="display:none;">
'
,
'
{{each(gindex, group) workflow.groups}}
'
,
'
{{each(index, param) workflow.parameters_per_groups[group]}}
'
,
// if param is an inputfile or just a browsefile
'
{{if param.type.indexOf("inputfile") === 0 || param.type.indexOf("browsefile") === 0}}
'
,
'
{{if param.action == "append"}}
'
,
'
<input name="browse_${param.name}" id="browse_${param.name}" class="fileupload" multiple type="file">
'
,
'
{{else}}
'
,
'
<input name="browse_${param.name}" id="browse_${param.name}" class="fileupload" type="file">
'
,
'
{{/if}}
'
,
// if it's a multiple type
'
{{else param.type == "MultipleParameters"}}
'
,
'
{{each(spindex, sub_param) param.sub_parameters}}
'
,
'
{{if sub_param.type.indexOf("inputfile") === 0 || sub_param.type.indexOf("browsefile") === 0}}
'
,
'
{{if param.action == "append"}}
'
,
'
<input name="browse_${sub_param.name}" id="browse_${sub_param.name}" multiple class="fileupload" type="file">
'
,
'
{{else}}
'
,
'
<input name="browse_${sub_param.name}" id="browse_${sub_param.name}" class="fileupload" type="file">
'
,
'
{{/if}}
'
,
'
{{/if}}
'
,
'
{{/each}}
'
,
'
{{/if}}
'
,
'
{{/each}}
'
,
'
{{/each}}
'
,
'
</form>
'
,
'
<div id="progress"></div>
'
].
join
(
'
\n
'
),
progressTemplate
:
[
'
<dl class="dl-horizontal">
'
,
'
<div class="container-fluid"><div class="row"><div class="col-md-1 col-md-offset-2"><div class="inline floatingBarsG">
'
,
'
<div class="blockG" id="rotateG_01"></div>
'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment