Skip to content

Commit

Permalink
add a custom topnav search input placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Nov 20, 2024
1 parent 6fec44f commit 894c41f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions app/helpers/auto_complete_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ def ontologies_autocomplete
render OntologySearchInputComponent.new
end

def ontologies_content_autocomplete(id: '', name: '', search: '', ontologies: [], types: [], search_icon_type: 'home')
def ontologies_content_autocomplete(id: '', name: '', placeholder: nil, search: '', ontologies: [], types: [], search_icon_type: 'home')
render SearchInputComponent.new(id: id, name: name, ajax_url: "#{ajax_search_ontologies_content_path}?ontologies=#{ontologies.join(',')}&types=#{types.join(',')}&search=#{search}",
item_base_url: "", id_key: 'id', placeholder: t("ontologies.ontology_search_prompt"),
item_base_url: "", id_key: 'id', placeholder: placeholder || t("ontologies.ontology_search_prompt"),
use_cache: false, search_icon_type: search_icon_type,
actions_links: { search_ontology_content: "/search?query=o", browse_all_ontologies: "/ontologies?search=o" }) do |s|
s.template do
Expand All @@ -23,4 +23,4 @@ def ontology_content_autocomplete(search: '', ontologies: [], types: [])
ontologies_content_autocomplete(ontologies: ontologies, types: types, search: "#{search}")
end

end
end
2 changes: 1 addition & 1 deletion app/views/layouts/_topnav.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
%input
- else
.nav-search-container
= ontologies_content_autocomplete(search_icon_type: 'nav')
= ontologies_content_autocomplete(search_icon_type: 'nav', placeholder: t('ontologies.ontology_search_topnav'))
- if session[:user].nil?
%a.nav-a{:href => "/login"}= t('layout.header.login')
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,7 @@ en:
outside: outside
relation_with_other_ontologies: Relation with other semantic resources either in %{inside} or %{outside}
ontology_search_prompt: 'Search a semantic resource or a term (e.g., Environmental impact)'
ontology_search_topnav: 'Search...'
views: Views
create_new_view: Create new view
expand_all: Expand All
Expand Down
1 change: 1 addition & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1198,6 +1198,7 @@ fr:
outside: extérieur
relation_with_other_ontologies: Relation avec d'autres ontologies soit à l'intérieur soit à l'extérieur
ontology_search_prompt: 'Rechercher une ontologie ou un terme (par exemple, hauteur de plante)'
ontology_search_topnav: 'Rechercher...'
views: Vues
create_new_view: Créer une nouvelle vue
expand_all: Tout déplier
Expand Down

0 comments on commit 894c41f

Please sign in to comment.