- 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,11 +73,15 @@ 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
@frontendTimeUpdate() @frontendTimeUpdate()

View file

@ -1,15 +1,22 @@
<% for item in @items: %> <% if @items.length: %>
<div class="activity-entry horizontal"> <a href="#"><%- @T( 'Mark all as seen.' ) %></a>
<a class="activity-avatar user-popover" data-id="<%= item.created_by_id %>" href="<%- item.created_by.uiUrl() %>"> <% for item in @items: %>
<%- item.created_by.avatar() %> <div class="activity-entry horizontal">
</a> <a class="activity-avatar user-popover" data-id="<%= item.created_by_id %>" href="<%- item.created_by.uiUrl() %>">
<a href="<%- item.link %>" class="activity-body flex horizontal"> <%- item.created_by.avatar() %>
<span class="activity-message flex"> </a>
<span class="activity-text <% if item.seen: %>inactive<% end %>"> <a href="<%- item.link %>" class="activity-body flex horizontal">
<%= item.created_by.displayName() %> <%- @T( item.type ) %> <%- @T( item.object_name ) %><% if item.title: %> (<%= item.title %>)<% end %> <span class="activity-message flex">
<span class="activity-text <% if item.seen: %>inactive<% end %>">
<%= item.created_by.displayName() %> <%- @T( item.type ) %> <%- @T( item.object_name ) %><% if item.title: %> (<%= item.title %>)<% end %>
</span>
<span class="activity-time <% if item.seen: %>inactive<% end %> humanTimeFromNow" data-time="<%- item.created_at %>">?</span>
</span> </span>
<span class="activity-time <% if item.seen: %>inactive<% end %> humanTimeFromNow" data-time="<%- item.created_at %>">?</span> </a>
</span> </div>
</a> <% end %>
</div> <% 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