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

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