Activity: use default filter only on first request #861
This commit is contained in:
parent
c6af5c7982
commit
6f064d3856
|
@ -33,7 +33,7 @@ class ActivitiesController < ApplicationController
|
|||
:with_subprojects => @with_subprojects,
|
||||
:author => @author)
|
||||
@activity.scope_select {|t| !params["show_#{t}"].nil?}
|
||||
@activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty?
|
||||
@activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty? unless params[:set_filter]
|
||||
|
||||
events = @activity.events(@date_from, @date_to)
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
<% content_for :sidebar do %>
|
||||
<% form_tag({}, :method => :get) do %>
|
||||
<h3><%= l(:label_activity) %></h3>
|
||||
<%= hidden_field_tag "set_filter", 1, :id => nil %>
|
||||
<p><% @activity.event_types.each do |t| %>
|
||||
<%= check_box_tag "show_#{t}", 1, @activity.scope.include?(t) %>
|
||||
<label for="show_<%=t%>"><%= link_to(l("label_#{t.singularize}_plural"), {"show_#{t}" => 1, :user_id => params[:user_id]})%></label>
|
||||
|
|
|
@ -98,4 +98,12 @@ class ActivitiesControllerTest < ActionController::TestCase
|
|||
:attributes => {:href => 'http://test.host/issues/11'}}
|
||||
end
|
||||
|
||||
def test_index_without_filters
|
||||
get :index, :set_filter => 1
|
||||
assert_response :success
|
||||
assert_template 'index'
|
||||
assert_tag :tag => 'p',
|
||||
:attributes => {:class => /nodata/},
|
||||
:content => "No data to display"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue