From dc44f9ef5cd6f89a1143b45f294ec8c6e7373830 Mon Sep 17 00:00:00 2001 From: Johannes Nickel Date: Wed, 7 Jan 2015 21:58:05 +0100 Subject: [PATCH] - add "mark all notifications as seen" to the notification box. - added translation - added Info "No Notifications" to the notification box --- .../widget/online_notification.js.coffee | 15 +++++++-- .../views/widget/online_notification.jst.eco | 33 +++++++++++-------- db/seeds.rb | 1 + 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee b/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee index aebff64b3..459010f26 100644 --- a/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee +++ b/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee @@ -43,6 +43,11 @@ class App.OnlineNotificationWidget extends App.Controller else @el.find('.logo').append('
' + count.toString() + '
') + markAllAsSeen: (items) => + for item in items + if !item.seen + App.OnlineNotification.seen( 'Ticket', item.id ) + stop: => @counterUpdate(0) @el.find('.logo').popover('destroy') @@ -68,11 +73,15 @@ class App.OnlineNotificationWidget extends App.Controller placement: 'right' title: -> App.i18n.translateInline( 'Notifications' ) + " #{counter}" - content: -> + content: => # insert data - App.view('widget/online_notification')( + html = $( App.view('widget/online_notification')( items: items - ) + )) + html.on('click', (e) => + e.preventDefault() + @markAllAsSeen(items) + ) ).on('shown.bs.popover', => # show frontend times @frontendTimeUpdate() diff --git a/app/assets/javascripts/app/views/widget/online_notification.jst.eco b/app/assets/javascripts/app/views/widget/online_notification.jst.eco index df16cdd73..577c01683 100644 --- a/app/assets/javascripts/app/views/widget/online_notification.jst.eco +++ b/app/assets/javascripts/app/views/widget/online_notification.jst.eco @@ -1,15 +1,22 @@ -<% for item in @items: %> -
- - <%- item.created_by.avatar() %> - - - - - <%= item.created_by.displayName() %> <%- @T( item.type ) %> <%- @T( item.object_name ) %><% if item.title: %> (<%= item.title %>)<% end %> +<% if @items.length: %> + <%- @T( 'Mark all as seen.' ) %> + <% for item in @items: %> +
+ + <%- item.created_by.avatar() %> + + + + + <%= item.created_by.displayName() %> <%- @T( item.type ) %> <%- @T( item.object_name ) %><% if item.title: %> (<%= item.title %>)<% end %> + + ? - ? - - -
+ +
+ <% end %> +<% else: %> +

+ <%- @T("No unread Notifications for you. :) ") %> +

<% end %> \ No newline at end of file diff --git a/db/seeds.rb b/db/seeds.rb index 5a6c3c488..09cbe4a22 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1914,6 +1914,7 @@ Translation.create_if_not_exists( :locale => 'de', :source => "from", :target => Translation.create_if_not_exists( :locale => 'de', :source => "to", :target => "nach" ) Translation.create_if_not_exists( :locale => 'de', :source => "%s ago", :target => "vor %s" ) Translation.create_if_not_exists( :locale => 'de', :source => "in %s", :target => "in %s" ) +Translation.create_if_not_exists( :locale => 'de', :source => "Mark all as seen.", :target => "Alle als gelesen markieren." ) #Translation.create_if_not_exists( :locale => 'de', :source => "", :target => "" ) # install all packages in auto_install