mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2024-12-22 23:53:15 +01:00
Show last 30 papers on homepage
This commit is contained in:
parent
973af9f0d9
commit
f71c083722
3 changed files with 19 additions and 16 deletions
|
@ -1,8 +1,11 @@
|
||||||
class SearchController < ApplicationController
|
class SearchController < ApplicationController
|
||||||
def index
|
def index
|
||||||
@result = if params[:q].present?
|
@show_search_result = params[:q].present?
|
||||||
|
@papers = if @show_search_result
|
||||||
# TODO: Add pagination
|
# TODO: Add pagination
|
||||||
Paper.search(params[:q]).records
|
Paper.search(params[:q]).records
|
||||||
|
else
|
||||||
|
Paper.last(30)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
2
app/views/search/_form.slim
Normal file
2
app/views/search/_form.slim
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
= form_tag(search_path, method: :get)
|
||||||
|
= text_field_tag(:q, params[:q], placeholder: 'Suche…', autofocus: true)
|
|
@ -1,17 +1,15 @@
|
||||||
div
|
div
|
||||||
= form_tag(search_path, method: :get)
|
= render 'search/form'
|
||||||
= text_field_tag(:q, params[:q], placeholder: 'Suche…', autofocus: true)
|
|
||||||
|
|
||||||
.clearfix
|
.clearfix
|
||||||
- if @result
|
- if @show_search_result
|
||||||
.left
|
.left
|
||||||
| #{@result.size} Treffer
|
| #{@papers.size} Treffer
|
||||||
.right
|
.right
|
||||||
button.button. TODO: Suche Abbonieren
|
button.button. TODO: Suche Abbonieren
|
||||||
div
|
div
|
||||||
- if @result
|
|
||||||
ul.no-bullet
|
ul.no-bullet
|
||||||
- @result.each do |doc|
|
- @papers.each do |doc|
|
||||||
li.search-result
|
li.search-result
|
||||||
small = doc.paper_type
|
small = doc.paper_type
|
||||||
'
|
'
|
||||||
|
|
Loading…
Reference in a new issue