Feature #11539 » HiearchyPatch.patch
app/helpers/my_helper.rb Mon Jul 30 01:32:31 2012 +0000 → app/helpers/my_helper.rb Mon Jul 30 12:54:10 2012 -0400 | ||
---|---|---|
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 |
|
20 | 20 |
module MyHelper |
21 |
|
|
22 |
# Renders a tree of projects as a nested set of unordered lists |
|
23 |
# The given collection may be a subset of the whole project tree |
|
24 |
# (eg. some intermediate nodes are private and can not be seen) |
|
25 |
def render_project_hierarchy_notifications(projects) |
|
26 |
s = '' |
|
27 |
if projects.any? |
|
28 |
ancestors = [] |
|
29 |
original_project = @project |
|
30 |
projects.each do |project| |
|
31 |
# set the project environment to please macros. |
|
32 |
@project = project |
|
33 |
if (ancestors.empty? || project.is_descendant_of?(ancestors.last)) |
|
34 |
s << "<ul class='projects mypage #{ ancestors.empty? ? 'root' : nil}'>\n" |
|
35 |
else |
|
36 |
ancestors.pop |
|
37 |
s << "</li>" |
|
38 |
while (ancestors.any? && !project.is_descendant_of?(ancestors.last)) |
|
39 |
ancestors.pop |
|
40 |
s << "</ul></li>\n" |
|
41 |
end |
|
42 |
end |
|
43 |
classes = (ancestors.empty? ? 'root' : 'child mypage') |
|
44 |
s << "<li class='#{classes}'><label>#{check_box_tag 'notified_project_ids[]', project.id, @user.notified_projects_ids.include?(project.id)} #{h project.name}</label>" |
|
45 |
ancestors << project |
|
46 |
end |
|
47 |
s << ("</li></ul>\n" * ancestors.size) |
|
48 |
@project = original_project |
|
49 |
end |
|
50 |
s.html_safe |
|
51 |
end |
|
21 | 52 |
end |
app/views/users/_mail_notifications.html.erb Mon Jul 30 01:32:31 2012 +0000 → app/views/users/_mail_notifications.html.erb Mon Jul 30 12:54:10 2012 -0400 | ||
---|---|---|
8 | 8 |
) %> |
9 | 9 |
</p> |
10 | 10 |
<%= content_tag 'div', :id => 'notified-projects', :style => (@user.mail_notification == 'selected' ? '' : 'display:none;') do %> |
11 |
<p> |
|
12 |
<% @user.projects.each do |project| %> |
|
13 |
<label> |
|
14 |
<%= check_box_tag( |
|
15 |
'notified_project_ids[]', |
|
16 |
project.id, |
|
17 |
@user.notified_projects_ids.include?(project.id) |
|
18 |
) %> |
|
19 |
<%= h(project.name) %> |
|
20 |
</label> |
|
21 |
<br /> |
|
22 |
<% end %> |
|
23 |
</p> |
|
11 |
<%= render_project_hierarchy_notifications(@user.projects.find(:all, :order => 'lft'))%> |
|
24 | 12 |
<p><em class="info"><%= l(:text_user_mail_option) %></em></p> |
25 | 13 |
<% end %> |
26 | 14 |
<p> |
public/stylesheets/application.css Mon Jul 30 01:32:31 2012 +0000 → public/stylesheets/application.css Mon Jul 30 12:54:10 2012 -0400 | ||
---|---|---|
413 | 413 |
ul.projects { margin: 0; padding-left: 1em; } |
414 | 414 |
ul.projects.root { margin: 0; padding: 0; } |
415 | 415 |
ul.projects ul.projects { border-left: 3px solid #e0e0e0; } |
416 |
ul.projects ul.mypage { border-left:none; } |
|
416 | 417 |
ul.projects li.root { list-style-type:none; margin-bottom: 1em; } |
417 | 418 |
ul.projects li.child { list-style-type:none; margin-top: 1em;} |
419 |
ul.projects li.mypage { margin:0; } |
|
418 | 420 |
ul.projects div.root a.project { font-family: "Trebuchet MS", Verdana, sans-serif; font-weight: bold; font-size: 16px; margin: 0 0 10px 0; } |
419 | 421 |
.my-project { padding-left: 18px; background: url(../images/fav.png) no-repeat 0 50%; } |
420 | 422 |
|
- « Previous
- 1
- 2
- 3
- Next »