scinote-web/app/views/activities/_list.html.erb

19 lines
683 B
Text
Raw Normal View History

<% if activities.first.created_at.to_date == Date.today %>
2016-02-12 23:52:43 +08:00
<li class="text-center activity-date-item">
<span class="label label-primary">
<%=t "activities.index.today" %>
</span>
</li>
<% end %>
<% activities.each_with_index do |activity, index| %>
<% prevDate = activities[index - 1] ? activities[index - 1].created_at.to_date : Date.new(1901, 1, 1) %>
<% if activity.created_at.to_date < prevDate %>
2016-02-12 23:52:43 +08:00
<li class="text-center activity-date-item">
<span class="label label-primary">
<%= activity.created_at.strftime('%d.%m.%Y') %>
</span>
</li>
<% end %>
<%= render 'activities/activity.html.erb', activity: activity %>
<% end %>