Skip to content

Commit

Permalink
Feature: Add json button to search page (#562)
Browse files Browse the repository at this point in the history
* add json button ui to search page

* extract json_link method from annotator controller to application controller

* build the search page json link using json_link method

* move the search json button down besides the advanced options button

* remove this usage of api_params instead of direct params in search controller

---------

Co-authored-by: Syphax Bouazzouni <gs_bouazzouni@esi.dz>
  • Loading branch information
Bilelkihal and syphax-bouazzouni committed Jun 12, 2024
1 parent 6750e75 commit 6372192
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 0 additions & 8 deletions app/controllers/annotator_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,5 @@ def remove_special_chars(input)
input
end

def remove_special_chars(input)
regex = /^[a-zA-Z0-9\s]*$/
unless input.match?(regex)
input.gsub!(/[^\w\s]/, '')
end
input
end

end

12 changes: 10 additions & 2 deletions app/views/search/index.html.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
.search-page-container
.search-page-subcontainer{'data-controller': 'reveal-component'}
= form_tag(search_path, method: :get,data:{turbo: true, controller: 'form-url', action: 'submit->form-url#submit'}) do
= search_page_input_component(placeholder: t('search.search_place_holder'), name: "q", value: @search_query) do
.search-page-input-container{'data-controller': 'reveal'}
.search-page-input
%input{type:"text", placeholder: t('search.search_place_holder'), name: "q", value: @search_query}
.search-page-button
= render Buttons::RegularButtonComponent.new(id:'search-page-button', value: "Search", variant: "primary", type: "submit") do |btn|
= btn.icon_right do
= inline_svg_tag "icons/search.svg"


.search-page-advanced{'data-reveal-component-target': 'item', class: "#{@advanced_options_open ? '' : 'd-none'}"}
.left
.filter-container
Expand Down Expand Up @@ -37,7 +45,7 @@
.search-page-number-of-results
= "#{t('search.match_in')} #{@search_results.length} #{t('search.ontologies')}"
%div.d-flex
.search-page-json.mx-4.mt-1
.search-page-json.mx-4
= search_json_link
.search-page-advanced-button.show-options{class: "#{@advanced_options_open ? 'd-none' : ''}",'data': {'action': 'click->reveal-component#show', 'reveal-component-target': 'showButton'}}
.icon
Expand Down

0 comments on commit 6372192

Please sign in to comment.