Commit 65e79011 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Convierte Sidebar en un módulo de verdad

Hasta ahora, al widget Sidebar solo se le había adornado con una
herencia de módulo, pero no se usaba como tal. Seguía extendiendo de
ContentPane y mostrándose como hijo añadido a un BorderContainer, en
lugar de publicarle a su canal 'show'. Se ha corregido este hecho y
reescrito un poco su implementación, para arreglar otros detalles
(código muerto, copy&paste sin leer...).

Además, ahora Sidebar se auto-colapsa cuando el ancho de pantalla es
bajo, para ganar espacio. También se auto-expande si el ancho aumenta
por encima del umbral.

Actualiza submódulo de estilos.
parent e1ca110f
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ define([
	'app/_app'
	, 'app/components/Topbar'
	, 'dijit/layout/BorderContainer'
	, 'dijit/layout/ContentPane'
	, 'dijit/layout/LayoutContainer'
	, 'dojo/_base/declare'
	, 'dojo/_base/lang'
@@ -23,6 +24,7 @@ define([
	App
	, Topbar
	, BorderContainer
	, ContentPane
	, LayoutContainer
	, declare
	, lang
@@ -99,9 +101,13 @@ define([
		postCreate: function() {

			this.addChild(this.bc);
			this.addChild(this.sidebar);
			this.addChild(this.sidebarNode);
			this.addChild(this.topbar);

			this._publish(this.sidebar.getChannel('SHOW'), {
				node: this.sidebarNode
			});

			this.inherited(arguments);

			// TODO esto es un abuso, no deberíamos acceder a los nodos de un módulo desde fuera. Crear canal para
@@ -141,6 +147,10 @@ define([
			//	tags:
			//		private

			this.sidebar = new MainSidebarImpl({
				parentChannel: this.ownChannel
			});

			new QueryStore({
				parentChannel: this.ownChannel
			});
@@ -189,8 +199,9 @@ define([
			//	tags:
			//		private

			this.sidebar = new MainSidebarImpl({
				parentChannel: this.ownChannel
			this.sidebarNode = new ContentPane({
				region: 'left',
				'class': 'mainSidebar'
			});

			this.topbar = new Topbar({
+9 −81
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ define([
	, _Secondary
	, Sidebar
) {

	return declare([Sidebar, _Secondary], {
		//	summary:
		//		Módulo para la creación del Sidebar de la aplicación.
@@ -23,98 +24,25 @@ define([
		//		Si se hace click sobre algún módulo, la aplicación lo cargará.
		//		Si se accede con una ruta previa, se detectará para informar del módulo y categoría activos.

		constructor: function(args) {

			this.config = {
				"class": "mainSidebar",
				region: "left",
				// own actions
				mainSidebarActions: {
					GET_ALLOWED_MODULES: "getAllowedModules",
					AVAILABLE_ALLOWED_MODULES: "availableAllowedModules",
					UPDATE_ACTIVE: "updateActive"
				},
				mainSidebarEvents: {
					GET_ALLOWED_MODULES: "getAllowedModules"
				},
				suffixI18n: '-view',
				subitems: 'modules',
				// mediator params
				ownChannel: "sidebar"
			};

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

			aspect.before(this, "_mixEventsAndActions", lang.hitch(this, this._mixMainSidebarEventsAndActions));
			aspect.after(this, "_defineSubscriptions", lang.hitch(this, this._defineMainSidebarSubscriptions));
			aspect.after(this, "_definePublications", lang.hitch(this, this._defineMainSidebarPublications));
		},

		_mixMainSidebarEventsAndActions: function () {

			lang.mixin(this.events, this.mainSidebarEvents);
			lang.mixin(this.actions, this.mainSidebarActions);

			delete this.mainSidebarEvents;
			delete this.mainSidebarActions;
		},

		_defineMainSidebarSubscriptions: function () {

			this.inherited(arguments);

			this.subscriptionsConfig.push({
				channel : this._buildChannel(this.credentialsChannel, this.actions.AVAILABLE_ALLOWED_MODULES),
				callback: "_subAllowedModules",
				options: {
					predicate: lang.hitch(this, this._chkPublicationIsForMe)
				}
			});
		},

		_defineMainSidebarPublications: function() {

			this.publicationsConfig.push({
				event: 'GET_ALLOWED_MODULES',
				channel: this._buildChannel(this.credentialsChannel, this.actions.GET_ALLOWED_MODULES)
			});
		},

		postCreate: function() {

			this.inherited(arguments);

			this._emitEvt('GET_ALLOWED_MODULES', {
				id: this.getOwnChannel()
			});
		},

		_subAllowedModules: function(/*Object*/ res) {
			//	summary:
			//		Se ejecuta este callback cuando recibe los módulos permitidos al usuario
			//		mandando a crear la estructura y añadiendo los items con los módulos recibidos
			//	tags:
			//		private
			//	response: Object
			//		Respuesta de la petición que contiene los módulos permitidos.

			this._addItems(res.data);
		},

		_addPrimaryIcon: function(/*Object*/ item) {

			arguments[0].href = "/" + item.name;
			this._addHrefToItem(item);

			return this.inherited(arguments);
		},

		_addSecondaryIcon: function(/*Object*/ item) {

			arguments[0].href = "/" + item.name;
			this._addHrefToItem(item);

			return this.inherited(arguments);
		},

		_addHrefToItem: function(item) {

			item.href = "/" + item.name;
		},

		_updateActive: function(res) {

			var path = res.path,
+126 −79
Original line number Diff line number Diff line
define([
	"dijit/layout/ContentPane"
	, "dijit/Menu"
	"dijit/Menu"
	, "dijit/MenuItem"
	, "dijit/registry"
	, "dojo/_base/declare"
@@ -11,11 +10,11 @@ define([
	, "put-selector/put"
	, "redmic/modules/base/_Module"
	, "redmic/modules/base/_Show"

	, "dojo/NodeList-dom"
	, "dojo/NodeList-traverse"
], function(
	ContentPane
	, Menu
	Menu
	, MenuItem
	, registry
	, declare
@@ -27,7 +26,8 @@ define([
	, _Module
	, _Show
) {
	return declare([_Module, _Show, ContentPane], {

	return declare([_Module, _Show], {
		//	summary:
		//		Módulo para la creación del Sidebar de la aplicación.
		//	description:
@@ -36,30 +36,26 @@ define([
		//		Si se hace click sobre algún módulo, la aplicación lo cargará.
		//		Si se accede con una ruta previa, se detectará para informar del módulo y categoría activos.

		//	primaryNav: Object
		//		Propiedades de la barra principal. Debe de tener "class" para asignarle estilos y
		//		"active" para especificar que categoría está activa (con un módulo en uso).

		constructor: function(args) {

			this.config = {
				primaryNav: {
					"class": "primary.main-nav",
					active: null
				ownChannel: "sidebar",
				events: {
					ITEM_CLICK: "itemClick",
					GET_ALLOWED_MODULES: "getAllowedModules"
				},
				// own actions
				actions: {
					ADD_ITEMS: "addItems",
					UPDATE_ACTIVE: "updateActive",
					ITEM_CLICKED: "itemClicked"
				},
				events: {
					ITEM_CLICK: "itemClick"
					ITEM_CLICKED: "itemClicked",
					GET_ALLOWED_MODULES: "getAllowedModules",
					AVAILABLE_ALLOWED_MODULES: "availableAllowedModules"
				},

				primaryClass: "primary.main-nav",
				primaryActiveItem: null,
				suffixI18n: '',
				items: null,
				// mediator params
				ownChannel: "sidebar"
				items: null
			};

			lang.mixin(this, this.config, args);
@@ -73,6 +69,12 @@ define([
			},{
				channel : this.getChannel("UPDATE_ACTIVE"),
				callback: "_subUpdateActive"
			},{
				channel : this._buildChannel(this.credentialsChannel, this.actions.AVAILABLE_ALLOWED_MODULES),
				callback: "_subAllowedModules",
				options: {
					predicate: lang.hitch(this, this._chkPublicationIsForMe)
				}
			});
		},

@@ -81,28 +83,43 @@ define([
			this.publicationsConfig.push({
				event: 'ITEM_CLICK',
				channel: this.getChannel('ITEM_CLICKED')
			},{
				event: 'GET_ALLOWED_MODULES',
				channel: this._buildChannel(this.credentialsChannel, this.actions.GET_ALLOWED_MODULES)
			});
		},

		_initialize: function() {
		startup: function() {

			this._createPrimaryNavMenu();
			this.inherited(arguments);

			this._createMenuSidebar();

			if (this._getLowWidth()) {
				this._collapseSidebar();
			}
		},

		postCreate: function() {
		_afterShow: function() {

			this.inherited(arguments);
			this._createPrimaryNavMenu();

			if (this.items) {
				this._addItems(this.items);
			}
		},

		startup: function() {
			this._emitEvt('GET_ALLOWED_MODULES', {
				id: this.getOwnChannel()
			});
		},

			this.inherited(arguments);
		_resize: function() {

			this._createMenuSidebar();
			if (this._getLowWidth()) {
				this._collapseSidebar();
			} else {
				this._uncollapseSidebar();
			}
		},

		_subAddItems: function(/*Object*/ res) {
@@ -122,9 +139,16 @@ define([
			this._updateActive(res);
		},

		_updateActive: function(res) {
		_subAllowedModules: function(/*Object*/ res) {
			//	summary:
			//		Se ejecuta este callback cuando recibe los módulos permitidos al usuario
			//		mandando a crear la estructura y añadiendo los items con los módulos recibidos
			//	tags:
			//		private
			//	response: Object
			//		Respuesta de la petición que contiene los módulos permitidos.

			this._updateItemsActive(res.label);
			this._addItems(res.data);
		},

		_createPrimaryNavMenu: function() {
@@ -133,21 +157,13 @@ define([
			//	tags:
			//		private

			var primaryNav = "nav";
			var primaryNav = "nav." + this.primaryClass;

			if (this.primaryNav["class"]) {
				primaryNav += "." + this.primaryNav["class"];
			}
			/*if (this.domNode.children.length) {
				put(this.domNode.firstChild, "!");
			}*/

			if (this.primaryNav.id) {
				primaryNav += "#" + this.primaryNav.id;
			}

			if (this.containerNode.children.length !== 0) {
				put(this.containerNode.firstChild, "!");
			}

			this.primaryNavNode = put(this.containerNode, primaryNav);
			this.primaryNavNode = put(this.domNode, primaryNav);
			this.primaryNavMenuNode = put(this.primaryNavNode, "ul");
		},

@@ -169,6 +185,51 @@ define([
			}));
		},

		_onClickSidebarMenu: function(/*Object*/ evt) {
			//	Summary:
			//		Evento click del menú secundario del sidebar, Se usa para expandir/reducir
			//		el sidebar añadiendo/suprimiendo el label
			//	tags:
			//		private
			//	evt
			//		Evento del click

			var sidebarMenuItem = this.sidebarMenu.getChildren()[0];

			if (sidebarMenuItem.label === this.i18n.menuTextReduce) {
				this._collapseSidebar();
			} else {
				this._uncollapseSidebar();
			}
		},

		_collapseSidebar: function() {

			var classAction = 'add',
				newLabel = this.i18n.menuTextExpand;

			this._updateSidebarCollapseStatus(classAction, newLabel);
		},

		_uncollapseSidebar: function() {

			var classAction = 'remove',
				newLabel = this.i18n.menuTextReduce;

			this._updateSidebarCollapseStatus(classAction, newLabel);
		},

		_updateSidebarCollapseStatus: function(classAction, newLabel) {

			var sidebarMenuItem = this.sidebarMenu.getChildren()[0],
				globalContainerId = query('#rootContainer')[0].children[0].id,
				globalContainer = registry.byId(globalContainerId);

			domClass[classAction](this.ownerDocumentBody, 'reducedMenu');
			globalContainer && globalContainer.resize();
			sidebarMenuItem.attr('label', newLabel);
		},

		_addItems: function(/*Array*/ items) {
			//	Summary:
			//		Función para rellenar de elementos las dos barras laterales.
@@ -201,20 +262,18 @@ define([
			//	returns:
			//		Devuelve el node del elemento creado

			var itemDom = null,
				label = item.name || item.label,
			var label = item.name || item.label,
				prelabel = "li." + label,
				iconPrefix = item.icon.split("-")[0],
				icon = iconPrefix + "." + item.icon,
				labelI18n = this.i18n[label + this.suffixI18n] || this.i18n[label];

				labelI18n = this.i18n[label + this.suffixI18n] || this.i18n[label],
				itemDom = put(prelabel + "[title=" + labelI18n + "]");

			if (item.active) {
				this.primaryNav.active = label;
				this.primaryActiveItem = label;
			}

			if (label === this.primaryNav.active) {
			if (label === this.primaryActiveItem) {
				put(itemDom, ".active");
			}

@@ -252,47 +311,35 @@ define([

		_isValidClick: function(obj) {

			if (this.primaryNav.active === obj.label) {
				return false;
			}

			return true;
			return this.primaryActiveItem !== obj.label;
		},

		_updateItemsActive: function(/*String*/ primary) {
		_updateItemsActive: function(/*String*/ currentLabel) {
			//	Summary:
			//		Actualiza los elementos de las barras
			//		Actualiza el estado de los elementos de la barra principal
			//	Description:
			//		Se pone a activo los elemntos que se hayan especificado por parámetros.
			//		El elemento de la primera barra (especificado en primary)
			//		Se marca como activo el elemento especificado en currentLabel
			//	Tags:
			//		private

			//Actualización de la barra de navegación primaria
			var currentIsNotActiveItem = this.primaryActiveItem !== currentLabel;

			// Si ya hay un elemento activo y no coincide con el padre del elemento pulsado
			if ((this.primaryNav.active) && (this.primaryNav.active !== primary)) {
				// buscamos el elemnto activo
				var itemactive = query("li.active", this.primaryNavMenuNode);
				if (itemactive.length > 0) {
					// le borramos la clase activo
					domClass.remove(itemactive[0], "active");
			if (this.primaryActiveItem && currentIsNotActiveItem) {
				var activeItems = query("li.active", this.primaryNavMenuNode);
				if (activeItems.length) {
					domClass.remove(activeItems[0], "active");
				}
			}

			// Si el primaryNav.active es nulo y no es igual al padre se actualiza su valor y se añade la clase
			if ((!this.primaryNav.active) || (this.primaryNav.active !== primary)) {
				this.primaryNav.active = primary;

				var itemaddclass = query("li." + primary, this.primaryNavMenuNode);
			if (!this.primaryActiveItem || currentIsNotActiveItem) {
				this.primaryActiveItem = currentLabel;

				if (itemaddclass.length > 0) {
					// Si se ha hecho click con anterioridad, hay que quitarle la clase click antes
					if (domClass.contains(itemaddclass[0], "click")) {
						domClass.remove(itemaddclass[0], "click");
					}
				var currentItems = query("li." + currentLabel, this.primaryNavMenuNode);

					domClass.add(itemaddclass[0], "active");
				if (currentItems.length) {
					var currentItem = currentItems[0];
					domClass.remove(currentItem, "click");
					domClass.add(currentItem, "active");
				}
			}
		},
+53 −114
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ define([
	, query
	, put
) {

	return declare(null, {
		//	summary:
		//		Módulo para la creación del Sidebar de la aplicación.
@@ -27,27 +28,20 @@ define([
		//		Si se hace click sobre alguna categoría, se desplegará la barra secundaria.
		//		Si se hace click sobre algún módulo, la aplicación lo cargará.
		//		Si se accede con una ruta previa, se detectará para informar del módulo y categoría activos.
		//	secondaryNav: Object
		//		Propiedades de la barra secundaria. Debe de tener "class" para asignarle estilos y
		//		"active" que especificar que módulo está activo.
		//	closeSecNavHandler: Object
		//		Handler del evento de cierre de la barra secundaria.

		constructor: function(args) {

			this.config = {
				secondaryNav: {
					'class': 'secondary.main-nav.retiring',
					active: null
				},
				closeSecNavHandler: null,
				subitems: 'subitems'
				secondaryClass: 'secondary.main-nav.retiring',
				secondaryActiveItem: null,
				clickToCloseSecondaryListener: null,
				subitems: 'modules'
			};

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

			aspect.after(this, "_initialize", lang.hitch(this, this._initializeSecondary));
			aspect.before(this, "_updateActive", lang.hitch(this, this._hidesecondaryNavNode));
			aspect.before(this, "_updateActive", lang.hitch(this, this._hideSecondaryNavNode));
			aspect.before(this, "_insertItemInPrimaryNav", lang.hitch(this, this._insertItemInSecondaryNav));
		},

@@ -60,10 +54,10 @@ define([

			this.inherited(arguments);

			this.closeSecNavHandler = on.pausable(document.body, 'click',
				lang.hitch(this, this._onCloseSecNav));
			this.clickToCloseSecondaryListener = on.pausable(document.body, 'click', lang.hitch(this,
				this._onCloseSecNav));

			this.closeSecNavHandler.pause();
			this.clickToCloseSecondaryListener.pause();
		},

		_onCloseSecNav: function(/*Object*/ evt) {
@@ -76,35 +70,21 @@ define([
			//	evt: Object
			//		Evento del click

			// Se busca si el elemento que se pulsó pertenece a la barra principal
			var isPrimaryNav = query(evt.target).parents().some(
				lang.hitch(this, function(node) {
			var parents = query(evt.target).parents();

				if (node === this.primaryNavNode) {
					return true;
				} else {
					return false;
				}
			var isPrimaryNav = parents.some(lang.hitch(this, function(node) {

				return node === this.primaryNavNode;
			}));
			// Se busca si el elemento que se pulsó pertenece a la barra secundaria
			var isSecondaryNav = query(evt.target).parents().some(function(node) {
				if (node === this.secondaryNavNode) {
					return true;
				} else {
					return false;
				}
			});
			// Si no se pulsó sobre ninguna de las dos barras, se oculta la barra secundaria
			if (!(isSecondaryNav || isPrimaryNav)) {
				this._hidesecondaryNavNode();
			}
		},

		_updateActive: function(res) {
			var isSecondaryNav = parents.some(function(node) {

			this._updateItemsActive(res.parentLabel || res.label);
				return node === this.secondaryNavNode;
			});

			res.parentLabel && this._updateItemsActiveSecondary(res.label);
			if (!isSecondaryNav && !isPrimaryNav) {
				this._hideSecondaryNavNode();
			}
		},

		_createSecondaryNavMenu: function() {
@@ -115,47 +95,17 @@ define([
			//	tags:
			//		private

			var secondaryNav = "nav";

			if (this.secondaryNav["class"]) {
				secondaryNav += "." + this.secondaryNav["class"];
			}

			if (this.secondaryNav.id) {
				secondaryNav += "#" + this.secondaryNav.id;
			}
			var secondaryNav = "nav." + this.secondaryClass;

			this.secondaryNavNode = put(document.body, secondaryNav);
			this.secondaryNavMenuNode = put(this.secondaryNavNode, "ul");
		},

		_onClickSidebarMenu: function(/*Object*/ evt) {
			//	Summary:
			//		Evento click del menú secundario del sidebar, Se usa para expandir/reducir
			//		el sidebar añadiendo/suprimiendo el label
			//	tags:
			//		private
			//	evt
			//		Evento del click

			if (this.sidebarMenu.getChildren()[0].label == this.i18n.menuTextReduce) {
				domClass.add(this.ownerDocumentBody, "reducedMenu");
				this.resize();
				registry.byId(query("#rootContainer")[0].children[0].id).resize();
				this.sidebarMenu.getChildren()[0].attr("label", this.i18n.menuTextExpand);
			} else {
				domClass.remove(this.ownerDocumentBody, "reducedMenu");
				registry.byId(query("#rootContainer")[0].children[0].id).resize();
				this.sidebarMenu.getChildren()[0].attr("label", this.i18n.menuTextReduce);
			}
		},

		_insertItemInSecondaryNav: function(item) {

			var subitems = item[this.subitems];
			if (subitems) {
				var division = put(this.secondaryNavMenuNode,
					"div." + item.name + "[style='display:none']");
				var division = put(this.secondaryNavMenuNode, "div." + item.name + "[style='display:none']");

				for (var j = 0; j < subitems.length; j++) {
					var subitem = subitems[j];
@@ -181,16 +131,14 @@ define([
				return this.inherited(arguments);
			}

			var itemDom = null,
				label = item.name || item.label,
			var label = item.name || item.label,
				prelabel = "li." + label,
				iconPrefix = item.icon.split("-")[0],
				icon = iconPrefix + "." + item.icon,
				labelI18n = this.i18n[label + this.suffixI18n] || this.i18n[label];

				labelI18n = this.i18n[label + this.suffixI18n] || this.i18n[label],
				itemDom = put(prelabel + "[title=" + labelI18n + "]");

			if (label === this.primaryNav.active) {
			if (label === this.primaryActiveItem) {
				put(itemDom, ".active");
			}

@@ -230,16 +178,17 @@ define([

			// Si se pulsa en el item que ya está con clase activa se oculta el secundario
			if (domClass.contains(itemDom, "click")) {
				this._hidesecondaryNavNode();
				this._hideSecondaryNavNode();
				domClass.remove(itemDom, "click");
			} else {
				// si lo hay se elimina
				query("li.click", this.primaryNavMenuNode).forEach(function(node) {

					domClass.remove(node, "click");
				});

				domClass.add(itemDom, "click");
				this._showsecondaryNavNode(label);
				this._showSecondaryNavNode(label);
			}
		},

@@ -248,7 +197,7 @@ define([
			//		Agrega un módulo a la barra secundaria.
			//	Tags:
			//		private
			//	module:
			//	item:
			//		Objeto que representa al módulo actual
			//	returns:
			//		Devuelve el DomNode del elemento creado
@@ -256,17 +205,17 @@ define([
			var itemDom = null,
				label = item.name || item.label,
				preLabel = "li." + label,
				parentLabel = item.parent ? item.parent.name : module.name,
				parentLabel = item.parent ? item.parent.name : item.name,
				iconPrefix = item.icon.split("-")[0],
				icon = iconPrefix + "." + item.icon,
				labelI18n = this.i18n[label + this.suffixI18n] || this.i18n[label],
				href = item.href;

			if (item.active) {
				this.secondaryNav.active = label;
				this.secondaryActiveItem = label;
			}

			if (label === this.secondaryNav.active) {
			if (label === this.secondaryActiveItem) {
				itemDom = put(preLabel + ".active");
			} else {
				itemDom = put(preLabel);
@@ -291,17 +240,13 @@ define([
		_isValidClick: function(obj) {

			if (obj.parentLabel) {
				if (this.secondaryNav.active === obj.label) {
					return false;
				}

				return true;
				return this.secondaryActiveItem !== obj.label;
			}

			return this.inherited;
		},

		_showsecondaryNavNode: function(/*String*/ mainlabel) {
		_showSecondaryNavNode: function(/*String*/ mainlabel) {
			// summary:
			//		Muestra la barra secundaria y se muestra el bloque cuya clase corresponda
			//		por la que se pase por parámetros
@@ -322,61 +267,55 @@ define([
			domClass.remove(this.secondaryNavNode, "retiring");
			domClass.add(this.secondaryNavNode, "overall");

			this.closeSecNavHandler && this.closeSecNavHandler.resume();
			this.clickToCloseSecondaryListener && this.clickToCloseSecondaryListener.resume();
		},

		_hidesecondaryNavNode: function() {
		_hideSecondaryNavNode: function() {
			// summary:
			//		Oculta la barra secundaria
			// description:
			//		Se elimina la clase click si existe en algún elemento de la barra principal. Se ejecuta la animación y se borra el Listener del body
			//		Se elimina la clase click si existe en algún elemento de la barra principal.
			//		Se ejecuta la animación y se borra el Listener del body
			// tags:
			//		private

			query("li.click", this.primaryNavMenuNode).forEach(function(node) {
				// Borramos los activos

				domClass.remove(node, "click");
			});

			domClass.remove(this.secondaryNavNode, "overall");
			domClass.add(this.secondaryNavNode, "retiring");

			this.closeSecNavHandler && this.closeSecNavHandler.pause();
			this.clickToCloseSecondaryListener && this.clickToCloseSecondaryListener.pause();
		},

		_updateItemsActiveSecondary: function(/*String*/ secondary) {
		_updateItemsActiveSecondary: function(/*String*/ currentLabel) {
			//	Summary:
			//		Actualiza los elementos de las barras
			//		Actualiza el estado de los elementos de la barra secundaria
			//	Description:
			//		Se pone a activo los elemntos que se hayan especificado por parámetros.
			//		El elemento de la secundaria (especificado en secondary)
			//		Se marca como activo el elemento especificado en currentLabel
			//	Tags:
			//		private

			// Actualizamos la barra de navegación secundaria

			// Si hay algun elemento activo lo actualizamos quitandole la clase activo

			if(this.secondaryNav.active) {
				var itemactive = query("li.active", this.secondaryNavMenuNode);
			if (this.secondaryActiveItem) {
				var activeItems = query("li.active", this.secondaryNavMenuNode);

				if (itemactive.length > 0) {
					domClass.remove(itemactive[0], "active");
				if (activeItems.length) {
					domClass.remove(activeItems[0], "active");
				}
			}

			if (!secondary) {
			if (!currentLabel) {
				return;
			}

			// Actualizamos el campo activo de secondaryNav
			this.secondaryNav.active = secondary;
			this.secondaryActiveItem = currentLabel;

			var itemaddclass = query("li." + secondary, this.secondaryNavMenuNode);
			var currentItems = query("li." + currentLabel, this.secondaryNavMenuNode);

			if (itemaddclass.length > 0) {
				// Añadimos la clase active al nodo que se ha pulsado
				domClass.add(itemaddclass[0], "active");
			if (currentItems.length) {
				domClass.add(currentItems[0], "active");
			}
		}
	});
Compare e3613f0b to 8be6c1cc
Original line number Diff line number Diff line
Subproject commit e3613f0b477fd7b34b8f503adc1e68eb0a0d0745
Subproject commit 8be6c1ccef79c80c4af7e08abb741bbb2006a091