Permalink
Browse files

stories-table-add-search

To get the search feature working, we need to update the controller side. Add a `show` method to `app/controllers/projects_controller.rb` and update the `<table-plus>` to use `@stories` as it's context:

SHOW_PATCH

There's a lot happening here, so we're just going to point you to appropriate manual chapters to explain the concepts.

- [DRYML context switching](/manual/dryml-guide#the_implicit_context)
- [Changing controller action behaviour](/manual/controllers#changing_action_behaviour)
- [search and order_by scopes](/manual/scopes#static_scopes)
- [find_instance](/manual/controller#find_instance)
- [parse_sort_param](/manual/controller#parse_sort_param)
  • Loading branch information...
bryanlarsen authored and iox committed Jun 3, 2013
1 parent 3bb9e3d commit 209aa17c95256c0a883cb44a9f87a6a9f0dcd3c9
Showing with 9 additions and 1 deletion.
  1. +8 −0 app/controllers/projects_controller.rb
  2. +1 −1 app/views/projects/show.dryml
@@ -4,4 +4,12 @@ class ProjectsController < ApplicationController
auto_actions :all
def show
@project = find_instance
@stories = @project.stories.
search(params[:search], :title).
order_by(parse_sort_param(:title, :status))
hobo_show
end
end
@@ -1,6 +1,6 @@
<show-page>
<collection: replace>
<table-plus:stories fields="this, tasks_count, status">
<table-plus with="&@stories" fields="this, tasks_count, status">
<empty-message:>No stories match your criteria</empty-message:>
</table-plus>
</collection:>

0 comments on commit 209aa17

Please sign in to comment.