From 6555fd02b6c9aeb0e1a066a9ef9a9a4766764d55 Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Wed, 18 Jan 2017 16:57:51 +0100 Subject: [PATCH] Make search work for full names in smart annotations [SCI-896] --- .../javascripts/sitewide/atwho_res.js.erb | 7 +++++-- app/utilities/smart_annotation.rb | 20 ++++--------------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/app/assets/javascripts/sitewide/atwho_res.js.erb b/app/assets/javascripts/sitewide/atwho_res.js.erb index c9362f062..ad6e5c039 100644 --- a/app/assets/javascripts/sitewide/atwho_res.js.erb +++ b/app/assets/javascripts/sitewide/atwho_res.js.erb @@ -282,7 +282,9 @@ var SmartAnnotation = (function() { function generateTemplate(map) { var res = ''; res += '
  • '; switch(map.type) { case 'tsk': @@ -301,7 +303,8 @@ var SmartAnnotation = (function() { res += ' '; res += ''; - res += map.name; + res += truncateLongString(map.name, + <%= Constants::NAME_TRUNCATION_LENGTH %>); res += ''; if(map.archived) { res += '<%= I18n.t("atwho.res.archived") %>'; diff --git a/app/utilities/smart_annotation.rb b/app/utilities/smart_annotation.rb index dcd7414c8..b183b3878 100644 --- a/app/utilities/smart_annotation.rb +++ b/app/utilities/smart_annotation.rb @@ -19,10 +19,7 @@ class SmartAnnotation res.each do |my_module_res| my_mod = {} my_mod['id'] = my_module_res.id.base62_encode - my_mod['name'] = truncate( - sanitize(my_module_res.name, - length: Constants::NAME_TRUNCATION_LENGTH) - ) + my_mod['name'] = sanitize(my_module_res.name) my_mod['archived'] = my_module_res.archived my_mod['experimentName'] = truncate( sanitize(my_module_res.experiment.name, @@ -48,10 +45,7 @@ class SmartAnnotation res.each do |project_res| prj = {} prj['id'] = project_res.id.base62_encode - prj['name'] = truncate( - sanitize(project_res.name, - length: Constants::NAME_TRUNCATION_LENGTH) - ) + prj['name'] = sanitize(project_res.name) prj['type'] = 'prj' projects_list << prj end @@ -67,10 +61,7 @@ class SmartAnnotation res.each do |experiment_res| exp = {} exp['id'] = experiment_res.id.base62_encode - exp['name'] = truncate( - sanitize(experiment_res.name, - length: Constants::NAME_TRUNCATION_LENGTH) - ) + exp['name'] = sanitize(experiment_res.name) exp['type'] = 'exp' exp['projectName'] = truncate( sanitize(experiment_res.project.name, @@ -90,10 +81,7 @@ class SmartAnnotation res.each do |sample_res| sam = {} sam['id'] = sample_res.id.base62_encode - sam['name'] = truncate( - sanitize(sample_res.name, - length: Constants::NAME_TRUNCATION_LENGTH) - ) + sam['name'] = sanitize(sample_res.name) sam['description'] = "#{I18n.t('Added')} #{I18n.l( sample_res.created_at, format: :full_date )} #{I18n.t('by')} #{truncate(