Feature #2714 » 2714.patch
app/controllers/users_controller.rb | ||
---|---|---|
89 | 89 |
:total => Issue.visible.where(:author_id => @user.id).count, |
90 | 90 |
:open => Issue.visible.open.where(:author_id => @user.id).count |
91 | 91 |
} |
92 |
@issue_counts[:watched] = { |
|
93 |
:total => Issue.visible.watched_by(@user.id).count, |
|
94 |
:open => Issue.visible.open.watched_by(@user.id).count |
|
95 |
} |
|
92 | 96 | |
93 | 97 |
respond_to do |format| |
94 | 98 |
format.html do |
app/views/users/show.html.erb | ||
---|---|---|
72 | 72 |
issues_path(:set_filter => 1, :status_id => '*', :author_id => @user.id, :sort => sort_cond) %> |
73 | 73 |
</td> |
74 | 74 |
</tr> |
75 |
<% if User.current == @user %> |
|
76 |
<tr> |
|
77 |
<td class="name"> |
|
78 |
<%= link_to l(:label_watched_issues), |
|
79 |
issues_path(:set_filter => 1, :watcher_id => @user.id, :sort => sort_cond) %> |
|
80 |
</td> |
|
81 |
<td> |
|
82 |
<%= link_to @issue_counts[:watched][:open], |
|
83 |
issues_path(:set_filter => 1, :watcher_id => @user.id, :sort => sort_cond) %> |
|
84 |
</td> |
|
85 |
<td> |
|
86 |
<%= link_to @issue_counts[:watched][:total] - @issue_counts[:watched][:open], |
|
87 |
issues_path(:set_filter => 1, :status_id => 'c', :watcher_id => @user.id, :sort => sort_cond) %> |
|
88 |
</td> |
|
89 |
<td class="total"> |
|
90 |
<%= link_to @issue_counts[:watched][:total], |
|
91 |
issues_path(:set_filter => 1, :status_id => '*', :watcher_id => @user.id, :sort => sort_cond) %> |
|
92 |
</td> |
|
93 |
</tr> |
|
94 |
<% end %> |
|
75 | 95 |
</tbody> |
76 | 96 |
</table> |
77 | 97 |
test/fixtures/watchers.yml | ||
---|---|---|
15 | 15 |
watchable_type: WikiPage |
16 | 16 |
watchable_id: 1 |
17 | 17 |
user_id: 1 |
18 |
watchers_005: |
|
19 |
watchable_type: Issue |
|
20 |
watchable_id: 3 |
|
21 |
user_id: 2 |
test/functional/users_controller_test.rb | ||
---|---|---|
27 | 27 |
:auth_sources, |
28 | 28 |
:enabled_modules, |
29 | 29 |
:issues, :issue_statuses, |
30 |
:trackers |
|
30 |
:trackers, :watchers
|
|
31 | 31 | |
32 | 32 |
def setup |
33 | 33 |
User.current = nil |
... | ... | |
247 | 247 |
assert_select 'td:nth-of-type(3)>a', :text => '2' # closed |
248 | 248 |
assert_select 'td:nth-of-type(4)>a', :text => '13' # total |
249 | 249 |
end |
250 |
assert_select 'tr:nth-of-type(3)' do |
|
251 |
assert_select 'td:nth-of-type(1)>a', :text => 'Watched issues' |
|
252 |
assert_select 'td:nth-of-type(2)>a', :text => '1' # open |
|
253 |
assert_select 'td:nth-of-type(3)>a', :text => '0' # closed |
|
254 |
assert_select 'td:nth-of-type(4)>a', :text => '1' # total |
|
255 |
end |
|
256 |
end |
|
257 |
end |
|
258 | ||
259 |
def test_show_issues_count_except_watcher |
|
260 |
@request.session[:user_id] = 2 |
|
261 |
get :show, :params => {:id => 3} |
|
262 |
assert_select 'table.list.issue-report>tbody' do |
|
263 |
assert_select 'tr:nth-of-type(1)' do |
|
264 |
assert_select 'td:nth-of-type(1)>a', :text => 'Assigned issues' |
|
265 |
end |
|
266 |
assert_select 'tr:nth-of-type(2)' do |
|
267 |
assert_select 'td:nth-of-type(1)>a', :text => 'Reported issues' |
|
268 |
end |
|
269 |
assert_select 'tr:nth-of-type(3)', :count => 0 |
|
250 | 270 |
end |
251 | 271 |
end |
252 | 272 |
- « Previous
- 1
- 2
- Next »