Skip to content

Commit

Permalink
configured searchkick
Browse files Browse the repository at this point in the history
  • Loading branch information
enterteg committed Mar 27, 2016
1 parent 0885ba4 commit 21ed083
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ gem 'truncate_html', '~> 0.9.3'
gem 'lightbox2-rails'
gem 'will_paginate', '~> 3.0.6'
gem 'searchkick'
gem 'elasticsearch-model'
gem 'elasticsearch-rails'
gem 'bonsai-elasticsearch-rails'
#------------------
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
Expand Down
9 changes: 9 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ GEM
bcrypt (3.1.11)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bonsai-elasticsearch-rails (0.0.4)
builder (3.2.2)
byebug (8.2.2)
climate_control (0.0.3)
Expand All @@ -62,6 +63,11 @@ GEM
elasticsearch-transport (= 1.0.15)
elasticsearch-api (1.0.15)
multi_json
elasticsearch-model (0.1.8)
activesupport (> 3)
elasticsearch (> 0.4)
hashie
elasticsearch-rails (0.1.8)
elasticsearch-transport (1.0.15)
faraday
multi_json
Expand Down Expand Up @@ -186,9 +192,12 @@ PLATFORMS

DEPENDENCIES
bcrypt (~> 3.1.7)
bonsai-elasticsearch-rails
byebug
coffee-rails (~> 4.1.0)
dropzonejs-rails
elasticsearch-model
elasticsearch-rails
haml (~> 4.0, >= 4.0.7)
jbuilder (~> 2.0)
jquery-rails
Expand Down
1 change: 1 addition & 0 deletions app/controllers/public_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def about
def search
if params[:search].present?
@posts = Post.search(params[:search])
@controller = 'search'
else
redirect_to action: :index
end
Expand Down
15 changes: 10 additions & 5 deletions app/views/public/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@
= "Food"
=image_tag 'heart.png'
-else
-if @posts.any?
- if @controller == 'search'
-if @posts.any?
.header= 'Found posts'
- else
.header= 'No posts found :('
- else
.header= 'Latest posts'
= render @posts
-if @posts
= render @posts

= will_paginate @posts, previous_label: 'prev', next_label: 'older posts', inner_window: 1, outer_window: 1
- else
.header= 'No posts found :('
= will_paginate @posts, previous_label: 'prev', next_label: 'older posts', inner_window: 1, outer_window: 1

0 comments on commit 21ed083

Please sign in to comment.