Commit 499ed5a8 authored by Ryan Herbert's avatar Ryan Herbert

file.py sample_set.py pass isEditing to views

in order to display the correct header for forms
parent 6187623c
Pipeline #19908 passed with stages
in 45 seconds
......@@ -156,6 +156,7 @@ def form():
if stype not in relevant_ids:
relevant_ids[stype] = []
relevant_ids[stype].append(row.id)
action = 'add'
# edit file
elif 'file_id' in request.vars:
......@@ -173,6 +174,7 @@ def form():
if smp_type not in relevant_ids:
relevant_ids[smp_type] = []
relevant_ids[smp_type].append(db(db[smp_type].sample_set_id == row.sample_set_id).select()[0].id)
action = 'edit'
sample_type = request.vars["sample_type"]
else:
......@@ -189,6 +191,7 @@ def form():
data['sets'] = sets
data['sample_type'] = sample_type
data['errors'] = []
data['action'] = action
return form_response(data)
......@@ -303,7 +306,8 @@ def form_response(data):
errors = data['errors'],
source_module_active = source_module_active,
group_ids = group_ids,
upload_group_ids = upload_group_ids)
upload_group_ids = upload_group_ids,
isEditing = data['action']=='edit')
def upload():
session.forget(response)
......
......@@ -389,7 +389,7 @@ def form():
sset = db(db[set_type].sample_set_id == sample_set.id).select().first()
if(auth.can_modify_sample_set(sset.sample_set_id)):
groups = [get_set_group(sset.sample_set_id)]
message = 'edit %s' % set_type
action = 'edit'
max_group = None
else:
denied = True
......@@ -401,7 +401,7 @@ def form():
creation_group_tuple = get_default_creation_group(auth)
groups = creation_group_tuple[0]
max_group = creation_group_tuple[1]
message = 'add %s' % set_type
action = 'add'
else :
denied = True
......@@ -410,6 +410,7 @@ def form():
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
message = '%s %s' % (action, set_type)
sets = {
'patient': [],
'run': [],
......@@ -420,7 +421,8 @@ def form():
return dict(message=T(message),
groups=groups,
master_group=max_group,
sets=sets)
sets=sets,
isEditing = (action=='edit'))
......
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