Mercurial > hg > soundsoftware-site
comparison app/helpers/activities_helper.rb @ 1225:edf7563e2653 live
Merge from branch "cannam"
author | Chris Cannam |
---|---|
date | Tue, 12 Mar 2013 15:14:07 +0000 |
parents | 30c444ea1338 |
children | d280360758e5 |
comparison
equal
deleted
inserted
replaced
1220:31aee88c279b | 1225:edf7563e2653 |
---|---|
49 # recent activity, omitting any projects for which no activity | 49 # recent activity, omitting any projects for which no activity |
50 # occurred in the recent past and any projects not visible to | 50 # occurred in the recent past and any projects not visible to |
51 # the current user | 51 # the current user |
52 | 52 |
53 activity = Redmine::Activity::Fetcher.new(User.current, :author => user) | 53 activity = Redmine::Activity::Fetcher.new(User.current, :author => user) |
54 | |
55 # Limit scope so as to exclude issues (which non-members can add) | |
56 activity.scope = [ "changesets", "files", "documents", "news", "wiki_edits", "messages", "time_entries", "publications" ] | |
57 | |
54 days = Setting.activity_days_default.to_i | 58 days = Setting.activity_days_default.to_i |
55 events = activity.events(Date.today - days, Date.today + 1) | 59 events = activity.events(Date.today - days, Date.today + 1) |
56 projhash = project_activity_on_events(events) | 60 projhash = project_activity_on_events(events) |
57 projhash.keys.sort_by { |k| -projhash[k] }.first(count) | 61 projhash.keys.sort_by { |k| -projhash[k] }.first(count) |
58 end | 62 end |
59 | 63 |
60 def render_active_colleagues(colleagues) | 64 def render_active_colleagues(colleagues) |
61 | 65 |
62 s = "" | 66 s = "" |
63 | 67 |
68 start = Time.now | |
69 | |
64 for c in colleagues | 70 for c in colleagues |
65 u = User.find_by_id(c) | 71 u = User.find_by_id(c) |
66 active_projects = projects_by_activity(u, 3) | 72 active_projects = projects_by_activity(u, 3) |
67 if !active_projects.empty? | 73 if !active_projects.empty? |
68 s << "<div class='active-person'>" | 74 s << "<dl>" |
75 s << "<dt>" | |
69 s << avatar(u, :size => '24') | 76 s << avatar(u, :size => '24') |
70 s << "<span class='user'>" | 77 s << "<span class='user'>" |
71 s << h(u.name) | 78 s << h(u.name) |
72 s << "</span>" | 79 s << "</span>" |
73 if !u.ssamr_user_detail.nil? | 80 if !u.ssamr_user_detail.nil? |
74 s << " - <span class='institution'>" | 81 s << " - <span class='institution'>" |
75 s << h(u.ssamr_user_detail.institution_name) | 82 s << h(u.ssamr_user_detail.institution_name) |
76 s << "</span>" | 83 s << "</span>" |
77 end | 84 end |
78 s << "<br>" | 85 s << "</dt>" |
86 s << "<dd>" | |
79 s << "<span class='active'>" | 87 s << "<span class='active'>" |
80 s << (active_projects.map { |p| link_to_project(p) }.join ", ") | 88 s << (active_projects.map { |p| link_to_project(p) }.join ", ") |
81 s << "</span>" | 89 s << "</span>" |
82 s << "</div>" | 90 s << "</dl>" |
83 end | 91 end |
84 end | 92 end |
93 | |
94 finish = Time.now | |
95 logger.info "render_active_colleagues: took #{finish-start}" | |
85 | 96 |
86 if s != "" | 97 if s != "" |
87 s | 98 s |
88 else | 99 else |
89 l(:label_no_active_colleagues) | 100 l(:label_no_active_colleagues) |