Commit 4a79a673 authored by Mikaël Salson's avatar Mikaël Salson

Merge branch 'hotfix-s/3491-fix-multi-form' into 'dev'

Hotfix s/3491 fix multi form

Closes #3491

See merge request !298
parents 9f67f177 912472ac
Pipeline #41755 passed with stages
in 6 minutes and 19 seconds
......@@ -292,6 +292,8 @@ test_server_functional:
script:
- docker build --no-cache --build-arg git_branch=$CI_COMMIT_REF_NAME --build-arg build_env=TEST -t "vidjil/server:test" docker/vidjil-server
- docker build --no-cache --build-arg git_branch=$CI_COMMIT_REF_NAME --build-arg build_env=TEST -t "vidjil/client:test" docker/vidjil-client
- sed -i '/\/etc\/nginx\/ssl\:\/etc\/nginx\/ssl/d' ./docker/docker-compose.yml
- sed -i 's/\:latest/\:test/g' ./docker/docker-compose.yml
- cd docker && docker-compose up -d && cd ..
- sed -i "s/^python\ \.\.\/\.\.\/\.\./docker\ exec\ docker_uwsgi_1\ python\ \/usr\/share\/vidjil\/server\/web2py/" server/web2py/applications/vidjil/tests/init_func_test_db.sh
- docker exec docker_uwsgi_1 sed -i "s/^\(FILE_SOURCE .*\)/FILE_SOURCE = '\/usr\/share\/vidjil\/demo'/" /usr/share/vidjil/server/web2py/applications/vidjil/modules/defs.py
......
......@@ -43,7 +43,7 @@ FormBuilder.prototype.build_label = function(txt, object, field) {
var l = document.createElement('label');
l.htmlFor = field + "_" + this.index;
l.id = object + "_" + field + "__label_" + this.index;
l.innerText = txt + ":";
$(l).text(txt + ":"); // for compatibility with older browsers (FF32, IE7/8)
return l;
}
......@@ -96,14 +96,14 @@ FormBuilder.prototype.build_div = function(type) {
d.appendChild(c);
var s = document.createElement('span');
s.className = "left form_label"
s.innerText = capitalise(type == 'generic' ? 'set' : type) + " " + (this.index+1);
$(s).text(capitalise(type == 'generic' ? 'set' : type) + " " + (this.index+1)); // for compatibility with older browsers (FF32, IE7/8)
d.appendChild(s);
return d;
}
FormBuilder.prototype.build_legend = function(text) {
var l = document.createElement('legend');
l.innerText = text;
$(l).text(text); // for compatibility with older browsers (FF32, IE7/8)
return l;
}
......@@ -187,7 +187,6 @@ PatientFormBuilder.prototype.createCloseButton = function() {
var close = Object.getPrototypeOf(PatientFormBuilder.prototype).createCloseButton.call(this);
$(close).click(function() {
var button = document.getElementById('patient_button');
button.dataset.index --;
});
return close;
};
......@@ -219,7 +218,6 @@ RunFormBuilder.prototype.createCloseButton = function() {
var close = Object.getPrototypeOf(RunFormBuilder.prototype).createCloseButton.call(this);
$(close).click(function() {
var button = document.getElementById('run_button');
button.dataset.index--;
});
return close;
};
......@@ -247,7 +245,6 @@ GenericFormBuilder.prototype.createCloseButton = function() {
var close = Object.getPrototypeOf(GenericFormBuilder.prototype).createCloseButton.call(this);
$(close).click(function() {
var button = document.getElementById('generic_button');
button.dataset.index--;
});
return close;
};
......@@ -390,7 +387,6 @@ FileFormBuilder.prototype.createCloseButton = function() {
var close = Object.getPrototypeOf(FileFormBuilder.prototype).createCloseButton.call(this);
$(close).click(function() {
var button = document.getElementById('file_button');
button.dataset.index--;
});
return close;
}
......@@ -450,6 +450,8 @@ def submit():
if length not in length_mapping:
length_mapping[length] = set_type
for p in data[set_type]:
if p is None:
continue
errors = helper.validate(p)
action = "add"
if len(errors) > 0:
......
......@@ -43,17 +43,28 @@ class TestSampleSet < ServerTest
assert($b.select(:id => "group_select").present?)
# add more elements to form
for i in 0..3 do
for i in 0..4 do
$b.span(:id => "patient_button").click
# Delete a line to ensure robustness
if i == 2
l = $b.span(:text => "Patient %d" % (i+2)).parent
l.i(:class => "icon-cancel").click
end
end
# fill in form
for i in 0..4 do
form.text_field(:id => "patient_id_label_%d" % i).set("test_label %d" % i)
form.text_field(:id => "patient_first_name_%d"% i).set("first %d" % i)
form.text_field(:id => "patient_last_name_%d" % i).set("last %d" % i)
form.text_field(:id => "patient_birth_%d" % i).set("2010-10-10")
form.text_field(:id => "patient_info_%d" % i).set("patient %d #test #mytag%d" % [i, i])
if i > 2
k = i+1
else
k = i
end
form.text_field(:id => "patient_id_label_%d" % k).set("test_label %d" % k)
form.text_field(:id => "patient_first_name_%d"% k).set("first %d" % k)
form.text_field(:id => "patient_last_name_%d" % k).set("last %d" % k)
form.text_field(:id => "patient_birth_%d" % k).set("2010-10-10")
form.text_field(:id => "patient_info_%d" % k).set("patient %d #test #mytag%d" % [k, k])
end
form.input(:type => "submit").click
......
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