chris@344
|
1 <% events = @events_by_day %>
|
chris@344
|
2 <% max = 5 %>
|
chris@344
|
3 <% if (events.nil?)
|
chris@344
|
4 activity = Redmine::Activity::Fetcher.new(User.current, :project => @project)
|
Chris@379
|
5
|
chris@361
|
6 if @project
|
chris@361
|
7 # Don't show news (duplicated with News box) or wiki edits (too
|
chris@361
|
8 # tedious) in project front page
|
chris@361
|
9 activity.scope = [ "changesets", "files", "issues", "documents" ]
|
chris@361
|
10 end
|
Chris@379
|
11
|
chris@378
|
12 events = activity.events(Date.today - 28, Date.today + 1)
|
Chris@379
|
13
|
chris@378
|
14 if defined? user
|
chris@378
|
15 events = events.select { |e| user.member_of? e.project }
|
chris@378
|
16 end
|
Chris@379
|
17
|
chris@378
|
18 events = events.first(max)
|
chris@361
|
19
|
chris@344
|
20 end
|
chris@344
|
21 %>
|
chris@344
|
22
|
chris@344
|
23 <div id="activity">
|
chris@344
|
24
|
chris@344
|
25 <% if @project.nil? %>
|
chris@344
|
26 <%= content_tag('h3', l(:label_activity_my_recent)) %>
|
chris@344
|
27 <div class="activity box">
|
chris@344
|
28 <% end %>
|
chris@344
|
29
|
chris@344
|
30 <% if events.empty? %>
|
chris@344
|
31
|
chris@344
|
32 <% if @project.nil? %>
|
chris@344
|
33 <p><%= l(:label_activity_my_recent_none) %></p>
|
chris@344
|
34 <% end %>
|
chris@344
|
35
|
chris@344
|
36 <% else %>
|
chris@344
|
37
|
chris@344
|
38 <% if !@project.nil? %>
|
chris@344
|
39 <div class="activity box">
|
chris@344
|
40 <%= content_tag('h3', l(:label_activity_recent)) %>
|
chris@344
|
41 <% end %>
|
chris@344
|
42
|
chris@344
|
43 <dl>
|
chris@344
|
44 <% events.sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%>
|
chris@344
|
45 <dt class="<%= User.current.logged? && e.respond_to?(:event_author) && User.current == e.event_author ? 'me' : nil %>">
|
chris@344
|
46 <%= avatar(e.event_author, :size => "24") if e.respond_to?(:event_author) %>
|
chris@344
|
47 <span class="time"><%= format_time(e.event_datetime) %></span>
|
chris@344
|
48 <%= content_tag('span', link_to_project(e.project), :class => 'project') if @project.nil? || @project != e.project %>
|
chris@344
|
49 <% if e.respond_to?(:event_author) %>
|
chris@344
|
50 <span class="author"><%= e.event_author %></span>
|
chris@344
|
51 <% end %>
|
chris@344
|
52 </dt>
|
chris@344
|
53 <dd><%= link_to format_activity_title(e.event_title), e.event_url %>
|
chris@344
|
54 <span class="description"><%= format_activity_description(e.event_description) %></span>
|
chris@344
|
55 </dd>
|
chris@344
|
56 <% end -%>
|
chris@344
|
57 </dl>
|
chris@344
|
58
|
chris@344
|
59 </div>
|
chris@344
|
60
|
chris@344
|
61 <% end %>
|
chris@344
|
62
|
chris@344
|
63 <% if events.empty? and @project.nil? %></div><% end %>
|
chris@344
|
64
|
chris@344
|
65 </div>
|