Start using form builder for Paper Search Query

This commit is contained in:
Lars Henrik Mai 2015-10-05 22:25:29 +02:00
parent f883df3347
commit 19616d215e
2 changed files with 6 additions and 4 deletions

View file

@ -10,7 +10,9 @@ class SearchController < ApplicationController
@search_definition = PaperSearch.new(query: params[:q], @search_definition = PaperSearch.new(query: params[:q],
paper_type: params[:paper_type], paper_type: params[:paper_type],
originator: params[:originator], 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) @response = Paper.search(@search_definition)
@papers = @response.page(params[:page]).results @papers = @response.page(params[:page]).results

View file

@ -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) = text_field_tag(:q, @search_definition.query, placeholder: 'Suche…', autofocus: true)
fieldset fieldset
legend Ergebnisse filtern legend Ergebnisse filtern
@ -9,7 +9,7 @@
= filter_select("originator", "Einreicher", @originator_facets, @search_definition.originator) = filter_select("originator", "Einreicher", @originator_facets, @search_definition.originator)
.small-4.columns.end .small-4.columns.end
label Sortierung 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 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 label for="sort_by_score" Nach Relevanz