luis@1088
|
1 <% events = @events_by_day %>
|
luis@1088
|
2 <% max = 5 %>
|
luis@1088
|
3 <% if (events.nil?)
|
luis@1088
|
4 activity = Redmine::Activity::Fetcher.new(User.current, :project => @project)
|
luis@1088
|
5
|
luis@1088
|
6 if @project
|
luis@1088
|
7 # Don't show news (duplicated with News box) or wiki edits (too
|
luis@1088
|
8 # tedious) in project front page
|
luis@1088
|
9 activity.scope = [ "changesets", "files", "issues", "documents" ]
|
luis@1088
|
10 end
|
luis@1088
|
11
|
luis@1088
|
12 events = activity.events(Date.today - 28, Date.today + 1)
|
luis@1088
|
13
|
luis@1088
|
14 if defined? user
|
luis@1088
|
15 events = events.select { |e|
|
luis@1088
|
16
|
luis@1088
|
17 if e.class != Publication
|
luis@1088
|
18 user.member_of? e.project
|
luis@1088
|
19 else
|
chris@1202
|
20 e.projects.map {|p| user.member_of? p }.any?
|
luis@1088
|
21 end
|
luis@1088
|
22 }
|
luis@1088
|
23
|
luis@1088
|
24 end
|
luis@1088
|
25
|
luis@1088
|
26 events = events.first(max)
|
luis@1088
|
27
|
luis@1088
|
28 end
|
luis@1088
|
29 %>
|
luis@1088
|
30
|
luis@1088
|
31 <div id="activity">
|
luis@1088
|
32
|
luis@1088
|
33 <% if @project.nil? %>
|
luis@1088
|
34 <%= content_tag('h3', l(:label_activity_my_recent)) %>
|
luis@1088
|
35 <div class="activity box">
|
luis@1088
|
36 <% end %>
|
luis@1088
|
37
|
luis@1088
|
38 <% if events.empty? %>
|
luis@1088
|
39
|
luis@1088
|
40 <% if @project.nil? %>
|
chris@1202
|
41 <div class="tip"><%= l(:label_activity_my_recent_none) %></div>
|
luis@1088
|
42 <% end %>
|
luis@1088
|
43
|
luis@1088
|
44 <% else %>
|
luis@1088
|
45
|
luis@1088
|
46 <% if !@project.nil? %>
|
luis@1088
|
47 <div class="activity box">
|
luis@1088
|
48 <%= content_tag('h3', l(:label_activity_recent)) %>
|
luis@1088
|
49 <% end %>
|
luis@1088
|
50
|
luis@1088
|
51 <dl>
|
luis@1088
|
52 <% events.sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%>
|
luis@1088
|
53 <%- if e.class != Publication -%>
|
luis@1088
|
54 <dt class="<%= User.current.logged? && e.respond_to?(:event_author) && User.current == e.event_author ? 'me' : nil %>">
|
luis@1088
|
55 <%= avatar(e.event_author, :size => "24") if e.respond_to?(:event_author) %>
|
luis@1088
|
56 <span class="time"><%= format_time(e.event_datetime) %></span>
|
luis@1088
|
57 <%= content_tag('span', link_to_project(e.project), :class => 'project') if @project.nil? || @project != e.project %>
|
luis@1088
|
58 <% if e.respond_to?(:event_author) %>
|
luis@1088
|
59 <span class="author"><%= e.event_author %></span>
|
luis@1088
|
60 <% end %>
|
luis@1088
|
61 </dt>
|
luis@1088
|
62 <dd><%= link_to format_activity_title(e.event_title), e.event_url %>
|
luis@1088
|
63 <span class="description"><%= format_activity_description(e.event_description) %></span>
|
luis@1088
|
64 </dd>
|
luis@1088
|
65 <% else -%>
|
luis@1088
|
66 <dt class="<%= User.current.logged? && e.respond_to?(:event_author) && User.current == e.event_author ? 'me' : nil %>">
|
luis@1088
|
67 <span class="time"><%= format_time(e.event_datetime) %></span>
|
luis@1088
|
68 <%= link_to format_activity_title(e.event_title), e.event_url %>
|
luis@1088
|
69 was added to the following
|
luis@1088
|
70 <% if e.projects.count > 1 %>
|
luis@1088
|
71 projects:
|
luis@1088
|
72 <%- else -%>
|
luis@1088
|
73 project:
|
luis@1088
|
74 <%- end -%>
|
luis@1088
|
75 <%= content_tag('span', e.projects.join(', ')) -%> <% if e.respond_to?(:event_author) %>
|
luis@1088
|
76 <span class="author"><%= e.event_author %></span>
|
luis@1088
|
77 <% end %>
|
luis@1088
|
78 </dt>
|
luis@1088
|
79 <dd><%= link_to format_activity_title(e.event_title), e.event_url %>
|
luis@1088
|
80 <span class="description"><%= format_activity_description(e.event_description) %></span>
|
luis@1088
|
81 </dd>
|
luis@1088
|
82 <% end -%>
|
luis@1088
|
83 <% end -%>
|
luis@1088
|
84 </dl>
|
luis@1088
|
85
|
luis@1088
|
86 </div>
|
luis@1088
|
87
|
luis@1088
|
88 <% end %>
|
luis@1088
|
89
|
luis@1088
|
90 <% if events.empty? and @project.nil? %></div><% end %>
|
luis@1088
|
91
|
luis@1088
|
92 </div>
|