From 63721928d50d6340a3c653177f212729bb85c015 Mon Sep 17 00:00:00 2001 From: Bilel Kihal <61744974+Bilelkihal@users.noreply.github.com> Date: Fri, 5 Apr 2024 10:17:45 +0200 Subject: [PATCH] Feature: Add json button to search page (#562) * 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 --- app/controllers/annotator_controller.rb | 8 -------- app/views/search/index.html.haml | 12 ++++++++++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/controllers/annotator_controller.rb b/app/controllers/annotator_controller.rb index c809b15857..6f1ec810b8 100644 --- a/app/controllers/annotator_controller.rb +++ b/app/controllers/annotator_controller.rb @@ -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 diff --git a/app/views/search/index.html.haml b/app/views/search/index.html.haml index 28ecbf2eed..cc908c7697 100644 --- a/app/views/search/index.html.haml +++ b/app/views/search/index.html.haml @@ -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 @@ -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