Commit a0f88e82 authored by Ryan Herbert's avatar Ryan Herbert
Browse files

sample autocomplete aesthetics

using CSS, hides the sample id string prefix and displays the full name
of the set type.

See #2981
parent e20ec689
......@@ -2361,6 +2361,25 @@ label.highlight_label {
border-bottom: 1px solid #DDD;
cursor: pointer;
/* border-top: 1px solid #C8C8C8; */
&.patient_li:before {
font-size: 80%;
content: 'patient';
}
&.run_li:before {
font-size: 80%;
content: 'run';
}
&.generic_li:before {
font-size: 80%;
content: 'generic';
}
& span.autocomplete_li {
display: none;
}
}
}
......
......@@ -149,11 +149,17 @@ VidjilAutoComplete.prototype = {
// code modified from atwho source
callbacks.highlighter = function(li, query) {
var css_classes = {'p': 'patient_li',
'r': 'run_li',
's': 'generic_li'}
var mapper = {'p': 'patient',
'r': 'run',
's': 'generic'}
li = li.replace('<li>', '<li class=' + css_classes[li.charAt(5)] + '>');
var set_type = li.charAt(5)
li = li.replace(li.substr(4,2),
function(str) {
return '<span class="autocomplete_li ' + mapper[set_type] + '">' + str + '</span>';
});
li = li.replace('<li>', '<li class="' + mapper[set_type] + '_li">');
var regexp;
if (!query) {
return li;
......
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