##// END OF EJS Templates
Missing "next" pagination link when looking at yesterday's activity (#18399)....
Jean-Philippe Lang -
r15755:84732abd0ad7
parent child
Show More
@@ -1,72 +1,72
1 1 <h2><%= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)).html_safe %></h2>
2 2 <p class="subtitle"><%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %></p>
3 3
4 4 <div id="activity">
5 5 <% @events_by_day.keys.sort.reverse.each do |day| %>
6 6 <h3><%= format_activity_day(day) %></h3>
7 7 <dl>
8 8 <% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%>
9 9 <dt class="<%= e.event_type %> icon icon-<%= e.event_type %> <%= "grouped" if in_group %> <%= User.current.logged? && e.respond_to?(:event_author) && User.current == e.event_author ? 'me' : nil %>">
10 10 <%= avatar(e.event_author, :size => "24") if e.respond_to?(:event_author) %>
11 11 <span class="time"><%= format_time(e.event_datetime, false) %></span>
12 12 <%= content_tag('span', e.project, :class => 'project') if @project.nil? || @project != e.project %>
13 13 <%= link_to format_activity_title(e.event_title), e.event_url %>
14 14 </dt>
15 15 <dd class="<%= "grouped" if in_group %>"><span class="description"><%= format_activity_description(e.event_description) %></span>
16 16 <span class="author"><%= link_to_user(e.event_author) if e.respond_to?(:event_author) %></span></dd>
17 17 <% end -%>
18 18 </dl>
19 19 <% end -%>
20 20 </div>
21 21
22 22 <%= content_tag('p', l(:label_no_data), :class => 'nodata') if @events_by_day.empty? %>
23 23
24 24 <span class="pagination">
25 25 <ul class="pages">
26 26 <li class="previous page">
27 27 <%= link_to("\xc2\xab " + l(:label_previous),
28 28 {:params => request.query_parameters.merge(:from => @date_to - @days - 1)},
29 29 :title => l(:label_date_from_to, :start => format_date(@date_to - 2*@days), :end => format_date(@date_to - @days - 1)),
30 30 :accesskey => accesskey(:previous)) %>
31 </li><% unless @date_to >= User.current.today %><li class="next page">
31 </li><% unless @date_to > User.current.today %><li class="next page">
32 32 <%= link_to(l(:label_next) + " \xc2\xbb",
33 33 {:params => request.query_parameters.merge(:from => @date_to + @days - 1)},
34 34 :title => l(:label_date_from_to, :start => format_date(@date_to), :end => format_date(@date_to + @days - 1)),
35 35 :accesskey => accesskey(:next)) %><% end %>
36 36 </li>
37 37 </ul>
38 38 </span>
39 39 &nbsp;
40 40 <% other_formats_links do |f| %>
41 41 <%= f.link_to_with_query_parameters 'Atom', 'from' => nil, :key => User.current.rss_key %>
42 42 <% end %>
43 43
44 44 <% content_for :header_tags do %>
45 45 <%= auto_discovery_link_tag(:atom, :params => request.query_parameters.merge(:from => nil, :key => User.current.rss_key), :format => 'atom') %>
46 46 <% end %>
47 47
48 48 <% content_for :sidebar do %>
49 49 <%= form_tag({}, :method => :get, :id => 'activity_scope_form') do %>
50 50 <h3><%= l(:label_activity) %></h3>
51 51 <ul>
52 52 <% @activity.event_types.each do |t| %>
53 53 <li>
54 54 <%= check_box_tag "show_#{t}", 1, @activity.scope.include?(t) %>
55 55 <label for="show_<%=t%>">
56 56 <%= link_to(l("label_#{t.singularize}_plural"),
57 57 {"show_#{t}" => 1, :user_id => params[:user_id], :from => params[:from]})%>
58 58 </label>
59 59 </li>
60 60 <% end %>
61 61 </ul>
62 62 <% if @project && @project.descendants.active.any? %>
63 63 <%= hidden_field_tag 'with_subprojects', 0, :id => nil %>
64 64 <p><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label></p>
65 65 <% end %>
66 66 <%= hidden_field_tag('user_id', params[:user_id]) unless params[:user_id].blank? %>
67 67 <%= hidden_field_tag('from', params[:from]) unless params[:from].blank? %>
68 68 <p><%= submit_tag l(:button_apply), :class => 'button-small', :name => 'submit' %></p>
69 69 <% end %>
70 70 <% end %>
71 71
72 72 <% html_title(l(:label_activity), @author) -%>
@@ -1,172 +1,190
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2016 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.expand_path('../../test_helper', __FILE__)
19 19
20 20 class ActivitiesControllerTest < Redmine::ControllerTest
21 21 fixtures :projects, :trackers, :issue_statuses, :issues,
22 22 :enumerations, :users, :issue_categories,
23 23 :projects_trackers,
24 24 :roles,
25 25 :member_roles,
26 26 :members,
27 27 :groups_users,
28 28 :enabled_modules,
29 29 :journals, :journal_details
30 30
31 31
32 32 def test_project_index
33 33 get :index, :id => 1, :with_subprojects => 0
34 34 assert_response :success
35 35
36 36 assert_select 'h3', :text => /#{2.days.ago.to_date.day}/
37 37 assert_select 'dl dt.issue-edit a', :text => /(#{IssueStatus.find(2).name})/
38 38 end
39 39
40 40 def test_project_index_with_invalid_project_id_should_respond_404
41 41 get :index, :id => 299
42 42 assert_response 404
43 43 end
44 44
45 45 def test_previous_project_index
46 46 get :index, :id => 1, :from => 2.days.ago.to_date
47 47 assert_response :success
48 48
49 49 assert_select 'h3', :text => /#{3.days.ago.to_date.day}/
50 50 assert_select 'dl dt.issue a', :text => /Cannot print recipes/
51 51 end
52 52
53 53 def test_global_index
54 54 @request.session[:user_id] = 1
55 55 get :index
56 56 assert_response :success
57 57
58 58 i5 = Issue.find(5)
59 59 d5 = User.find(1).time_to_date(i5.created_on)
60 60
61 61 assert_select 'h3', :text => /#{d5.day}/
62 62 assert_select 'dl dt.issue a', :text => /Subproject issue/
63 63 end
64 64
65 65 def test_user_index
66 66 @request.session[:user_id] = 1
67 67 get :index, :user_id => 2
68 68 assert_response :success
69 69
70 70 assert_select 'h2 a[href="/users/2"]', :text => 'John Smith'
71 71
72 72 i1 = Issue.find(1)
73 73 d1 = User.find(1).time_to_date(i1.created_on)
74 74
75 75 assert_select 'h3', :text => /#{d1.day}/
76 76 assert_select 'dl dt.issue a', :text => /Cannot print recipes/
77 77 end
78 78
79 79 def test_user_index_with_invalid_user_id_should_respond_404
80 80 get :index, :user_id => 299
81 81 assert_response 404
82 82 end
83 83
84 84 def test_index_atom_feed
85 85 get :index, :format => 'atom', :with_subprojects => 0
86 86 assert_response :success
87 87
88 88 assert_select 'feed' do
89 89 assert_select 'link[rel=self][href=?]', 'http://test.host/activity.atom?with_subprojects=0'
90 90 assert_select 'link[rel=alternate][href=?]', 'http://test.host/activity?with_subprojects=0'
91 91 assert_select 'entry' do
92 92 assert_select 'link[href=?]', 'http://test.host/issues/11'
93 93 end
94 94 end
95 95 end
96 96
97 97 def test_index_atom_feed_with_explicit_selection
98 98 get :index, :format => 'atom', :with_subprojects => 0,
99 99 :show_changesets => 1,
100 100 :show_documents => 1,
101 101 :show_files => 1,
102 102 :show_issues => 1,
103 103 :show_messages => 1,
104 104 :show_news => 1,
105 105 :show_time_entries => 1,
106 106 :show_wiki_edits => 1
107 107
108 108 assert_response :success
109 109
110 110 assert_select 'feed' do
111 111 assert_select 'link[rel=self][href=?]', 'http://test.host/activity.atom?show_changesets=1&show_documents=1&show_files=1&show_issues=1&show_messages=1&show_news=1&show_time_entries=1&show_wiki_edits=1&with_subprojects=0'
112 112 assert_select 'link[rel=alternate][href=?]', 'http://test.host/activity?show_changesets=1&show_documents=1&show_files=1&show_issues=1&show_messages=1&show_news=1&show_time_entries=1&show_wiki_edits=1&with_subprojects=0'
113 113 assert_select 'entry' do
114 114 assert_select 'link[href=?]', 'http://test.host/issues/11'
115 115 end
116 116 end
117 117 end
118 118
119 119 def test_index_atom_feed_with_one_item_type
120 120 with_settings :default_language => 'en' do
121 121 get :index, :format => 'atom', :show_issues => '1'
122 122 assert_response :success
123 123
124 124 assert_select 'title', :text => /Issues/
125 125 end
126 126 end
127 127
128 128 def test_index_atom_feed_with_user
129 129 get :index, :user_id => 2, :format => 'atom'
130 130
131 131 assert_response :success
132 132 assert_select 'title', :text => "Redmine: #{User.find(2).name}"
133 133 end
134 134
135 135 def test_index_should_show_private_notes_with_permission_only
136 136 journal = Journal.create!(:journalized => Issue.find(2), :notes => 'Private notes', :private_notes => true)
137 137 @request.session[:user_id] = 2
138 138
139 139 get :index
140 140 assert_response :success
141 141 assert_select 'dl', :text => /Private notes/
142 142
143 143 Role.find(1).remove_permission! :view_private_notes
144 144 get :index
145 145 assert_response :success
146 146 assert_select 'dl', :text => /Private notes/, :count => 0
147 147 end
148 148
149 149 def test_index_with_submitted_scope_should_save_as_preference
150 150 @request.session[:user_id] = 2
151 151
152 152 get :index, :show_issues => '1', :show_messages => '1', :submit => 'Apply'
153 153 assert_response :success
154 154 assert_equal %w(issues messages), User.find(2).pref.activity_scope.sort
155 155 end
156 156
157 157 def test_index_scope_should_default_to_user_preference
158 158 pref = User.find(2).pref
159 159 pref.activity_scope = %w(issues news)
160 160 pref.save!
161 161 @request.session[:user_id] = 2
162 162
163 163 get :index
164 164 assert_response :success
165 165
166 166 assert_select '#activity_scope_form' do
167 167 assert_select 'input[checked=checked]', 2
168 168 assert_select 'input[name=show_issues][checked=checked]'
169 169 assert_select 'input[name=show_news][checked=checked]'
170 170 end
171 171 end
172
173 def test_index_should_not_show_next_page_link
174 @request.session[:user_id] = 2
175
176 get :index
177 assert_response :success
178 assert_select '.pagination a', :text => /Previous/
179 assert_select '.pagination a', :text => /Next/, :count => 0
180 end
181
182 def test_index_up_to_yesterday_should_show_next_page_link
183 @request.session[:user_id] = 2
184
185 get :index, :from => (User.find(2).today-1)
186 assert_response :success
187 assert_select '.pagination a', :text => /Previous/
188 assert_select '.pagination a', :text => /Next/
189 end
172 190 end
General Comments 0
You need to be logged in to leave comments. Login now