Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

make the search work in news feeds

  • Loading branch information...
commit 6bf5cb027a5b07aa72686ca2897a3399c5554822 1 parent c850361
@inakidelamadrid inakidelamadrid authored
View
6 app/controllers/admin/news_feeds_controller.rb
@@ -54,6 +54,12 @@ def destroy
end
end
+ def search
+ @search = NewsFeed.search(params[:q])
+ @news_feeds = @search.page(params[:page]).per(20)
+ render :index
+ end
+
private
def find_the_news_feed
View
18 app/views/admin/news_feeds/_filters_form.html.haml
@@ -0,0 +1,18 @@
+= form_tag search_admin_news_feeds_path, :method => :get do|q|
+ .filter_form_field.filter_string
+ = label :q, :name_contains, "Search name:", :class => 'label'
+ - if params[:q]
+ = text_field :q, :name_contains, :value => params[:q][:name_contains]
+ - else
+ = text_field :q, :name_contains
+ .filter_form_field.filter_string
+ = label :q, :url_contains, "Search url:", :class => 'label'
+ - if params[:q]
+ = text_field :q, :url_contains, :value => params[:q][:url_contains]
+ - else
+ = text_field :q, :url_contains
+ .filter_form_field.filter_date_range
+ = label :q, :created_at_gte, "Created at:", :class => 'label'
+ = text_field :q, :created_at_gte, :class=>'datepicker', :size=>12,:max=>10
+ %span.separator
+ = submit_tag "Submit"
View
2  app/views/admin/news_feeds/index.html.haml
@@ -4,7 +4,7 @@
%h3
News Feeds Filters
#panel_contents
- = render 'admin/filters_form'
+ = render 'filters_form'
%table
%thead
View
1  config/routes.rb
@@ -15,6 +15,7 @@
namespace :admin do
resources :news_feeds do
post :load_entries, :on => :member
+ get :search, :on => :collection
resources :feed_entries do
put :toggle_visible, :on => :member
Please sign in to comment.
Something went wrong with that request. Please try again.