Implement popup notifications filter based on tab notification's indicator

This commit is contained in:
Hadi Nategh 2020-07-27 14:44:44 +02:00
parent 47505cd6b2
commit 231312b0aa
7 changed files with 44 additions and 1 deletions

View File

@ -358,8 +358,15 @@ function egw_fw_ui_tab(_parent, _contHeaderDiv, _contDiv, _icon, _callback,
}); });
this.notificationDiv = document.createElement("div"); this.notificationDiv = document.createElement("div");
var self = this;
jQuery(this.notificationDiv).addClass('notifyTabDiv') jQuery(this.notificationDiv).addClass('notifyTabDiv')
.hide() .hide()
.click(function(e){
if (app.notifications.tabToggle(self.tag.appName))
{
e.stopImmediatePropagation();
}
})
.appendTo(this.headerDiv); .appendTo(this.headerDiv);
jQuery(this.headerDiv).append(this.closeButton); jQuery(this.headerDiv).append(this.closeButton);

View File

@ -90,6 +90,8 @@
// query notifictions now // query notifictions now
this.run_notifications(); this.run_notifications();
this.filter = '';
}; };
notifications.prototype.run_notifications = function () notifications.prototype.run_notifications = function ()
@ -216,6 +218,7 @@
for(var index in indexes) for(var index in indexes)
{ {
var id = indexes[index]; var id = indexes[index];
if (this.filter && notifymessages[id]['data']['app'] != this.filter) continue;
var $message, $mark, $delete, $inner_container, $nav_prev, $nav_next, var $message, $mark, $delete, $inner_container, $nav_prev, $nav_next,
$more_info, $top_toolbar, $open_entry, $date, $collapse; $more_info, $top_toolbar, $open_entry, $date, $collapse;
var message_id = 'egwpopup_message_'+id; var message_id = 'egwpopup_message_'+id;
@ -772,6 +775,21 @@
return typeof data == 'object'? data: {}; return typeof data == 'object'? data: {};
}; };
notifications.prototype.tabToggle = function (_appname)
{
for (var i in notifymessages)
{
if (notifymessages[i]['extra_data']['app'] == _appname)
{
this.filter = _appname;
this.toggle();
return true;
}
}
return false;
};
/** /**
* toggle notifications container * toggle notifications container
* @param boolean _stat true keeps the popup on * @param boolean _stat true keeps the popup on
@ -781,7 +799,8 @@
var $egwpopup = jQuery('#egwpopup'); var $egwpopup = jQuery('#egwpopup');
var $body = jQuery('body'); var $body = jQuery('body');
var $counter = jQuery('#topmenu_info_notifications'); var $counter = jQuery('#topmenu_info_notifications');
this.display();
var self = this;
if (!$egwpopup.is(":visible")) if (!$egwpopup.is(":visible"))
{ {
$body.on('click', function(e){ $body.on('click', function(e){
@ -789,6 +808,7 @@
!$egwpopup.is(e.target) && $egwpopup.has(e.target).length == 0) !$egwpopup.is(e.target) && $egwpopup.has(e.target).length == 0)
{ {
jQuery(this).off(e); jQuery(this).off(e);
self.filter = '';
$egwpopup.toggle('slide'); $egwpopup.toggle('slide');
egw.loading_prompt('popup_notifications', false); egw.loading_prompt('popup_notifications', false);
} }
@ -797,6 +817,7 @@
} }
else else
{ {
this.filter = '';
egw.loading_prompt('popup_notifications', false); egw.loading_prompt('popup_notifications', false);
if (_stat) return; if (_stat) return;
$body.off('click'); $body.off('click');

View File

@ -4334,6 +4334,9 @@ td.message span.message {
width: 17px; width: 17px;
font-weight: bold; font-weight: bold;
} }
#egw_fw_main #egw_fw_tabs .egw_fw_ui_tabs_header .egw_fw_ui_tab_header .notifyTabDiv:hover {
background-color: #1E1E1E;
}
#egw_fw_main #egw_fw_tabs .egw_fw_ui_tabs_header .egw_fw_ui_tab_header:hover { #egw_fw_main #egw_fw_tabs .egw_fw_ui_tabs_header .egw_fw_ui_tab_header:hover {
background-color: rgba(153, 204, 255, 0.4); background-color: rgba(153, 204, 255, 0.4);
padding-bottom: 0px; padding-bottom: 0px;

View File

@ -4323,6 +4323,9 @@ td.message span.message {
width: 17px; width: 17px;
font-weight: bold; font-weight: bold;
} }
#egw_fw_main #egw_fw_tabs .egw_fw_ui_tabs_header .egw_fw_ui_tab_header .notifyTabDiv:hover {
background-color: #1E1E1E;
}
#egw_fw_main #egw_fw_tabs .egw_fw_ui_tabs_header .egw_fw_ui_tab_header:hover { #egw_fw_main #egw_fw_tabs .egw_fw_ui_tabs_header .egw_fw_ui_tab_header:hover {
background-color: rgba(153, 204, 255, 0.4); background-color: rgba(153, 204, 255, 0.4);
padding-bottom: 0px; padding-bottom: 0px;

View File

@ -4334,6 +4334,9 @@ td.message span.message {
width: 17px; width: 17px;
font-weight: bold; font-weight: bold;
} }
#egw_fw_main #egw_fw_tabs .egw_fw_ui_tabs_header .egw_fw_ui_tab_header .notifyTabDiv:hover {
background-color: #1E1E1E;
}
#egw_fw_main #egw_fw_tabs .egw_fw_ui_tabs_header .egw_fw_ui_tab_header:hover { #egw_fw_main #egw_fw_tabs .egw_fw_ui_tabs_header .egw_fw_ui_tab_header:hover {
background-color: rgba(153, 204, 255, 0.4); background-color: rgba(153, 204, 255, 0.4);
padding-bottom: 0px; padding-bottom: 0px;

View File

@ -101,6 +101,9 @@
line-height: 16px; line-height: 16px;
width: 17px; width: 17px;
font-weight: bold; font-weight: bold;
&:hover {
background-color: @gray_90;
}
} }
&:hover { &:hover {
background-color: @color_hover_row; background-color: @color_hover_row;

View File

@ -4345,6 +4345,9 @@ td.message span.message {
width: 17px; width: 17px;
font-weight: bold; font-weight: bold;
} }
#egw_fw_main #egw_fw_tabs .egw_fw_ui_tabs_header .egw_fw_ui_tab_header .notifyTabDiv:hover {
background-color: #1E1E1E;
}
#egw_fw_main #egw_fw_tabs .egw_fw_ui_tabs_header .egw_fw_ui_tab_header:hover { #egw_fw_main #egw_fw_tabs .egw_fw_ui_tabs_header .egw_fw_ui_tab_header:hover {
background-color: rgba(153, 204, 255, 0.4); background-color: rgba(153, 204, 255, 0.4);
padding-bottom: 0px; padding-bottom: 0px;