- add "mark all notifications as seen" to the notification box.

- added translation
- added Info "No Notifications" to the notification box
This commit is contained in:
Johannes Nickel 2015-01-07 21:58:05 +01:00
parent c291b70ec2
commit dc44f9ef5c
3 changed files with 33 additions and 16 deletions

View file

@ -43,6 +43,11 @@ class App.OnlineNotificationWidget extends App.Controller
else else
@el.find('.logo').append('<div class="activity-counter">' + count.toString() + '</div>') @el.find('.logo').append('<div class="activity-counter">' + count.toString() + '</div>')
markAllAsSeen: (items) =>
for item in items
if !item.seen
App.OnlineNotification.seen( 'Ticket', item.id )
stop: => stop: =>
@counterUpdate(0) @counterUpdate(0)
@el.find('.logo').popover('destroy') @el.find('.logo').popover('destroy')
@ -68,10 +73,14 @@ class App.OnlineNotificationWidget extends App.Controller
placement: 'right' placement: 'right'
title: -> title: ->
App.i18n.translateInline( 'Notifications' ) + " <span>#{counter}</span>" App.i18n.translateInline( 'Notifications' ) + " <span>#{counter}</span>"
content: -> content: =>
# insert data # insert data
App.view('widget/online_notification')( html = $( App.view('widget/online_notification')(
items: items items: items
))
html.on('click', (e) =>
e.preventDefault()
@markAllAsSeen(items)
) )
).on('shown.bs.popover', => ).on('shown.bs.popover', =>
# show frontend times # show frontend times

View file

@ -1,5 +1,7 @@
<% for item in @items: %> <% if @items.length: %>
<div class="activity-entry horizontal"> <a href="#"><%- @T( 'Mark all as seen.' ) %></a>
<% for item in @items: %>
<div class="activity-entry horizontal">
<a class="activity-avatar user-popover" data-id="<%= item.created_by_id %>" href="<%- item.created_by.uiUrl() %>"> <a class="activity-avatar user-popover" data-id="<%= item.created_by_id %>" href="<%- item.created_by.uiUrl() %>">
<%- item.created_by.avatar() %> <%- item.created_by.avatar() %>
</a> </a>
@ -11,5 +13,10 @@
<span class="activity-time <% if item.seen: %>inactive<% end %> humanTimeFromNow" data-time="<%- item.created_at %>">?</span> <span class="activity-time <% if item.seen: %>inactive<% end %> humanTimeFromNow" data-time="<%- item.created_at %>">?</span>
</span> </span>
</a> </a>
</div> </div>
<% end %>
<% else: %>
<h3 class="u-textTruncate" title="<%- @Ti( 'Name') %>">
<%- @T("No unread Notifications for you. :) ") %>
</h3>
<% end %> <% end %>

View file

@ -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 => "to", :target => "nach" )
Translation.create_if_not_exists( :locale => 'de', :source => "%s ago", :target => "vor %s" ) 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 => "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 => "" ) #Translation.create_if_not_exists( :locale => 'de', :source => "", :target => "" )
# install all packages in auto_install # install all packages in auto_install