Commit 9529fa81 authored by Ryan Herbert's avatar Ryan Herbert

restyle set autocomplete

set autocompletion displays actual tokens that will be inserted
parent e1ef9fce
...@@ -2355,21 +2355,6 @@ form { ...@@ -2355,21 +2355,6 @@ form {
background: #3366FF; background: #3366FF;
color: white; color: white;
&.patient_li {
color: black;
background: @patientTokenColor;
}
&.run_li {
color: black;
background: @runTokenColor;
}
&.generic_li {
color: black;
background: @genericTokenColor;
}
small { small {
color: white; color: white;
} }
......
...@@ -142,7 +142,8 @@ VidjilAutoComplete.prototype = { ...@@ -142,7 +142,8 @@ VidjilAutoComplete.prototype = {
return { return {
id: i.id, id: i.id,
name: i.name, name: i.name,
search: i.name search: i.name,
set_type: i.type
}; };
}); });
return res; return res;
...@@ -159,9 +160,10 @@ VidjilAutoComplete.prototype = { ...@@ -159,9 +160,10 @@ VidjilAutoComplete.prototype = {
// encapsulate the string_id's set_type token (:p, :r, :s) within a span // encapsulate the string_id's set_type token (:p, :r, :s) within a span
li = li.replace(li.substr(4,2), li = li.replace(li.substr(4,2),
function(str) { function(str) {
return '<span class="autocomplete_li ' + mapper[set_type] + '">' + str + '</span>'; return '<span class="autocomplete_li ' + mapper[set_type] + '">' + str + '</span><span class="set_token '+ mapper[set_type] + '_token">';
}); });
li = li.replace('<li>', '<li class="' + mapper[set_type] + '_li">'); li = li.replace('<li>', '<li class="' + mapper[set_type] + '_li">');
li = li.replace('</li>', '</span></li>');
var regexp; var regexp;
if (!query) { if (!query) {
return li; return li;
......
...@@ -771,7 +771,7 @@ def get_sample_set_list(type): ...@@ -771,7 +771,7 @@ def get_sample_set_list(type):
helper = factory.get_instance(type=type) helper = factory.get_instance(type=type)
for row in query : for row in query :
tmp = helper.get_id_string(row) tmp = helper.get_id_string(row)
ss_list.append({'name':tmp, 'id': row.sample_set_id}) ss_list.append({'name':tmp, 'id': row.sample_set_id, 'type': type})
return ss_list return ss_list
def auto_complete(): def auto_complete():
......
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