# HG changeset patch
# User Chris Cannam
# Date 1301581170 -3600
# Node ID 1a514b9347d48f02cb64bf4431e7a5219f769611
# Parent 3564e1ae2ff7213987b57f84bc92497ae08b3f3a
Add Recent Activity partial, include it as a block in My Page (on by default) and in the project information page
diff -r 3564e1ae2ff7 -r 1a514b9347d4 app/controllers/my_controller.rb
--- a/app/controllers/my_controller.rb Thu Mar 31 11:13:21 2011 +0100
+++ b/app/controllers/my_controller.rb Thu Mar 31 15:19:30 2011 +0100
@@ -24,14 +24,15 @@
BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues,
'issuesreportedbyme' => :label_reported_issues,
'issueswatched' => :label_watched_issues,
+ 'activitymyprojects' => :label_activity_my_recent,
'news' => :label_news_latest,
'calendar' => :label_calendar,
'documents' => :label_document_plural,
'timelog' => :label_spent_time
}.merge(Redmine::Views::MyPage::Block.additional_blocks).freeze
- DEFAULT_LAYOUT = { 'left' => ['issuesassignedtome'],
- 'right' => ['issuesreportedbyme']
+ DEFAULT_LAYOUT = { 'left' => ['activitymyprojects'],
+ 'right' => ['issueswatched','calendar']
}.freeze
verify :xhr => true,
diff -r 3564e1ae2ff7 -r 1a514b9347d4 app/views/activities/_recent.rhtml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/views/activities/_recent.rhtml Thu Mar 31 15:19:30 2011 +0100
@@ -0,0 +1,51 @@
+<% events = @events_by_day %>
+<% max = 5 %>
+<% if (events.nil?)
+ activity = Redmine::Activity::Fetcher.new(User.current, :project => @project)
+ events = activity.events(Date.today - 28, Date.today + 1).first(max)
+ end
+%>
+
+
+
+<% if @project.nil? %>
+ <%= content_tag('h3', l(:label_activity_my_recent)) %>
+
+<% end %>
+
+<% if events.empty? %>
+
+ <% if @project.nil? %>
+
<%= l(:label_activity_my_recent_none) %>
+ <% end %>
+
+<% else %>
+
+ <% if !@project.nil? %>
+
+ <%= content_tag('h3', l(:label_activity_recent)) %>
+ <% end %>
+
+
+ <% events.sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%>
+ -
+ <%= avatar(e.event_author, :size => "24") if e.respond_to?(:event_author) %>
+ <%= format_time(e.event_datetime) %>
+ <%= content_tag('span', link_to_project(e.project), :class => 'project') if @project.nil? || @project != e.project %>
+ <% if e.respond_to?(:event_author) %>
+ <%= e.event_author %>
+ <% end %>
+
+ - <%= link_to format_activity_title(e.event_title), e.event_url %>
+ <%= format_activity_description(e.event_description) %>
+
+ <% end -%>
+
+
+
+
+<% end %>
+
+<% if events.empty? and @project.nil? %>
<% end %>
+
+
diff -r 3564e1ae2ff7 -r 1a514b9347d4 app/views/my/blocks/_activitymyprojects.rhtml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/views/my/blocks/_activitymyprojects.rhtml Thu Mar 31 15:19:30 2011 +0100
@@ -0,0 +1,4 @@
+
+<%= render :partial => 'activities/recent' %>
+
+
diff -r 3564e1ae2ff7 -r 1a514b9347d4 app/views/projects/show.rhtml
--- a/app/views/projects/show.rhtml Thu Mar 31 11:13:21 2011 +0100
+++ b/app/views/projects/show.rhtml Thu Mar 31 15:19:30 2011 +0100
@@ -46,7 +46,9 @@
<% end %>
+
<% end %>
+
<%= call_hook(:view_projects_show_left, :project => @project) %>
@@ -60,6 +62,9 @@
<%= link_to l(:label_news_view_all), :controller => 'news', :action => 'index', :project_id => @project %>
<% end %>
+
+ <%= render :partial => 'activities/recent' %>
+
<%= call_hook(:view_projects_show_right, :project => @project) %>
diff -r 3564e1ae2ff7 -r 1a514b9347d4 config/locales/en.yml
--- a/config/locales/en.yml Thu Mar 31 11:13:21 2011 +0100
+++ b/config/locales/en.yml Thu Mar 31 15:19:30 2011 +0100
@@ -518,6 +518,9 @@
label_last_login: Last connection
label_registered_on: Registered on
label_activity: Activity
+ label_activity_recent: Recent activity
+ label_activity_my_recent: Recent activity in my projects
+ label_activity_my_recent_none: No recent activity
label_overall_activity: Overall activity
label_user_activity: "{{value}}'s activity"
label_new: New
diff -r 3564e1ae2ff7 -r 1a514b9347d4 public/stylesheets/application.css
--- a/public/stylesheets/application.css Thu Mar 31 11:13:21 2011 +0100
+++ b/public/stylesheets/application.css Thu Mar 31 15:19:30 2011 +0100
@@ -216,6 +216,7 @@
h3.version { background: url(../images/package.png) no-repeat 0% 50%; padding-left: 20px; }
div.issues h3 { background: url(../images/ticket.png) no-repeat 0% 50%; padding-left: 20px; }
+div.activity h3 { background: url(../images/ticket.png) no-repeat 0% 50%; padding-left: 20px; }
div.members h3 { background: url(../images/group.png) no-repeat 0% 50%; padding-left: 20px; }
div.news h3 { background: url(../images/news.png) no-repeat 0% 50%; padding-left: 20px; }
div.projects h3 { background: url(../images/projects.png) no-repeat 0% 50%; padding-left: 20px; }
@@ -294,6 +295,7 @@
div#issue-changesets p { margin-top: 0; margin-bottom: 1em;}
div#activity dl, #search-results { margin-left: 2em; }
+div#activity .box dl { margin-left: 0; }
div#activity dd, #search-results dd { margin-bottom: 1em; padding-left: 18px; font-size: 0.9em; }
div#activity dt, #search-results dt { margin-bottom: 0px; padding-left: 20px; line-height: 18px; background-position: 0 50%; background-repeat: no-repeat; }
div#activity dt.me .time { border-bottom: 1px solid #999; }