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

Unifica escucha de clicks en nodo raíz

parent 55e52901
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -223,8 +223,7 @@ define([

		_createListeners: function() {

			this._appClickHandler = on.pausable(this.ownerDocumentBody, 'click', lang.hitch(this, this._onAppClicked));

			this._appClickHandler = this._listenGlobalClicks(lang.hitch(this, this._onAppClicked));
			this._appClickHandler.pause();
		},

+14 −0
Original line number Diff line number Diff line
define([
	'dojo/_base/declare'
	, 'dojo/on'
], function(
	declare
	, on
) {

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

		_listenGlobalClicks: function(callback) {

			if (!callback) {
				console.error('Callback not provided to listen global clicks at module "%s"', this.getChannel());
				return;
			}

			this._listenGlobalClicksHandler = on.pausable(this.ownerDocumentBody, 'click', callback);

			return this._listenGlobalClicksHandler;
		},

		_getClickTargets: function(event) {

			var targetPath = event.path || (event.composedPath && event.composedPath()) || [],
+5 −6
Original line number Diff line number Diff line
@@ -126,12 +126,11 @@ define([

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

			this.closeNotificationSidebarHandler = on.pausable(this.ownerDocumentBody, "click",
				lang.hitch(this, this._onCloseNotificationSidebar));
			this.closeNotificationSidebarHandler.pause();
			this._globalClicksHandler = this._listenGlobalClicks(lang.hitch(this, this._evaluateToCloseSidebar));
			this._globalClicksHandler.pause();
		},

		_onCloseNotificationSidebar: function(evt) {
		_evaluateToCloseSidebar: function(evt) {

			var nodeBelongsToNotificationButton = this._checkClickBelongsToNode(evt, this.domNode),
				nodeBelongsToNotificationSidebar = this._checkClickBelongsToNode(evt, this.notificationSidebarNode);
@@ -149,10 +148,10 @@ define([

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