mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2025-04-20 07:11:33 +02:00
Query ES, show results
This commit is contained in:
parent
7cd9f207f5
commit
2abba45f4c
8 changed files with 44 additions and 12 deletions
|
@ -10,8 +10,10 @@
|
|||
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
||||
* file per style scope.
|
||||
*
|
||||
*= require_tree .
|
||||
|
||||
*= require_self
|
||||
*= require foundation_and_overrides
|
||||
|
||||
*/
|
||||
|
||||
@import 'foundation_and_overrides';
|
||||
@import 'objects/search-result';
|
3
app/assets/stylesheets/objects/_search-result.scss
Normal file
3
app/assets/stylesheets/objects/_search-result.scss
Normal file
|
@ -0,0 +1,3 @@
|
|||
.search-result {
|
||||
border-bottom: 1px solid $table-border-color;
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
// Place all the styles related to the sessions controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -1,4 +1,8 @@
|
|||
class SearchController < ApplicationController
|
||||
def index
|
||||
@result = if params[:q].present?
|
||||
es = Elasticsearch::Client.new
|
||||
es.search index: 'loris', q: params[:q]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,8 +12,8 @@ body
|
|||
= content_tag :div, msg, class: name
|
||||
.row
|
||||
.large-8.columns
|
||||
h2#title
|
||||
= link_to 'Willkommen in Leipzig', root_path
|
||||
h1#title
|
||||
= link_to 'Stadtratmonitor Leipzig', root_path
|
||||
.large-4.columns
|
||||
ul.inline-list.right
|
||||
li = render 'login_button'
|
||||
|
|
|
@ -1,4 +1,21 @@
|
|||
= form_tag(search_path, method: :get)
|
||||
= label_tag(:q, 'Suche:')
|
||||
= text_field_tag(:q)
|
||||
= submit_tag 'Suchen', class: 'button'
|
||||
= text_field_tag(:q, params[:q], placeholder: 'Suche…')
|
||||
|
||||
.row
|
||||
- if @result
|
||||
.small-9.columns
|
||||
| #{@result['hits']['total']} Treffer
|
||||
.small-3.columns
|
||||
button.button.right TODO: Suche Abbonieren
|
||||
|
||||
- if @result
|
||||
ul.no-bullet
|
||||
- @result['hits']['hits'].each do |doc|
|
||||
li.search-result
|
||||
small = doc['_source']['paperType']
|
||||
'
|
||||
small = doc['_source']['originator'].join(', ')
|
||||
'
|
||||
small = doc['_source']['publishedDate']
|
||||
= link_to "https://ratsinfo.leipzig.de/bi/#{doc['_source']['mainFile']}", target: '_blank' do
|
||||
div = doc['_source']['name']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue