Mercurial > hg > soundsoftware-site
comparison app/helpers/activities_helper.rb @ 1219:3286032e15cf live
Some layout and fixes
author | Chris Cannam |
---|---|
date | Tue, 12 Mar 2013 13:24:05 +0000 |
parents | 875b5b4c574d |
children | 2c59ee348e2b |
comparison
equal
deleted
inserted
replaced
1218:194867efafa9 | 1219:3286032e15cf |
---|---|
45 | 45 |
46 def projects_by_activity(user, count) | 46 def projects_by_activity(user, count) |
47 | 47 |
48 # Return up to count of the user's projects ordered by that user's | 48 # Return up to count of the user's projects ordered by that user's |
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 | 50 # occurred in the recent past and any projects not visible to |
51 # the current user | |
51 | 52 |
52 activity = Redmine::Activity::Fetcher.new(user, :author => user) | 53 activity = Redmine::Activity::Fetcher.new(User.current, :author => user) |
53 days = Setting.activity_days_default.to_i | 54 days = Setting.activity_days_default.to_i |
54 events = activity.events(Date.today - days, Date.today + 1) | 55 events = activity.events(Date.today - days, Date.today + 1) |
55 projhash = project_activity_on_events(events) | 56 projhash = project_activity_on_events(events) |
56 projhash.keys.sort_by { |k| -projhash[k] }.first(count) | 57 projhash.keys.sort_by { |k| -projhash[k] }.first(count) |
57 end | 58 end |
62 | 63 |
63 for c in colleagues | 64 for c in colleagues |
64 u = User.find_by_id(c) | 65 u = User.find_by_id(c) |
65 active_projects = projects_by_activity(u, 3) | 66 active_projects = projects_by_activity(u, 3) |
66 if !active_projects.empty? | 67 if !active_projects.empty? |
67 s << "<div class='user'>" | 68 s << "<div class='active-person'>" |
68 s << link_to_user(u) | 69 s << avatar(u, :size => '24') |
69 s << "<span class='institution'>" | 70 s << "<span class='user'>" |
70 s << h(u.ssamr_user_detail.institution_name) | 71 s << h(u.name) |
71 s << "</span>" | 72 s << "</span>" |
72 s << "</div>" | 73 if !u.ssamr_user_detail.nil? |
73 s << "<div class='active'>" | 74 s << " - <span class='institution'>" |
74 s << l(:label_working_in) << " " | 75 s << h(u.ssamr_user_detail.institution_name) |
76 s << "</span>" | |
77 end | |
78 s << "<br>" | |
79 s << "<span class='active'>" | |
75 s << (active_projects.map { |p| link_to_project(p) }.join ", ") | 80 s << (active_projects.map { |p| link_to_project(p) }.join ", ") |
81 s << "</span>" | |
76 s << "</div>" | 82 s << "</div>" |
77 end | 83 end |
78 end | 84 end |
79 | 85 |
80 if s != "" | 86 if s != "" |