Skip to content

Commit

Permalink
Merge branch 'seek-1.15' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
stuzart committed May 15, 2024
2 parents 0353b71 + 932bb6b commit c2dffbb
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/helpers/search_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module SearchHelper

def search_type_options
[['All', '']] | Seek::Util.searchable_types.collect { |c| [(c.name.underscore.humanize == 'Sop' ? t('sop') : c.name.underscore.humanize.pluralize), c.name.underscore.pluralize] }
[['All', '']] | Seek::Util.searchable_types.collect { |c| [(c.name.underscore.humanize == 'Sop' ? t('sop') : t(c.name.underscore).humanize.pluralize), c.name.underscore.pluralize] }
end

def external_search_tooltip_text
Expand Down
4 changes: 4 additions & 0 deletions lib/seek/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@ def templates_enabled
isa_json_compliance_enabled
end

def strains_enabled
organisms_enabled
end

def omniauth_elixir_aai_config
if omniauth_elixir_aai_legacy_mode
{
Expand Down
48 changes: 48 additions & 0 deletions test/functional/homes_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,54 @@ class HomesControllerTest < ActionController::TestCase

end

test 'Show aliases in search options' do
original_load_path = I18n.load_path
I18n.load_path += Dir[Rails.root.join('test', 'config', 'translation_override.en.yml')]
I18n.backend.load_translations
with_config_values({ isa_json_compliance_enabled: true, solr_enabled: true }) do
get :index
assert_response :success
assert_select 'select#search_type' do
assert_select 'option', text: 'Investigation tests', count: 1
assert_select 'option', text: 'Study tests', count: 1
assert_select 'option', text: 'Assay tests', count: 1
assert_select 'option', text: 'Data file tests', count: 1
assert_select 'option', text: 'Document tests', count: 1
assert_select 'option', text: 'SOP_test', count: 1 # this is an exception, the alias is not in the translation file
assert_select 'option', text: 'Presentation tests', count: 1
assert_select 'option', text: 'Event tests', count: 1
assert_select 'option', text: 'Collection tests', count: 1
assert_select 'option', text: 'Sample tests', count: 1
assert_select 'option', text: 'Sample type tests', count: 1
assert_select 'option', text: 'Template tests', count: 1
assert_select 'option', text: 'Person tests', count: 1
assert_select 'option', text: 'Project tests', count: 1
assert_select 'option', text: 'Institution tests', count: 1
assert_select 'option', text: 'Programme tests', count: 1

# Making sure the default values are not shown
assert_select 'option', text: 'Investigations', count: 0
assert_select 'option', text: 'Studies', count: 0
assert_select 'option', text: 'Assays', count: 0
assert_select 'option', text: 'Data files', count: 0
assert_select 'option', text: 'Documents', count: 0
assert_select 'option', text: 'SOP', count: 0
assert_select 'option', text: 'Presentations', count: 0
assert_select 'option', text: 'Events', count: 0
assert_select 'option', text: 'Collections', count: 0
assert_select 'option', text: 'Samples', count: 0
assert_select 'option', text: 'Sample types', count: 0
assert_select 'option', text: 'Templates', count: 0
assert_select 'option', text: 'People', count: 0
assert_select 'option', text: 'Projects', count: 0
assert_select 'option', text: 'Institutions', count: 0
assert_select 'option', text: 'Programmes', count: 0
end
end
I18n.load_path = original_load_path
I18n.backend.load_translations
end

test 'get dataset jsonld from index' do
get :index, format: :jsonld
assert_response :success
Expand Down

0 comments on commit c2dffbb

Please sign in to comment.