Commit 98a45ce6ee50ced19a22e6a9153bb778de8fa001
1 parent
77cf6620
Exists in
master
and in
4 other branches
admin area -> search for projecs
Showing
2 changed files
with
7 additions
and
1 deletions
Show diff stats
app/controllers/admin/projects_controller.rb
| @@ -4,7 +4,9 @@ class Admin::ProjectsController < ApplicationController | @@ -4,7 +4,9 @@ class Admin::ProjectsController < ApplicationController | ||
| 4 | before_filter :authenticate_admin! | 4 | before_filter :authenticate_admin! |
| 5 | 5 | ||
| 6 | def index | 6 | def index |
| 7 | - @admin_projects = Project.page(params[:page]) | 7 | + @admin_projects = Project.scoped |
| 8 | + @admin_projects = @admin_projects.search(params[:name]) if params[:name].present? | ||
| 9 | + @admin_projects = @admin_projects.page(params[:page]) | ||
| 8 | end | 10 | end |
| 9 | 11 | ||
| 10 | def show | 12 | def show |
app/views/admin/projects/index.html.haml
| @@ -2,6 +2,10 @@ | @@ -2,6 +2,10 @@ | ||
| 2 | Projects | 2 | Projects |
| 3 | = link_to 'New Project', new_admin_project_path, :class => "btn small right" | 3 | = link_to 'New Project', new_admin_project_path, :class => "btn small right" |
| 4 | %br | 4 | %br |
| 5 | += form_tag admin_projects_path, :method => :get do | ||
| 6 | + = text_field_tag :name, params[:name], :class => "xlarge" | ||
| 7 | + = submit_tag "Search", :class => "btn submit primary" | ||
| 8 | + | ||
| 5 | %table.admin-table | 9 | %table.admin-table |
| 6 | %thead | 10 | %thead |
| 7 | %th Name | 11 | %th Name |