Skip to content

Commit

Permalink
stories-table-add-search
Browse files Browse the repository at this point in the history
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 Aug 12, 2013
1 parent 3bb9e3d commit 209aa17
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions app/controllers/projects_controller.rb
Expand Up @@ -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
2 changes: 1 addition & 1 deletion app/views/projects/show.dryml
@@ -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:>
Expand Down

0 comments on commit 209aa17

Please sign in to comment.