From e8ac75482923ae1159fc81dcd4f6513024da4975 Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Thu, 22 Sep 2016 14:36:51 +0200 Subject: [PATCH] Fix issue with long tags in dropdown list [fixes SCI-470] --- app/views/my_module_tags/_index_edit.html.erb | 2 +- app/views/my_modules/modals/_manage_module_tags_modal.html.erb | 2 +- config/initializers/constants.rb | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/my_module_tags/_index_edit.html.erb b/app/views/my_module_tags/_index_edit.html.erb index 0b485a09d..f3d5d7ba8 100644 --- a/app/views/my_module_tags/_index_edit.html.erb +++ b/app/views/my_module_tags/_index_edit.html.erb @@ -63,7 +63,7 @@ <%= bootstrap_form_for [@my_module, @new_mmt], remote: true, format: :json, html: { class: 'add-tag-form' } do |f| %>
- <%= collection_select(:my_module_tag, :tag_id, @unassigned_tags, :id, :name, {}, { class: 'selectpicker' }) %> + <%= collection_select(:my_module_tag, :tag_id, @unassigned_tags.collect{ |t| t.name = t.name.truncate(DROPDOWN_TEXT_MAX_LENGTH, omission: '...'); t }, :id, :name, {}, { class: 'selectpicker' }) %> <%= f.button class: 'btn btn-primary' do %> diff --git a/app/views/my_modules/modals/_manage_module_tags_modal.html.erb b/app/views/my_modules/modals/_manage_module_tags_modal.html.erb index 23e34bfda..94f977386 100644 --- a/app/views/my_modules/modals/_manage_module_tags_modal.html.erb +++ b/app/views/my_modules/modals/_manage_module_tags_modal.html.erb @@ -11,4 +11,4 @@
- \ No newline at end of file + diff --git a/config/initializers/constants.rb b/config/initializers/constants.rb index 104c1264d..12aa8611a 100644 --- a/config/initializers/constants.rb +++ b/config/initializers/constants.rb @@ -38,6 +38,8 @@ TABLE_JSON_MAX_SIZE = 20 FILE_MAX_SIZE = 50 # Max uploaded user avatar size in MB AVATAR_MAX_SIZE = 0.2 +# Max characters for text in dropdown list +DROPDOWN_TEXT_MAX_LENGTH = 15 SEARCH_LIMIT = 20