Revision 1006:4ffe9098c16c app
| app/views/activities/_busy.html.erb | ||
|---|---|---|
| 1 |
<% events = @events_by_day %> |
|
| 2 |
<% max = 5 %> |
|
| 3 |
<% if (events.nil?) |
|
| 4 |
activity = Redmine::Activity::Fetcher.new(User.current) |
|
| 5 |
events = activity.events(Date.today - 14, Date.today + 1) |
|
| 6 |
end |
|
| 7 |
%> |
|
| 8 |
|
|
| 9 |
<% if events.empty? %> |
|
| 10 |
|
|
| 11 |
<% else %> |
|
| 12 |
|
|
| 13 |
<ul> |
|
| 14 |
|
|
| 15 |
<% |
|
| 16 |
# Transform events list into hash from project id to number of |
|
| 17 |
# occurrences of project in list (there is surely a tidier way |
|
| 18 |
# to do this, e.g. chunk() in Ruby 1.9 but not in 1.8) |
|
| 19 |
phash = events.map { |e| e.project }.sort.group_by { |p| p.id }
|
|
| 20 |
phash = phash.merge(phash) { |k,v| v.length }
|
|
| 21 |
threshold = phash.values.sort.last(max).first |
|
| 22 |
busy = phash.keys.select { |k| phash[k] >= threshold }.sample(max)
|
|
| 23 |
|
|
| 24 |
for id in busy |
|
| 25 |
project = Project.find(id) |
|
| 26 |
%> |
|
| 27 |
|
|
| 28 |
<li class="busy"> |
|
| 29 |
<span class="title"> |
|
| 30 |
<% if !project.root? %> |
|
| 31 |
<% project.ancestors.each do |p| %> |
|
| 32 |
<%= h(p) %> » |
|
| 33 |
<% end %> |
|
| 34 |
<% end %> |
|
| 35 |
<%= link_to_project project %> |
|
| 36 |
</span> |
|
| 37 |
<% if !project.is_public? %> |
|
| 38 |
<span class="private"><%= l(:field_is_private) %></span> |
|
| 39 |
<% end %> |
|
| 40 |
<span class='managers'> |
|
| 41 |
<% |
|
| 42 |
u = project.users_by_role |
|
| 43 |
if ! u.empty? %> |
|
| 44 |
(<%= |
|
| 45 |
mgmt_roles = u.keys.select{ |r| r.allowed_to?(:edit_project) }
|
|
| 46 |
managers = mgmt_roles.map{ |r| u[r] }.flatten.sort.uniq
|
|
| 47 |
managers.map{ |m| m.name }.join(', ')
|
|
| 48 |
%>)<% |
|
| 49 |
end |
|
| 50 |
%> |
|
| 51 |
</span> |
|
| 52 |
|
|
| 53 |
<%= render_project_short_description project %> |
|
| 54 |
</li> |
|
| 55 |
|
|
| 56 |
<% end %> |
|
| 57 |
</ul> |
|
| 58 |
<% end %> |
|
| app/views/projects/_latest.html.erb | ||
|---|---|---|
| 1 |
<ul> |
|
| 2 |
<% for project in @projects %> |
|
| 3 |
<% @project = project %> |
|
| 4 |
<li class="latest"> |
|
| 5 |
<span class="title"> |
|
| 6 |
<% if !project.root? %> |
|
| 7 |
<% project.ancestors.each do |p| %> |
|
| 8 |
<%= h(p) %> » |
|
| 9 |
<% end %> |
|
| 10 |
<% end %> |
|
| 11 |
<%= link_to_project project %> |
|
| 12 |
</span> |
|
| 13 |
<% if !project.is_public? %> |
|
| 14 |
<span class="private"><%= l(:field_is_private) %></span> |
|
| 15 |
<% end %> |
|
| 16 |
<span class="time"><%= format_time(project.created_on)%></span> |
|
| 17 |
<%= render_project_short_description project %> |
|
| 18 |
</li> |
|
| 19 |
<% end %> |
|
| 20 |
<% @project = nil %> |
|
| 21 |
</ul> |
|
| app/views/welcome/index.html.erb | ||
|---|---|---|
| 31 | 31 |
<%= render :partial => 'projects/tagcloud' %> |
| 32 | 32 |
<%= link_to l(:label_projects_more), :controller => 'projects' %> |
| 33 | 33 |
</div> |
| 34 |
<div class="projects box"> |
|
| 35 |
<h3><%=l(:label_projects_busy)%></h3> |
|
| 36 |
<%= render :partial => 'activities/busy' %> |
|
| 37 |
<%= link_to l(:label_projects_more), :controller => 'projects' %> |
|
| 38 |
</div> |
|
| 34 | 39 |
<% end %> |
| 35 | 40 |
<%= call_hook(:view_welcome_index_right, :projects => @projects) %> |
| 36 | 41 |
</div> |
Also available in: Unified diff