Commit b341c380 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Corrige cierre de sidebar de notificaciones

Para controlar entradas repetidas al método de cerrar el sidebar de
notificaciones, se anulaba el evento recibido. A causa de esto, se
rompía el comportamiento de Single Page Application, recargando toda la
página. Se corrige la detección de nodo pulsado para evitar esa
solución.
parent db299ffd
Loading
Loading
Loading
Loading
+12 −20
Original line number Diff line number Diff line
@@ -54,7 +54,6 @@ define([
				targetNotificationSidebar: "notificationSidebar",
				_countNotification: 0,
				statusNotificationSidebarShown: false,
				closeNotificationSidebarHandler: null,
				alertWithId: {},
				items: [{
						target: "task",
@@ -75,10 +74,6 @@ define([
			};

			lang.mixin(this, this.config, args);

			this.closeNotificationSidebarHandler = on.pausable(document.body, "click",
				lang.hitch(this, this._onCloseNotificationSidebar));
			this.closeNotificationSidebarHandler.pause();
		},

		_initialize: function() {
@@ -124,6 +119,8 @@ define([

		postCreate: function() {

			this.inherited(arguments);

			put(this.domNode, ".notification");
			this.containerNode = put(this.domNode, "div");
			this.iconNode = put(this.containerNode, "i.fa.fa-bell-o");
@@ -133,20 +130,19 @@ define([

			this.containerNode.onclick = lang.hitch(this, this._clickNotification);

			this.inherited(arguments);
			this.closeNotificationSidebarHandler = on.pausable(this.ownerDocumentBody, "click",
				lang.hitch(this, this._onCloseNotificationSidebar));
			this.closeNotificationSidebarHandler.pause();
		},

		_onCloseNotificationSidebar: function(evt) {

			var isNodeNotificationSidebar = query(evt.target).parents().some(lang.hitch(this, function(node) {
				if (node === this.notificationSidebarNode) {
					return true;
				} else {
					return false;
				}
			}));
			var clickedNode = evt.target,
				nodeParents = query(clickedNode).parents(),
				nodeDoesNotBelongToNotificationButton = nodeParents.indexOf(this.domNode) === -1,
				nodeDoesNotBelongToNotificationSidebar = nodeParents.indexOf(this.notificationSidebarNode) === -1;

			if (!(isNodeNotificationSidebar)) {
			if (nodeDoesNotBelongToNotificationButton && nodeDoesNotBelongToNotificationSidebar) {
				this._clickNotification(evt);
			}
		},
@@ -157,10 +153,10 @@ define([

			if (this.statusNotificationSidebarShown) {
				this.statusNotificationSidebarShown = false;
				this.closeNotificationSidebarHandler && this.closeNotificationSidebarHandler.pause();
				this.closeNotificationSidebarHandler.pause();
				eventPublication = 'HIDE_NOTIFICATION_SIDEBAR';
			} else {
				this.closeNotificationSidebarHandler && this.closeNotificationSidebarHandler.resume();
				this.closeNotificationSidebarHandler.resume();
				this.statusNotificationSidebarShown = true;
				eventPublication = 'SHOW_NOTIFICATION_SIDEBAR';

@@ -177,10 +173,6 @@ define([
			this._emitEvt(eventPublication, {
				node: this.notificationSidebarNode
			});

			if (evt) {
				evt.stopPropagation();
			}
		},

		_getNodeToShow: function() {