annotate app/views/activities/_recent.rhtml @ 344:1a514b9347d4 feature_121

Add Recent Activity partial, include it as a block in My Page (on by default) and in the project information page
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 31 Mar 2011 15:19:30 +0100
parents
children 30f68ecfdde4 c80fd1ef305f
rev   line source
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@344 5 events = activity.events(Date.today - 28, Date.today + 1).first(max)
chris@344 6 end
chris@344 7 %>
chris@344 8
chris@344 9 <div id="activity">
chris@344 10
chris@344 11 <% if @project.nil? %>
chris@344 12 <%= content_tag('h3', l(:label_activity_my_recent)) %>
chris@344 13 <div class="activity box">
chris@344 14 <% end %>
chris@344 15
chris@344 16 <% if events.empty? %>
chris@344 17
chris@344 18 <% if @project.nil? %>
chris@344 19 <p><%= l(:label_activity_my_recent_none) %></p>
chris@344 20 <% end %>
chris@344 21
chris@344 22 <% else %>
chris@344 23
chris@344 24 <% if !@project.nil? %>
chris@344 25 <div class="activity box">
chris@344 26 <%= content_tag('h3', l(:label_activity_recent)) %>
chris@344 27 <% end %>
chris@344 28
chris@344 29 <dl>
chris@344 30 <% events.sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%>
chris@344 31 <dt class="<%= User.current.logged? && e.respond_to?(:event_author) && User.current == e.event_author ? 'me' : nil %>">
chris@344 32 <%= avatar(e.event_author, :size => "24") if e.respond_to?(:event_author) %>
chris@344 33 <span class="time"><%= format_time(e.event_datetime) %></span>
chris@344 34 <%= content_tag('span', link_to_project(e.project), :class => 'project') if @project.nil? || @project != e.project %>
chris@344 35 <% if e.respond_to?(:event_author) %>
chris@344 36 <span class="author"><%= e.event_author %></span>
chris@344 37 <% end %>
chris@344 38 </dt>
chris@344 39 <dd><%= link_to format_activity_title(e.event_title), e.event_url %>
chris@344 40 <span class="description"><%= format_activity_description(e.event_description) %></span>
chris@344 41 </dd>
chris@344 42 <% end -%>
chris@344 43 </dl>
chris@344 44
chris@344 45 </div>
chris@344 46
chris@344 47 <% end %>
chris@344 48
chris@344 49 <% if events.empty? and @project.nil? %></div><% end %>
chris@344 50
chris@344 51 </div>