Make search work for full names in smart annotations [SCI-896]

This commit is contained in:
Oleksii Kriuchykhin 2017-01-18 16:57:51 +01:00
parent 8a220c2351
commit 6555fd02b6
2 changed files with 9 additions and 18 deletions

View file

@ -282,7 +282,9 @@ var SmartAnnotation = (function() {
function generateTemplate(map) { function generateTemplate(map) {
var res = ''; var res = '';
res += '<li class="atwho-li atwho-li-res" data-name="' + res += '<li class="atwho-li atwho-li-res" data-name="' +
map.name + '" data-id="' + map.id + '" data-type="' + truncateLongString(map.name,
<%= Constants::NAME_TRUNCATION_LENGTH %>) +
'" data-id="' + map.id + '" data-type="' +
map.type + '">'; map.type + '">';
switch(map.type) { switch(map.type) {
case 'tsk': case 'tsk':
@ -301,7 +303,8 @@ var SmartAnnotation = (function() {
res += '&nbsp;'; res += '&nbsp;';
res += '<span data-val="name" class="res-name">'; res += '<span data-val="name" class="res-name">';
res += map.name; res += truncateLongString(map.name,
<%= Constants::NAME_TRUNCATION_LENGTH %>);
res += '</span>'; res += '</span>';
if(map.archived) { if(map.archived) {
res += '<%= I18n.t("atwho.res.archived") %></span>'; res += '<%= I18n.t("atwho.res.archived") %></span>';

View file

@ -19,10 +19,7 @@ class SmartAnnotation
res.each do |my_module_res| res.each do |my_module_res|
my_mod = {} my_mod = {}
my_mod['id'] = my_module_res.id.base62_encode my_mod['id'] = my_module_res.id.base62_encode
my_mod['name'] = truncate( my_mod['name'] = sanitize(my_module_res.name)
sanitize(my_module_res.name,
length: Constants::NAME_TRUNCATION_LENGTH)
)
my_mod['archived'] = my_module_res.archived my_mod['archived'] = my_module_res.archived
my_mod['experimentName'] = truncate( my_mod['experimentName'] = truncate(
sanitize(my_module_res.experiment.name, sanitize(my_module_res.experiment.name,
@ -48,10 +45,7 @@ class SmartAnnotation
res.each do |project_res| res.each do |project_res|
prj = {} prj = {}
prj['id'] = project_res.id.base62_encode prj['id'] = project_res.id.base62_encode
prj['name'] = truncate( prj['name'] = sanitize(project_res.name)
sanitize(project_res.name,
length: Constants::NAME_TRUNCATION_LENGTH)
)
prj['type'] = 'prj' prj['type'] = 'prj'
projects_list << prj projects_list << prj
end end
@ -67,10 +61,7 @@ class SmartAnnotation
res.each do |experiment_res| res.each do |experiment_res|
exp = {} exp = {}
exp['id'] = experiment_res.id.base62_encode exp['id'] = experiment_res.id.base62_encode
exp['name'] = truncate( exp['name'] = sanitize(experiment_res.name)
sanitize(experiment_res.name,
length: Constants::NAME_TRUNCATION_LENGTH)
)
exp['type'] = 'exp' exp['type'] = 'exp'
exp['projectName'] = truncate( exp['projectName'] = truncate(
sanitize(experiment_res.project.name, sanitize(experiment_res.project.name,
@ -90,10 +81,7 @@ class SmartAnnotation
res.each do |sample_res| res.each do |sample_res|
sam = {} sam = {}
sam['id'] = sample_res.id.base62_encode sam['id'] = sample_res.id.base62_encode
sam['name'] = truncate( sam['name'] = sanitize(sample_res.name)
sanitize(sample_res.name,
length: Constants::NAME_TRUNCATION_LENGTH)
)
sam['description'] = "#{I18n.t('Added')} #{I18n.l( sam['description'] = "#{I18n.t('Added')} #{I18n.l(
sample_res.created_at, format: :full_date sample_res.created_at, format: :full_date
)} #{I18n.t('by')} #{truncate( )} #{I18n.t('by')} #{truncate(