- 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
@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: =>
@counterUpdate(0)
@el.find('.logo').popover('destroy')
@ -68,11 +73,15 @@ class App.OnlineNotificationWidget extends App.Controller
placement: 'right'
title: ->
App.i18n.translateInline( 'Notifications' ) + " <span>#{counter}</span>"
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()

View file

@ -1,15 +1,22 @@
<% 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() %>">
<%- item.created_by.avatar() %>
</a>
<a href="<%- item.link %>" class="activity-body flex horizontal">
<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 %>
<% if @items.length: %>
<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() %>">
<%- item.created_by.avatar() %>
</a>
<a href="<%- item.link %>" class="activity-body flex horizontal">
<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 class="activity-time <% if item.seen: %>inactive<% end %> humanTimeFromNow" data-time="<%- item.created_at %>">?</span>
</span>
</a>
</div>
</a>
</div>
<% end %>
<% else: %>
<h3 class="u-textTruncate" title="<%- @Ti( 'Name') %>">
<%- @T("No unread Notifications for you. :) ") %>
</h3>
<% 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 => "%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