diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index 2be753d14..3fc8f5a90 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -22,4 +22,5 @@ class NotificationsController < ApplicationController @group_days = @notifications.group_by{|note| note.created_at.strftime("%B %d") } respond_with @notifications end + end diff --git a/app/views/notifications/index.html.haml b/app/views/notifications/index.html.haml index 28c5d7e6d..0df4f64a0 100644 --- a/app/views/notifications/index.html.haml +++ b/app/views/notifications/index.html.haml @@ -1,21 +1,34 @@ :javascript - $('.note a').live('click', function(evt){ - var note_id = $(this).closest('.note').attr('id'); - $.ajax({ - url: 'notifications/' + note_id, - type: 'PUT' - }); + $('.message').live('click', function(evt){ + var note = $(this).closest('.message'), + note_id = note.attr('data-guid'); + + if(note.hasClass('unread') ){ + note.removeClass('unread'); + $.ajax({ + url: 'notifications/' + note_id, + type: 'PUT' + }); + } }); -%ul.notes - - @group_days.each do |day, notes| - %h3 - %ul - %li - = day - - notes.each do |note| - %li.note{:id => note.id} - %h4{:class => "#{note.unread ? 'unread' : ''}"} - = 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))}" + +.span-1 + = image_tag 'icons/mail_big.png', :height => 30, :width => 30, :style=>"margin-top:3px;" +.span-23.last + %h2 + Notifications + +.span-24.last + %ul.stream.notifications + - @group_days.each do |day, notes| + %li + %h4= day + %ul.notifications_for_day + - notes.each do |note| + %li.message{:data=>{:guid => note.id}, :class => "#{note.unread ? 'unread' : ''}"} + %span.from + = link_to "#{note.person.name.titleize}", person_path(note.person) + = object_link(note) + + %span.time= "#{t('ago', :time => time_ago_in_words(note.created_at))}" diff --git a/public/images/icons/mail_big.png b/public/images/icons/mail_big.png new file mode 100644 index 000000000..c3e181789 Binary files /dev/null and b/public/images/icons/mail_big.png differ diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index e2d2c542c..d30b5513f 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -2134,3 +2134,19 @@ h3,h4 :top 6px :right 0 +ul.notifications_for_day + + :margin 0 + :padding 0 + + li.message + :margin + :bottom 0.3em + :padding 0.2em 0.5em + :width 500px + +.stream.notifications + > li:hover + :background none + :border + :bottom 1px solid #eee