Fix notification UI BT#16386

pull/3075/head
Julio Montoya 6 years ago
parent bf4f4a55c4
commit 983a7c75fc
  1. 11
      app/Resources/public/css/base.css
  2. 73
      main/template/default/layout/menu.tpl
  3. 22
      main/template/default/layout/notification.tpl

@ -9440,6 +9440,11 @@ ul.dropdown-menu.inner > li > a {
float:right !important;
}
#count_message_li{
display: block;
float:right !important;
}
.sidebar-scorm {
width: 25.66666667%;
}
@ -9486,9 +9491,6 @@ ul.dropdown-menu.inner > li > a {
/* Landscape phones and down */
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
#user-dropdown {
display: none;
}
#notification-menu{
width: 250px !important;
min-width : 250px !important;
@ -9585,9 +9587,6 @@ ul.dropdown-menu.inner > li > a {
display: block;
font-size: 16px;
}
#user-dropdown {
display: none;
}
#notification-menu{
width: 300px !important;
min-width : 300px !important;

@ -1,7 +1,7 @@
<!-- Fixed navbar -->
{% if _u.logged == 1 and not user_in_anon_survey %}
<script>
$(document).ready(function () {
$(function () {
$.get('{{ _p.web_main }}inc/ajax/message.ajax.php?a=get_count_message', function(data) {
var countNotifications = (data.ms_friends + data.ms_groups + data.ms_inbox);
if (countNotifications === 0 || isNaN(countNotifications)) {
@ -24,8 +24,9 @@
<span class="icon-bar"></span>
</button>
{% if notification_event == 1%}
<button id="user-dropdown" type="button" class="menu-dropdown pull-right navbar-toggle collapsed" data-toggle="collapse" data-target="#user-dropdown-menu" aria-expanded="false" aria-controls="navbar">
{% if notification_event == 1 %}
<button id="user-dropdown" type="button" class="menu-dropdown pull-right navbar-toggle collapsed"
data-toggle="collapse" data-target="#user-dropdown-menu" aria-expanded="false" aria-controls="navbar">
<img class="img-circle" src="{{ _u.avatar_small }}" alt="{{ _u.complete_name }}"/>
<span class="caret"></span>
@ -73,30 +74,41 @@
</ul>
</button>
<button id="notifications-dropdown" type="button" class="pull-right menu-dropdown navbar-toggle collapsed" data-toggle="collapse" data-target="#notification-menu" aria-expanded="false" aria-controls="navbar">
<i id="notificationsIcon" class="fa fa-bell-o " aria-hidden="true"></i>
{# hide red button loading #}
<span id="notificationsBadge" class="label label-danger">
<i class="fa fa-spinner fa-pulse fa-fw" aria-hidden="true"></i>
</span>
<div id="notification-menu" class="dropdown-menu notification-dropdown-menu" aria-labelledby="notifications-dropdown">
<h5 class="dropdown-header">
<i class="fa fa-bell-o" aria-hidden="true"></i> <span class="fw-600 c-grey-900">
{{ 'Notifications' | get_lang }}
</span>
</h5>
<a id="notificationsLoader" class="dropdown-item dropdown-notification" href="#">
<p class="notification-solo text-center">
<i id="notificationsIcon" class="fa fa-spinner fa-pulse fa-fw" aria-hidden="true"></i>
{{ 'Loading' | get_lang }}
</p>
</a>
<ul id="notificationsContainer" class="notifications-container"></ul>
<a id="notificationEmpty" class="dropdown-item dropdown-notification" href="#">
<p class="notification-solo text-center"> {{ 'NoNewNotification' | get_lang }}</p>
</a>
</div>
{% if _u.logged == 1 %}
<button id="notifications-dropdown" type="button" class="pull-right menu-dropdown navbar-toggle collapsed"
data-toggle="collapse" data-target="#notification-menu" aria-expanded="false" aria-controls="navbar">
<i id="notificationsIcon" class="fa fa-bell-o " aria-hidden="true"></i>
{# hide red button loading #}
<span id="notificationsBadge" class="label label-danger">
<i class="fa fa-spinner fa-pulse fa-fw" aria-hidden="true"></i>
</span>
<div id="notification-menu"
class="dropdown-menu notification-dropdown-menu" aria-labelledby="notifications-dropdown">
<h5 class="dropdown-header">
<i class="fa fa-bell-o" aria-hidden="true"></i> <span class="fw-600 c-grey-900">
{{ 'Notifications' | get_lang }}
</span>
</h5>
<a id="notificationsLoader" class="dropdown-item dropdown-notification" href="#">
<p class="notification-solo text-center">
<i id="notificationsIcon" class="fa fa-spinner fa-pulse fa-fw" aria-hidden="true"></i>
{{ 'Loading' | get_lang }}
</p>
</a>
<ul id="notificationsContainer" class="notifications-container"></ul>
<a id="notificationEmpty" class="dropdown-item dropdown-notification" href="#">
<p class="notification-solo text-center"> {{ 'NoNewNotification' | get_lang }}</p>
</a>
</div>
</button>
{% endif %}
<button id="count_message_li" type="button" class="pull-right navbar-toggle collapsed menu-dropdown" aria-expanded="true">
<a href="{{ message_url }}">
<span id="count_message" class="badge badge-warning"></span>
</a>
</button>
{% endif %}
<a class="navbar-brand" href="{{ _p.web }}"> <i class="fa fa-home"></i> </a>
</div>
@ -105,7 +117,6 @@
<ul class="nav navbar-nav">
{% for item in menu %}
{% set show_item = true %}
{% if user_in_anon_survey and item.key != 'homepage' %}
{% set show_item = false %}
{% endif %}
@ -121,11 +132,7 @@
</ul>
{% if _u.logged == 1 and not user_in_anon_survey %}
<ul class="nav navbar-nav navbar-right">
<li id="count_message_li" class="hidden">
<a href="{{ message_url }}">
<span id="count_message" class="badge badge-warning"></span>
</a>
</li>
{% if language_form %}
<li class="dropdown language">
{{ language_form }}
@ -187,7 +194,7 @@
{% endif %}
{% endif %}
{% if notification_event == 1%}
{% if notification_event == 1 %}
{% include 'default/layout/notification.tpl' %}
{% endif %}
</ul>

@ -40,8 +40,8 @@
});
},
loadAll: function () {
console.log('loadAll');
console.log('count : ' + count);
//console.log('loadAll');
//console.log('count : ' + count);
if (count !== lastCount || count === 0) {
appNotifications.load();
}
@ -87,10 +87,10 @@
}
},
loadNumber: function () {
console.log('loadNumber');
//console.log('loadNumber');
$.get('{{ _p.web_main }}inc/ajax/message.ajax.php?a=get_count_notifications', function(data) {
count = data;
console.log(count);
//console.log(count);
$("#notificationsBadge").html(count);
@ -129,8 +129,8 @@
appNotifications.loadingMask(true);
$('#notificationsContainer').html("");
lastCount = count;
console.log('load');
console.log(count);
//console.log('load');
//console.log(count);
$.getJSON('{{ _p.web_main }}inc/ajax/message.ajax.php?a=get_notifications', function(data) {
$.each(data, function(key, value) {
@ -164,11 +164,11 @@
}
var notificationId = elem.parent().parent().attr('id');
console.log('markAsRead id : ' + notificationId);
//console.log('markAsRead id : ' + notificationId);
$.ajax({
url: '{{ _p.web_main }}inc/ajax/message.ajax.php?a=mark_notification_as_read&id='+notificationId,
success: function (data) {
console.log(notifications);
//console.log(notifications);
notifications = $.grep(notifications, function(value) {
if (notificationId == value.id) {
return false;
@ -176,11 +176,10 @@
return true;
});
console.log(notifications);
//console.log(notifications);
count--;
console.log('count : ' + count);
//appNotifications.loadAll();
//console.log('count : ' + count);
appNotifications.loadNotificationArray();
}
});
@ -206,7 +205,6 @@
//appNotifications.init();
});
</script>
<!-- template -->
<script id="notificationTemplate" type="text/html">

Loading…
Cancel
Save