From 19616d215ef42ce6c4e26dabfe8213ba7b3f4185 Mon Sep 17 00:00:00 2001 From: Lars Henrik Mai Date: Mon, 5 Oct 2015 22:25:29 +0200 Subject: [PATCH] Start using form builder for Paper Search Query --- app/controllers/search_controller.rb | 4 +++- app/views/search/_form.slim | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 56771cc..d31861d 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -10,7 +10,9 @@ class SearchController < ApplicationController @search_definition = PaperSearch.new(query: params[:q], paper_type: params[:paper_type], originator: params[:originator], - sort_by: params[:sort_by]) + sort_by: params[:paper_search][:sort_by]) + + # @search = PaperSearch.new params[:paper_search] @response = Paper.search(@search_definition) @papers = @response.page(params[:page]).results diff --git a/app/views/search/_form.slim b/app/views/search/_form.slim index 6756ea9..34c0f49 100644 --- a/app/views/search/_form.slim +++ b/app/views/search/_form.slim @@ -1,4 +1,4 @@ -= form_tag(search_path, method: :get) += form_for(@search_definition, url: search_path, method: :get) do |f| = text_field_tag(:q, @search_definition.query, placeholder: 'Sucheā€¦', autofocus: true) fieldset legend Ergebnisse filtern @@ -9,7 +9,7 @@ = filter_select("originator", "Einreicher", @originator_facets, @search_definition.originator) .small-4.columns.end label Sortierung - input type="radio" name="sort_by" value="date" id="sort_by_date" + = f.radio_button :sort_by, :date label for="sort_by_date" Nach Datum - input type="radio" name="sort_by" value="score" id="sort_by_score" + = f.radio_button :sort_by, :score label for="sort_by_score" Nach Relevanz