@@ -48,8 +48,8 module WatchersHelper | |||||
48 | # Returns a comma separated list of users watching the given object |
|
48 | # Returns a comma separated list of users watching the given object | |
49 | def watchers_list(object) |
|
49 | def watchers_list(object) | |
50 | remove_allowed = User.current.allowed_to?("delete_#{object.class.name.underscore}_watchers".to_sym, object.project) |
|
50 | remove_allowed = User.current.allowed_to?("delete_#{object.class.name.underscore}_watchers".to_sym, object.project) | |
51 | object.watcher_users.collect do |user| |
|
51 | lis = object.watcher_users.collect do |user| | |
52 |
s = |
|
52 | s = avatar(user, :size => "16").to_s + link_to_user(user, :class => 'user').to_s | |
53 | if remove_allowed |
|
53 | if remove_allowed | |
54 | url = {:controller => 'watchers', |
|
54 | url = {:controller => 'watchers', | |
55 | :action => 'destroy', |
|
55 | :action => 'destroy', | |
@@ -59,9 +59,11 module WatchersHelper | |||||
59 | s += ' ' + link_to_remote(image_tag('delete.png'), |
|
59 | s += ' ' + link_to_remote(image_tag('delete.png'), | |
60 | {:url => url}, |
|
60 | {:url => url}, | |
61 | :href => url_for(url), |
|
61 | :href => url_for(url), | |
62 |
:style => "vertical-align: middle" |
|
62 | :style => "vertical-align: middle", | |
|
63 | :class => "delete") | |||
63 | end |
|
64 | end | |
64 | s |
|
65 | "<li>#{ s }</li>" | |
65 | end.join(",\n") |
|
66 | end | |
|
67 | lis.empty? ? "" : "<ul>#{ lis.join("\n") }</ul>" | |||
66 | end |
|
68 | end | |
67 | end |
|
69 | end |
@@ -77,14 +77,6 | |||||
77 | </div> |
|
77 | </div> | |
78 | <% end %> |
|
78 | <% end %> | |
79 |
|
79 | |||
80 | <% if User.current.allowed_to?(:add_issue_watchers, @project) || |
|
|||
81 | (@issue.watchers.any? && User.current.allowed_to?(:view_issue_watchers, @project)) %> |
|
|||
82 | <hr /> |
|
|||
83 | <div id="watchers"> |
|
|||
84 | <%= render :partial => 'watchers/watchers', :locals => {:watched => @issue} %> |
|
|||
85 | </div> |
|
|||
86 | <% end %> |
|
|||
87 |
|
||||
88 | </div> |
|
80 | </div> | |
89 |
|
81 | |||
90 | <% if @changesets.any? %> |
|
82 | <% if @changesets.any? %> | |
@@ -121,7 +113,14 | |||||
121 | <% html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %> |
|
113 | <% html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %> | |
122 |
|
114 | |||
123 | <% content_for :sidebar do %> |
|
115 | <% content_for :sidebar do %> | |
124 |
|
|
116 | <%= render :partial => 'issues/sidebar' %> | |
|
117 | ||||
|
118 | <% if User.current.allowed_to?(:add_issue_watchers, @project) || | |||
|
119 | (@issue.watchers.any? && User.current.allowed_to?(:view_issue_watchers, @project)) %> | |||
|
120 | <div id="watchers"> | |||
|
121 | <%= render :partial => 'watchers/watchers', :locals => {:watched => @issue} %> | |||
|
122 | </div> | |||
|
123 | <% end %> | |||
125 | <% end %> |
|
124 | <% end %> | |
126 |
|
125 | |||
127 | <% content_for :header_tags do %> |
|
126 | <% content_for :header_tags do %> |
@@ -6,20 +6,21 | |||||
6 | :object_id => watched} if User.current.allowed_to?(:add_issue_watchers, @project) %> |
|
6 | :object_id => watched} if User.current.allowed_to?(:add_issue_watchers, @project) %> | |
7 | </div> |
|
7 | </div> | |
8 |
|
8 | |||
9 | <p><strong><%= l(:label_issue_watchers) %></strong></p> |
|
9 | <h3><%= l(:label_issue_watchers) %> (<%= watched.watcher_users.size %>)</h3> | |
10 | <%= watchers_list(watched) %> |
|
|||
11 |
|
10 | |||
12 | <% unless @watcher.nil? %> |
|
11 | <% unless @watcher.nil? %> | |
13 | <% remote_form_for(:watcher, @watcher, |
|
12 | <% remote_form_for(:watcher, @watcher, | |
14 | :url => {:controller => 'watchers', |
|
13 | :url => {:controller => 'watchers', | |
15 | :action => 'new', |
|
14 | :action => 'new', | |
16 | :object_type => watched.class.name.underscore, |
|
15 | :object_type => watched.class.name.underscore, | |
17 | :object_id => watched}, |
|
16 | :object_id => watched}, | |
18 | :method => :post, |
|
17 | :method => :post, | |
19 | :html => {:id => 'new-watcher-form'}) do |f| %> |
|
18 | :html => {:id => 'new-watcher-form'}) do |f| %> | |
20 | <p><%= f.select :user_id, (watched.addable_watcher_users.collect {|m| [m.name, m.id]}), :prompt => "--- #{l(:actionview_instancetag_blank_option)} ---" %> |
|
19 | <p><%= f.select :user_id, (watched.addable_watcher_users.collect {|m| [m.name, m.id]}), :prompt => "--- #{l(:actionview_instancetag_blank_option)} ---" %> | |
21 |
|
20 | |||
22 | <%= submit_tag l(:button_add) %> |
|
21 | <%= submit_tag l(:button_add) %> | |
23 | <%= toggle_link l(:button_cancel), 'new-watcher-form'%></p> |
|
22 | <%= toggle_link l(:button_cancel), 'new-watcher-form'%></p> | |
24 | <% end %> |
|
23 | <% end %> | |
25 | <% end %> |
|
24 | <% end %> | |
|
25 | ||||
|
26 | <%= watchers_list(watched) %> |
@@ -195,6 +195,13 div.members h3 { background: url(../images/group.png) no-repeat 0% 50%; padding- | |||||
195 | div.news h3 { background: url(../images/news.png) no-repeat 0% 50%; padding-left: 20px; } |
|
195 | div.news h3 { background: url(../images/news.png) no-repeat 0% 50%; padding-left: 20px; } | |
196 | div.projects h3 { background: url(../images/projects.png) no-repeat 0% 50%; padding-left: 20px; } |
|
196 | div.projects h3 { background: url(../images/projects.png) no-repeat 0% 50%; padding-left: 20px; } | |
197 |
|
197 | |||
|
198 | #watchers ul {margin: 0; padding: 0;} | |||
|
199 | #watchers li {list-style-type:none;margin: 0px 2px 0px 0px; padding: 0px 0px 0px 0px;} | |||
|
200 | #watchers select {width: 95%; display: block;} | |||
|
201 | #watchers a.delete {opacity: 0.4;} | |||
|
202 | #watchers a.delete:hover {opacity: 1;} | |||
|
203 | #watchers img.gravatar {vertical-align: middle;margin-right: 4px;} | |||
|
204 | ||||
198 | .highlight { background-color: #FCFD8D;} |
|
205 | .highlight { background-color: #FCFD8D;} | |
199 | .highlight.token-1 { background-color: #faa;} |
|
206 | .highlight.token-1 { background-color: #faa;} | |
200 | .highlight.token-2 { background-color: #afa;} |
|
207 | .highlight.token-2 { background-color: #afa;} |
General Comments 0
You need to be logged in to leave comments.
Login now