From 807187ded96124d51fecf0897959a79f5474a62f Mon Sep 17 00:00:00 2001 From: maxwell Date: Fri, 17 Dec 2010 12:25:33 -0800 Subject: [PATCH] /notifications is now pretty cool --- app/controllers/notifications_controller.rb | 2 +- app/views/notifications/index.html.haml | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index ac4d8f1a2..0db3bdbf5 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 886e8329c..2af993192 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))}"