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

Estiliza opciones y evita autoselección de sección

Permite el paso de un valor específico para que SelectImpl lo use como
etiqueta del valor vacío.

Añade valor vacío con etiqueta personalizada al selector de secciones de
la vista detalle.

Impide que se autoseleccione la primera opción del selector de secciones
al revisitar la vista detalle de actividad.
parent 4d08186b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ define([
				labelKeyPropertyName: "labelKey",
				propertyName: "name",
				includeEmptyValue: true,
				emptyValueLabel: ' ',
				resetValue: false,
				pathSeparator: '.',
				_items: {}
@@ -195,7 +196,7 @@ define([
			if (this.includeEmptyValue) {
				options.push({
					value: null,
					label: ' ',
					label: this.emptyValueLabel,
					selected: true
				});
			}
+23 −11
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ define([

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

			aspect.after(this, '_generateWidgets', lang.hitch(this, this._afterGenerateWidgetsAddSelector));
			aspect.after(this, '_addWidget', lang.hitch(this, this._afterAddWidgetUpdateSelector));
			aspect.after(this, '_addDataInTitle', lang.hitch(this, this._afterAddDataInTitleShowSelector));
			aspect.after(this, '_onLayoutComplete', lang.hitch(this, this._afterLayoutCompleteApplyAnchor));
@@ -33,11 +32,6 @@ define([
				lang.hitch(this, this._afterControllerOrAncestorShownUpdateSelectorInstance));
		},

		_afterGenerateWidgetsAddSelector: function() {

			this._addWidgetsToSelector();
		},

		_afterAddWidgetUpdateSelector: function(retValue, params) {

			this._addWidgetToSelector(params[0]);
@@ -79,12 +73,12 @@ define([

			this._widgetSelector = new SelectImpl({
				parentChannel: this.getChannel(),
				includeEmptyValue: false,
				_inputProps: {
					options: this._widgetKeys
				}
				includeEmptyValue: true,
				emptyValueLabel: '< <i>' + this.i18n.noSectionFocused + '</i> >'
			});

			this._setWidgetKeysAsSelectorOptions();

			this._setSubscription({
				channel: this._widgetSelector.getChannel('VALUE_CHANGED'),
				callback: lang.hitch(this, this._onWidgetSelectorValueChanged)
@@ -116,11 +110,29 @@ define([

			this._widgetKeys.push(key);

			this._setWidgetKeysAsSelectorOptions();
		},

		_setWidgetKeysAsSelectorOptions: function() {

			var selectorOptions = this._widgetKeys.map(lang.hitch(this, this._getWidgetOptionObject));

			this._publish(this._widgetSelector.getChannel('SET_OPTIONS'), {
				options: this._widgetKeys
				options: selectorOptions
			});
		},

		_getWidgetOptionObject: function(widgetKey) {

			var widgetInstance = this._getWidgetInstance(widgetKey),
				widgetLabel = (widgetInstance && widgetInstance.get('title')) || this.i18n[widgetKey];

			return {
				value: widgetKey,
				label: widgetLabel || widgetKey
			};
		},

		_onWidgetSelectorValueChanged: function(res) {

			var value = res.value || '';
+2 −0
Original line number Diff line number Diff line
@@ -1335,6 +1335,8 @@ define({
	, "leafletForwardButton": "Avanzar en el historial de localizaciones"
	, "leafletBackButton": "Retroceder en el historial de localizaciones"

	, "noSectionFocused": "Sin sección enfocada"

	// Meta-tags
	, "metaDefaultTitle": "Repositorio de Datos Marinos Integrados de Canarias"
	, "metaDefaultDescription": "REDMIC es una infraestructura de datos marinos de caracter público, que ofrece información sobre el medio biofísico marino de Canarias"
+2 −0
Original line number Diff line number Diff line
@@ -1339,6 +1339,8 @@ define({
		, "leafletForwardButton": "Go forward in location history"
		, "leafletBackButton": "Go back in location history"

		, "noSectionFocused": "No section focused"

		// Meta-tags
		, "metaDefaultTitle": "Repositorio de Datos Marinos Integrados de Canarias"
		, "metaDefaultDescription": "REDMIC is a public marine data infrastructure that offers information on the marine biophysical environment of the Canary Islands"
+4 −0
Original line number Diff line number Diff line
@@ -14,6 +14,10 @@ define([
	, RedmicLocalStorage
) {

	// TODO falta aquí solamente por quitar 'dojo/request', el resto se han centralizado en RestManagerImpl. Se podrá
	// quitar cuando esto se convierta en una View y se gestione igual que otras vistas de 'src/user/', en lugar de
	// gestionar por ruta separada y capturar el valor del token desde plantilla pug

	return declare(null, {

		constructor: function(args) {
+2 −2

File changed.

Contains only whitespace changes.

Loading