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 d9d7da867..ac7c0348e 100644
--- a/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee
+++ b/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee
@@ -8,7 +8,7 @@ class App.OnlineNotificationWidget extends App.Controller
@bind 'OnlineNotification::changed', =>
@delay(
=> @fetch()
- 1000
+ 1200
'online-notification-changed'
)
@@ -20,14 +20,14 @@ class App.OnlineNotificationWidget extends App.Controller
if !@access()
@el.find('activity-counter').html('')
return
- @start()
+ @createContainer()
if @access()
- @start()
- @subscribeId = App.OnlineNotification.subscribe( @start )
+ @createContainer()
+ @subscribeId = App.OnlineNotification.subscribe( @updateContent )
release: =>
- @stop()
+ @removeContainer()
App.OnlineNotification.unsubscribe( @subscribeId )
access: ->
@@ -46,17 +46,13 @@ class App.OnlineNotificationWidget extends App.Controller
else
@toggle.append('
+
\ No newline at end of file
diff --git a/app/assets/javascripts/app/views/widget/online_notification_header.jst.eco b/app/assets/javascripts/app/views/widget/online_notification_header.jst.eco
deleted file mode 100644
index 6a0f33942..000000000
--- a/app/assets/javascripts/app/views/widget/online_notification_header.jst.eco
+++ /dev/null
@@ -1,5 +0,0 @@
-
- <%- @T( 'Notifications' ) %>
- <%= @counter %>
- <%- @T( 'Mark all as read' ) %>
-
\ No newline at end of file
diff --git a/app/assets/stylesheets/zammad.css.scss b/app/assets/stylesheets/zammad.css.scss
index 84499f35a..776106986 100644
--- a/app/assets/stylesheets/zammad.css.scss
+++ b/app/assets/stylesheets/zammad.css.scss
@@ -2605,7 +2605,7 @@ footer {
margin-left: auto;
}
- a.list-group-item.active > .badge,
+ a.list-group-item.active > .badge,
.nav-pills > .active > a > .badge {
color: #96969b;
background: none;
@@ -2634,10 +2634,6 @@ footer {
z-index: 1110;
box-shadow: 0 1px 14px rgba(0,8,14,.25);
// max-height: calc(100vh - 20px);
-
- &.is-visible {
- display: block;
- }
}
.popover-title {
diff --git a/app/controllers/online_notifications_controller.rb b/app/controllers/online_notifications_controller.rb
index bb8ffac35..f822f693a 100644
--- a/app/controllers/online_notifications_controller.rb
+++ b/app/controllers/online_notifications_controller.rb
@@ -88,12 +88,30 @@ curl http://localhost/api/v1/online_notifications -v -u #{login}:#{password} -H
model_update_render(OnlineNotification, params)
end
- def markAllAsSeen
+=begin
+
+Resource:
+PUT /api/v1/online_notifications/mark_all_as_read
+
+Payload:
+{}
+
+Response:
+{}
+
+Test:
+curl http://localhost/api/v1/online_notifications/mark_all_as_read -v -u #{login}:#{password} -X POST -d '{}'
+
+=end
+
+ def mark_all_as_read
notifications = OnlineNotification.list(current_user,100)
notifications.each do |notification|
- OnlineNotification.seen({:id => notification['id']})
+ if !notification['seen']
+ OnlineNotification.seen( :id => notification['id'] )
+ end
end
- render :json => {data:'ok'}
+ render :json => {}, :status => :ok
end
-end
+end
\ No newline at end of file
diff --git a/config/routes/online_notification.rb b/config/routes/online_notification.rb
index 66ec56527..6c3a6d8fb 100644
--- a/config/routes/online_notification.rb
+++ b/config/routes/online_notification.rb
@@ -2,8 +2,8 @@ Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
# groups
- match api_path + '/online_notifications', :to => 'online_notifications#index', :via => :get
- match api_path + '/online_notifications/:id', :to => 'online_notifications#update', :via => :put
- match api_path + '/online_notifications/markAllAsSeen', :to => 'online_notifications#markAllAsSeen', :via => :post
+ match api_path + '/online_notifications', :to => 'online_notifications#index', :via => :get
+ match api_path + '/online_notifications/:id', :to => 'online_notifications#update', :via => :put
+ match api_path + '/online_notifications/mark_all_as_read', :to => 'online_notifications#mark_all_as_read', :via => :post
end
\ No newline at end of file