diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index ac4d8f1a21d1f97b53a9a3fe9603b66d54d37496..0db3bdbf54f2d3164099b3c145b7ca6e49fcb6ce 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -16,6 +16,6 @@ class NotificationsController < ApplicationController end def index - + @group_days = @notifications.group_by{|note| note.created_at.strftime("%B %d") } end end diff --git a/app/views/notifications/index.html.haml b/app/views/notifications/index.html.haml index 886e8329c3d8bd201a791a79054873209b87357d..2af993192807011add19ebe75a3242d3eee5de26 100644 --- a/app/views/notifications/index.html.haml +++ b/app/views/notifications/index.html.haml @@ -1,8 +1,11 @@ %ul - - - @notifications.each do |note| - %li - %h3 - = link_to "#{note.person.name.titleize}", person_path(note.person) - = object_link(note) - %span.description=" #{t('ago', :time => time_ago_in_words(note.created_at))}" + - @group_days.each do |day, notes| + %h3 + %ul + %li + = day + - notes.each do |note| + %li + = link_to "#{note.person.name.titleize}", person_path(note.person) + = object_link(note) + %span.description=" #{t('ago', :time => time_ago_in_words(note.created_at))}"