# HG changeset patch
# User Chris Cannam
# Date 1363171694 0
# Node ID 96790506f247f04c79aa3b31bddd4c785cc86aad
# Parent 1186340b4ad4c2494f69c0ed3294b933e168edf9# Parent 44475ccf56d3fd06457f5449e64847c82ab2ad86
Merge from branch "cannam"
diff -r 1186340b4ad4 -r 96790506f247 app/controllers/my_controller.rb
--- a/app/controllers/my_controller.rb Thu Mar 07 13:05:22 2013 +0000
+++ b/app/controllers/my_controller.rb Wed Mar 13 10:48:14 2013 +0000
@@ -22,6 +22,7 @@
helper :users
helper :custom_fields
helper :projects
+ helper :activities
BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues,
'issuesreportedbyme' => :label_reported_issues,
@@ -32,7 +33,8 @@
'calendar' => :label_calendar,
'documents' => :label_document_plural,
'timelog' => :label_spent_time,
- 'myprojects' => :label_my_projects
+ 'myprojects' => :label_my_projects,
+ 'colleagues' => :label_my_colleagues
}.merge(Redmine::Views::MyPage::Block.additional_blocks).freeze
DEFAULT_LAYOUT = { 'left' => ['myprojects', 'activitymyprojects'],
diff -r 1186340b4ad4 -r 96790506f247 app/controllers/users_controller.rb
--- a/app/controllers/users_controller.rb Thu Mar 07 13:05:22 2013 +0000
+++ b/app/controllers/users_controller.rb Wed Mar 13 10:48:14 2013 +0000
@@ -65,15 +65,7 @@
if @user.ssamr_user_detail != nil
@description = @user.ssamr_user_detail.description
-
- if @user.ssamr_user_detail.institution_type != nil
- # institution_type is true for listed institutions
- if (@user.ssamr_user_detail.institution_type)
- @institution_name = Institution.find(@user.ssamr_user_detail.institution_id).name
- else
- @institution_name = @user.ssamr_user_detail.other_institution
- end
- end
+ @institution_name = @user.ssamr_user_detail.institution_name
end
# show projects based on current user visibility
diff -r 1186340b4ad4 -r 96790506f247 app/helpers/activities_helper.rb
--- a/app/helpers/activities_helper.rb Thu Mar 07 13:05:22 2013 +0000
+++ b/app/helpers/activities_helper.rb Wed Mar 13 10:48:14 2013 +0000
@@ -15,11 +15,11 @@
end
end
- def busy_projects(events, count)
+ def project_activity_on_events(events)
# Score each project for which there are any events, by giving
# each event a score based on how long ago it was (the more recent
- # the better).
+ # the better). Return a hash mapping project id to score.
projhash = Hash.new
@@ -40,6 +40,89 @@
end
end
+ projhash
+ end
+
+ def projects_by_activity(user, count)
+
+ # Return up to count of the user's project ids ordered by that user's
+ # recent activity, omitting any projects for which no activity
+ # occurred in the recent past and any projects not visible to
+ # the current user
+
+ activity = Redmine::Activity::Fetcher.new(User.current, :author => user)
+
+ # Limit scope so as to exclude issues (which non-members can add)
+ activity.scope = [ "changesets", "files", "documents", "news", "wiki_edits", "messages", "time_entries", "publications" ]
+
+ days = Setting.activity_days_default.to_i
+ events = activity.events(Date.today - days, Date.today + 1)
+ projhash = project_activity_on_events(events)
+ projhash.keys.sort_by { |k| -projhash[k] }.first(count)
+ end
+
+ def render_active_colleagues(colleagues)
+
+ s = ""
+
+ start = Time.now
+
+ my_inst = ""
+ if ! User.current.ssamr_user_detail.nil?
+ my_inst = User.current.ssamr_user_detail.institution_name
+ end
+
+ actives = Hash.new
+ for c in colleagues
+ u = User.find_by_id(c)
+ active_projects = projects_by_activity(u, 3)
+ if !active_projects.empty?
+ actives[c] = active_projects
+ end
+ end
+
+ if actives.empty?
+ l(:label_no_active_colleagues)
+ else
+
+ s << "
<% cache(:action => 'explore', :action_suffix => 'tags', :expires_in => 1.hour) do %>
<%=l(:label_project_tags_all)%>
<%= render :partial => 'projects/tagcloud' %>
<% end %>
+
-
+
+ <% cache(:action => 'explore', :action_suffix => 'mature_projects', :expires_in => 1.hour) do %>
+
+
<%=l(:label_projects_mature)%>
+ <%= render :partial => 'projects/mature' %>
+
+ <% end %>
+
+
+
<% cache(:action => 'explore', :action_suffix => 'busy_institutions', :expires_in => 1.hour) do %>
<%=l(:label_institutions_busy)%>
@@ -23,13 +34,17 @@
<%= link_to l(:label_overall_activity), { :controller => 'activities', :action => 'index' }, :class => 'more' %>
<% end %>
+
+
+
<%=l(:label_project_latest)%>
<%= render :partial => 'projects/latest' %>
<%= link_to l(:label_projects_more), { :controller => 'projects' }, :class => 'more' %>
-
+
+
<% cache(:action => 'explore', :action_suffix => 'busy_projects', :expires_in => 1.hour) do %>
<%=l(:label_projects_busy)%>
@@ -37,10 +52,6 @@
<%= link_to l(:label_overall_activity), { :controller => 'activities', :action => 'index' }, :class => 'more' %>
<% end %>
- <% cache(:action => 'explore', :action_suffix => 'mature_projects', :expires_in => 1.hour) do %>
-
-
<%=l(:label_projects_mature)%>
- <%= render :partial => 'projects/mature' %>
-
- <% end %>
+
+<% html_title(l(:label_explore_projects)) -%>
diff -r 1186340b4ad4 -r 96790506f247 config/locales/en.yml
--- a/config/locales/en.yml Thu Mar 07 13:05:22 2013 +0000
+++ b/config/locales/en.yml Wed Mar 13 10:48:14 2013 +0000
@@ -924,6 +924,9 @@
label_parent_revision: Parent
label_child_revision: Child
label_export_options: "%{export_format} export options"
+ label_my_colleagues: "Active projects for people I'm working with"
+ label_working_in: Working in
+ label_no_active_colleagues: No recent activity
label_copy_attachments: Copy attachments
label_copy_subtasks: Copy subtasks
label_item_position: "%{position} of %{count}"
diff -r 1186340b4ad4 -r 96790506f247 plugins/redmine_tags/app/views/projects/index.html.erb
--- a/plugins/redmine_tags/app/views/projects/index.html.erb Thu Mar 07 13:05:22 2013 +0000
+++ b/plugins/redmine_tags/app/views/projects/index.html.erb Wed Mar 13 10:48:14 2013 +0000
@@ -10,14 +10,6 @@
<%= '| ' + link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
-
-
-<% if User.current.logged? %>
-
-
Looking for a list of your own projects?
It's moved to <%= link_to l(:label_my_page), { :controller => 'my', :action => 'page' } %>.
-
-<% end %>
-
<%= l("label_project_all") %>
diff -r 1186340b4ad4 -r 96790506f247 public/stylesheets/application.css
--- a/public/stylesheets/application.css Thu Mar 07 13:05:22 2013 +0000
+++ b/public/stylesheets/application.css Wed Mar 13 10:48:14 2013 +0000
@@ -313,6 +313,11 @@
.splitcontent {overflow:auto;}
.splitcontentleft{float:left; width:49%;}
.splitcontentright{float:right; width:49%;}
+
+.threecolumnleft{float:left; clear:left; width: 32%;}
+.threecolumnright{float:right; clear:right; width: 32%;}
+.threecolumnmid{margin-left: 33%; margin-right: 33%;}
+
form {display: inline;}
input, select {vertical-align: middle; margin-top: 1px; margin-bottom: 1px;}
fieldset {border: 1px solid #e4e4e4; margin:0;}
@@ -1078,9 +1083,10 @@
vertical-align: top;
}
-#activity dt img.gravatar, #members dt img.gravatar {
+#activity dt img.gravatar, #members dt img.gravatar, #active-colleagues img.gravatar {
float: left;
- margin: 0 1em 1em 0;
+ clear: left;
+ margin: 0.2em 1em 0.4em 0;
}
/* Used on 12px Gravatar img tags without the icon background */
diff -r 1186340b4ad4 -r 96790506f247 public/themes/soundsoftware/stylesheets/application.css
--- a/public/themes/soundsoftware/stylesheets/application.css Thu Mar 07 13:05:22 2013 +0000
+++ b/public/themes/soundsoftware/stylesheets/application.css Wed Mar 13 10:48:14 2013 +0000
@@ -88,6 +88,8 @@
.box .more { margin-left: 40px; }
+.box .institution { font-size: 0.95em; }
+
#content .tabs { margin-bottom: 0; }
table.list th { background-color: #fdfaf0; border-bottom: 1px solid #a9b680; }