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

Corrige expansión de panel de notificaciones

Al pulsar sobre las notificaciones pero sin acertar sobre el icono
concretamente, se abría y cerraba el panel con el mismo evento. Ahora se
contempla como nodo válido el propio domNode para evitarlo.

Abstrae la extracción de items pulsados implementada en Router para
poderla usar en todos los módulos, como por ejemplo en Notification.
parent abb5c0da
Loading
Loading
Loading
Loading
+0 −17
Original line number Diff line number Diff line
@@ -262,23 +262,6 @@ define([
			}
		},

		_getClickTargets: function(event) {

			var targetPath = event.path || (event.composedPath && event.composedPath()) || [],
				targets = [
					event.currentTarget.activeElement
				];

			if (!targetPath.length) {
				var eventTarget = event.target || event.srcElement,
					eventTargetParent = eventTarget.parentElement;

				targetPath.push(eventTarget, eventTargetParent);
			}

			return targets.concat(targetPath);
		},

		_handleAppHref: function(event, target) {

			var url = target.pathname + target.search;
+28 −0
Original line number Diff line number Diff line
define([
	'dojo/_base/declare'
], function(
	declare
) {

	return declare(null, {
		//	summary:
		//		Base de utilidades para gestionar los eventos de click recibidos por los módulos.

		_getClickTargets: function(event) {

			var targetPath = event.path || (event.composedPath && event.composedPath()) || [],
				targets = [
					event.currentTarget.activeElement
				];

			if (!targetPath.length) {
				var eventTarget = event.target || event.srcElement,
					eventTargetParent = eventTarget.parentElement;

				targetPath.push(eventTarget, eventTargetParent);
			}

			return targets.concat(targetPath);
		}
	});
});
+5 −2
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ define([
	, "redmic/base/Mediator"
	, "./_ChkCollection"
	, "./_CommunicationCenter"
	, "./_ManageClickEvent"
	, "./_ModuleItfc"
], function(
	deepmerge
@@ -29,9 +30,11 @@ define([
	, Mediator
	, _ChkCollection
	, _CommunicationCenter
	, _ManageClickEvent
	, _ModuleItfc
) {
	return declare([_WidgetBase, Evented, _ModuleItfc, _ChkCollection, _CommunicationCenter], {

	return declare([_WidgetBase, Evented, _ModuleItfc, _ChkCollection, _CommunicationCenter, _ManageClickEvent], {
		//	summary:
		//		Base común para todos los módulos.
		//	description:
+7 −8
Original line number Diff line number Diff line
define([
	"dojo/_base/declare"
	, "dojo/on"
	, "dojo/query"
	, "dojo/_base/lang"
	, "redmic/modules/base/_Module"
	, "redmic/modules/base/_Show"
@@ -9,12 +8,9 @@ define([
	, "redmic/modules/notification/NotificationSidebar"
	, "redmic/modules/notification/TaskNotification"
	, "put-selector/put"
	, "dojo/NodeList-dom"
	, "dojo/NodeList-traverse"
], function(
	declare
	, on
	, query
	, lang
	, _Module
	, _Show
@@ -23,6 +19,7 @@ define([
	, TaskNotification
	, put
) {

	return declare([_Module, _Show, _Store], {
		//	summary:
		//		Módulo encargado de procesar las notificaciones de los demás.
@@ -137,9 +134,11 @@ define([
		_onCloseNotificationSidebar: function(evt) {

			var clickedNode = evt.target,
				nodeParents = query(clickedNode).parents(),
				nodeDoesNotBelongToNotificationButton = nodeParents.indexOf(this.domNode) === -1,
				nodeDoesNotBelongToNotificationSidebar = nodeParents.indexOf(this.notificationSidebarNode) === -1;
				targets = this._getClickTargets(evt),
				nodeDoesNotBelongToNotificationButton = targets.indexOf(this.domNode) === -1 &&
					clickedNode !== this.domNode,

				nodeDoesNotBelongToNotificationSidebar = targets.indexOf(this.notificationSidebarNode) === -1;

			if (nodeDoesNotBelongToNotificationButton && nodeDoesNotBelongToNotificationSidebar) {
				this._clickNotification(evt);