Commit 81dce337 authored by Mikaël Salson's avatar Mikaël Salson

controllers/file.py, views/*/form.html: Move network_source definition to the controller

As suggested by @RyanHerb this type of definition should be moved to the controller
parent 3556f517
Pipeline #29698 passed with stages
in 25 seconds
......@@ -302,6 +302,10 @@ def submit():
def form_response(data):
source_module_active = hasattr(defs, 'FILE_SOURCE') and hasattr(defs, 'FILE_TYPES')
network_source = source_module_active and (data['action'] != 'edit' \
or len(data['file']) == 0 \
or data['file'][0].network)
# should be true only when we want to use the network view
response.view = 'file/form.html'
upload_group_ids = [int(gid) for gid in get_upload_group_ids(auth)]
group_ids = get_involved_groups()
......@@ -313,6 +317,7 @@ def form_response(data):
sample_type = data['sample_type'],
errors = data['errors'],
source_module_active = source_module_active,
network_source = network_source,
group_ids = group_ids,
upload_group_ids = upload_group_ids,
isEditing = data['action']=='edit')
......
......@@ -7,12 +7,10 @@
<h3>Add samples</h3>
{{ pass }}
{{ network_source = source_module_active }}
{{ required_files = 1 }}
{{ if source_module_active: }}
<span>file source: </span>
<label for="source_computer">my computer</label>
{{ network_source = not 'file_id' in request.vars or files[0].network }}
<input type="radio" id="source_computer" name="source" value="computer" onchange="db.toggle_file_source()" {{ if not network_source: }} checked="checked" {{pass}}/>
<label for="source_nfs">network</label>
<input type="radio" id="source_nfs" name="source" value="nfs" onchange="db.toggle_file_source()" {{if network_source:}} checked="checked" {{pass}} />
......
Markdown is supported
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