Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- index.html.erb:
- Filters:
- <% form_tag '', :id => 'filter_form' do %>
- <%= select (nil, "project_id", Project.find(:all).collect {|p| [ p.name, p.id ] },
- {:prompt => "Select a Project"}) %>
- <%= select (nil, "sprint_id", Sprint.find(:all).collect {|s| [ s.scheduled, s.id ] },
- {:prompt => "Select a Sprint"}) %>
- <%= select (nil, "user_id", User.find(:all).collect {|u| [ u.name, u.id ] },
- {:prompt => "Select a User"}) %>
- <% end %>
- <%= observe_form :filter_form,
- :frequency => 0.5,
- :update => 'display',
- :url => {:action=>'filter'},
- :with => [ :project_id, :sprint_id, :user_id ] %>
- <div id='display'>
- </div>
- INSIDE THE CONTROLLER:
- def filter
- @tasks = Task.find( :all, :conditions => { :project_id => params[:project_id],
- :sprint_id => params[:sprint_id] } )
- render :update do |page|
- page.replace_html 'display', :partial => 'display'
- end
- end
Add Comment
Please, Sign In to add comment