Revision 1009:066b55d7c053 app/views
| app/views/activities/_busy.html.erb | ||
|---|---|---|
| 16 | 16 |
# Transform events list into hash from project id to number of |
| 17 | 17 |
# occurrences of project in list (there is surely a tidier way |
| 18 | 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 }
|
|
| 19 |
phash = events.map { |e| e.project unless !e.respond_to?(:project) }.sort.group_by { |p| p.id }
|
|
| 20 | 20 |
phash = phash.merge(phash) { |k,v| v.length }
|
| 21 | 21 |
threshold = phash.values.sort.last(max).first |
| 22 | 22 |
busy = phash.keys.select { |k| phash[k] >= threshold }.sample(max)
|
| app/views/activities/_busy_institution.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 |
authors = events.map { |e| e.event_author unless !e.respond_to?(:event_author) }.compact
|
|
| 17 |
institutions = authors.map { |a| a.ssamr_user_detail.institution_name }
|
|
| 18 |
insthash = institutions.compact.sort.group_by { |i| i }
|
|
| 19 |
insthash = insthash.merge(insthash) { |k,v| v.length }
|
|
| 20 |
threshold = insthash.values.sort.last(max).first |
|
| 21 |
busy = insthash.keys.select { |k| insthash[k] >= threshold }.sample(max)
|
|
| 22 |
|
|
| 23 |
for institution in busy |
|
| 24 |
%> |
|
| 25 |
|
|
| 26 |
<li class="busy"> |
|
| 27 |
<span class="title"> |
|
| 28 |
<%= link_to h(institution), { :controller => 'activities', :institution => institution } %>
|
|
| 29 |
</span> |
|
| 30 |
</li> |
|
| 31 |
|
|
| 32 |
<% end %> |
|
| 33 |
</ul> |
|
| 34 |
<% end %> |
|
| app/views/activities/index.html.erb | ||
|---|---|---|
| 1 |
<h2><%= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)) %></h2> |
|
| 1 |
<h2><%= |
|
| 2 |
if @author.nil? |
|
| 3 |
if @institution_name.blank? |
|
| 4 |
l(:label_activity) |
|
| 5 |
else |
|
| 6 |
l(:label_institution_activity, h(@institution_name)) |
|
| 7 |
end |
|
| 8 |
else |
|
| 9 |
l(:label_user_activity, link_to_user(@author)) |
|
| 10 |
end |
|
| 11 |
%></h2> |
|
| 2 | 12 |
<p class="subtitle"><%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %></p> |
| 3 | 13 |
|
| 4 | 14 |
<div id="activity"> |
| app/views/projects/browse.html.erb | ||
|---|---|---|
| 1 |
|
|
| 2 |
<h2><%= l(:label_browse) %></h2> |
|
| 3 |
|
|
| 4 |
<div class="splitcontentleft"> |
|
| 5 |
<div class="projects box"> |
|
| 6 |
<h3><%=l(:label_project_latest)%></h3> |
|
| 7 |
<%= render :partial => 'projects/latest' %> |
|
| 8 |
<%= link_to l(:label_projects_more), :controller => 'projects' %> |
|
| 9 |
</div> |
|
| 10 |
</div> |
|
| 11 |
<div class="splitcontentleft"> |
|
| 12 |
<div class="projects box"> |
|
| 13 |
<h3><%=l(:label_project_tags_all)%></h3> |
|
| 14 |
<%= render :partial => 'projects/tagcloud' %> |
|
| 15 |
<%= link_to l(:label_projects_more), :controller => 'projects' %> |
|
| 16 |
</div> |
|
| 17 |
<div class="projects box"> |
|
| 18 |
<h3><%=l(:label_projects_busy)%></h3> |
|
| 19 |
<%= render :partial => 'activities/busy' %> |
|
| 20 |
<%= link_to l(:label_projects_more), :controller => 'projects' %> |
|
| 21 |
</div> |
|
| 22 |
</div> |
|
| app/views/projects/explore.html.erb | ||
|---|---|---|
| 1 |
|
|
| 2 |
<h2><%= l(:label_browse) %></h2> |
|
| 3 |
|
|
| 4 |
<div class="splitcontentleft"> |
|
| 5 |
<div class="projects box"> |
|
| 6 |
<h3><%=l(:label_project_latest)%></h3> |
|
| 7 |
<%= render :partial => 'projects/latest' %> |
|
| 8 |
<%= link_to l(:label_projects_more), :controller => 'projects' %> |
|
| 9 |
</div> |
|
| 10 |
</div> |
|
| 11 |
<div class="splitcontentleft"> |
|
| 12 |
<div class="projects box"> |
|
| 13 |
<h3><%=l(:label_project_tags_all)%></h3> |
|
| 14 |
<%= render :partial => 'projects/tagcloud' %> |
|
| 15 |
<%= link_to l(:label_projects_more), :controller => 'projects' %> |
|
| 16 |
</div> |
|
| 17 |
<div class="projects box"> |
|
| 18 |
<h3><%=l(:label_projects_busy)%></h3> |
|
| 19 |
<%= render :partial => 'activities/busy' %> |
|
| 20 |
<%= link_to l(:label_projects_more), :controller => 'projects' %> |
|
| 21 |
</div> |
|
| 22 |
<div class="projects box"> |
|
| 23 |
<h3><%=l(:label_institutions_busy)%></h3> |
|
| 24 |
<%= render :partial => 'activities/busy_institution' %> |
|
| 25 |
<%= link_to l(:label_projects_more), :controller => 'projects' %> |
|
| 26 |
</div> |
|
| 27 |
</div> |
|
| app/views/welcome/index.html.erb | ||
|---|---|---|
| 25 | 25 |
<%= render :partial => 'projects/latest' %> |
| 26 | 26 |
<%= link_to l(:label_projects_more), :controller => 'projects' %> |
| 27 | 27 |
</div> |
| 28 |
<div class="projects box"> |
|
| 29 |
<h3><%=l(:label_project_tags_all)%></h3> |
|
| 30 |
<%= render :partial => 'projects/tagcloud' %> |
|
| 31 |
<%= link_to l(:label_projects_more), :controller => 'projects' %> |
|
| 32 |
</div> |
|
| 33 |
<div class="projects box"> |
|
| 34 |
<h3><%=l(:label_projects_busy)%></h3> |
|
| 35 |
<%= render :partial => 'activities/busy' %> |
|
| 36 |
<%= link_to l(:label_projects_more), :controller => 'projects' %> |
|
| 37 |
</div> |
|
| 38 | 28 |
<%= call_hook(:view_welcome_index_right, :projects => @projects) %> |
| 39 | 29 |
</div> |
| 40 | 30 |
|
Also available in: Unified diff