Skip to content
Extraits de code Groupes Projets
index.html.haml 1,16 ko
Newer Older
maxwell's avatar
maxwell a validé
:javascript
maxwell's avatar
maxwell a validé
  $('.message').live('click', function(evt){
    var note = $(this).closest('.message'),
        note_id = note.attr('data-guid'),
        nBadge = $("#notification_badge_number");

    if(note.hasClass('unread') ){
      note.removeClass('unread');
      $.ajax({
        url: 'notifications/' + note_id,
        type: 'PUT'
      });
    }
maxwell's avatar
maxwell a validé

    nBadge.html().replace(/\d+/, function(num){
      num = parseInt(num);
      nBadge.html(parseInt(num)-1);
      if(num == 1) {
        nBadge.addClass("hidden");
      }
    });
  });

.span-1
  = image_tag 'icons/mail_big.png', :height => 30, :width => 30, :style=>"margin-top:3px;"
.span-23.last
  %h2
MrZYX's avatar
MrZYX a validé
    = t('.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.actor.name.titleize}", person_path(note.actor)
                = object_link(note)

              %span.time= "#{t('ago', :time => time_ago_in_words(note.created_at))}"