Commit 0d09bd1b authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Crea módulo genérico y mejora vistas con tabs

Implementa nuevo módulo GenericDisplayer, con implementación
GenericWithTopbarDisplayerImpl para mostrar cualquier otro módulo o nodo
simple (convertido a módulo por tanto) junto con una barra superior, que
da cabida a un título y a otros elementos a la carta. Simplifica de esta
manera el manejo de estos elementos, unificando estas tareas rutinarias.

Aplica el nuevo módulo a las vistas de SpeciesDistribution y Tracking,
las más complejas de las mejoradas con TabsDisplayer. Ahora muestran un
título de tab mínimo (con icono) y un título concreto dentro del propio
tab.

Amplía módulo TabsDisplayer para permitir mostrar un tab de manera
programática, en base al canal del módulo en cuestión.

Corrige dimensiones de algunos formularios.

Corrige algunas traducciones hechas a lo bruto.

Actualiza submódulo de estilos.
parent 74b12537
Loading
Loading
Loading
Loading
+23 −20
Original line number Diff line number Diff line
@@ -11,11 +11,12 @@ define([
	, 'moment/moment.min'
	, "put-selector/put"
	, "RWidgets/Utilities"
	, "redmic/form/FormContainer"
	, "redmic/modules/base/_Store"
	, "redmic/modules/components/ProgressSlider/ProgressSlider"
	, "redmic/modules/atlas/Atlas"
	, "redmic/modules/base/_ShowInPopup"
	, 'redmic/modules/form/FormContainerImpl'
	, 'redmic/modules/layout/genericDisplayer/GenericWithTopbarDisplayerImpl'
	, 'redmic/modules/layout/TabsDisplayer'
	, "redmic/modules/map/layer/_AddFilter"
	, "redmic/modules/map/layer/_PublishInfo"
@@ -34,11 +35,12 @@ define([
	, moment
	, put
	, Utilities
	, FormContainer
	, _Store
	, ProgressSlider
	, Atlas
	, _ShowInPopup
	, FormContainerImpl
	, GenericWithTopbarDisplayerImpl
	, TabsDisplayer
	, _AddFilter
	, _PublishInfo
@@ -99,7 +101,8 @@ define([
				_trackingTransitionRate: 900,
				_layerIdPrefix: "tracking",
				layerIdSeparator: "_",
				_deltaProgress: 3600000
				_deltaProgress: 3600000,
				formTemplate: 'viewers/views/templates/forms/Tracking'
			};

			lang.mixin(this, this.config, args);
@@ -114,13 +117,10 @@ define([

			this.formConfig = this._merge([{
				parentChannel: this.getChannel(),
				//title: this.i18n.settings,
				iconClass: 'fa fa-cogs',
				region: "top",
				i18n: this.i18n,
				template: "viewers/views/templates/forms/Tracking",
				width: 8,
				template: this.formTemplate,
				formContainerConfig: {
					loadInputs: lang.hitch(this, this._loadInputsFormAndShow)
				}
			}, this.formConfig || {}]);

			this.mapConfig = this._merge([{
@@ -206,10 +206,7 @@ define([

		_fillSideContent: function() {

			// TODO acceso a lo bruto, hasta que se simplifique la estructura de contenedores
			this.tabContainer = this._tabsDisplayer._container;

			this.tabContainer.addChild(this._createSettings());
			this._createSettingsForm();

			this._createAtlas();

@@ -240,15 +237,21 @@ define([
			});
		},

		_createSettings: function() {

			// TODO cambiar por modulo form
		_createSettingsForm: function() {

			this.formWidget = new FormContainer(this.formConfig);
			this._settingsForm = new FormContainerImpl(this.formConfig);

			this.formWidget.startup();
			this._settingsFormWithTopbar = new GenericWithTopbarDisplayerImpl({
				parentChannel: this.getChannel(),
				content: this._settingsForm,
				title: this.i18n.settings
			});

			return this.formWidget;
			this._publish(this._tabsDisplayer.getChannel('ADD_TAB'), {
				title: this.i18n.settings,
				iconClass: 'fa fa-cog',
				channel: this._settingsFormWithTopbar.getChannel()
			});
		},

		_loadInputsFormAndShow: function(inputs) {
+15 −13
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ define([
	, "redmic/modules/browser/_Framework"
	, "redmic/modules/browser/_MultiTemplate"
	, "redmic/modules/browser/_Select"
	, 'redmic/modules/layout/genericDisplayer/GenericWithTopbarDisplayerImpl'
	, "templates/ActivityList"
	, "templates/AnimalList"
	, "templates/TrackingPlatformList"
@@ -25,10 +26,12 @@ define([
	, _Framework
	, _MultiTemplate
	, _Select
	, GenericWithTopbarDisplayerImpl
	, templateActivityList
	, templateAnimalList
	, templatePlatformList
) {

	return declare(_SelectionBase, {
		//	summary:
		//		Vista de Tracking.
@@ -116,9 +119,15 @@ define([

		_initializeTrackingWithList: function() {

			var exts = this.browserWorkBase.concat(this.browserWorkExts);
			var BrowserDefinition = declare(this.browserWorkBase.concat(this.browserWorkExts));

			this.browserWork = new BrowserDefinition(this.browserWorkConfig);

			this.browserWork = new declare(exts)(this.browserWorkConfig);
			this._trackingDataBrowserWithTopbar = new GenericWithTopbarDisplayerImpl({
				parentChannel: this.getChannel(),
				content: this.browserWork,
				title: this.i18n.Elements
			});
		},

		_defineTrackingWithListSubscriptions: function () {
@@ -149,20 +158,13 @@ define([
			return res.target === this.targetBrowserWork;
		},

		_fillSideContent: function() {

			this.inherited(arguments);

			this._createBrowserWork();
		},

		_createBrowserWork: function() {

			var addTabChannel = this._tabsDisplayer.getChannel('ADD_TAB');
			this._publish(addTabChannel, {
				title: this.i18n.data,
				iconClass: 'fa fa-table',
				channel: this.browserWork.getChannel()
				title: this.i18n.Elements,
				iconClass: 'fr fr-track',
				channel: this._trackingDataBrowserWithTopbar.getChannel()
			});
		},

+0 −7
Original line number Diff line number Diff line
@@ -26,13 +26,6 @@ define([
			lang.mixin(this, this.config, args);
		},

		_fillSideContent: function() {

			this._createBrowserWork();

			this.inherited(arguments);
		},

		_dataAvailable: function(items) {

			var data = items.data.data;
+6 −6
Original line number Diff line number Diff line
@@ -119,12 +119,12 @@ define({
		, "citationsAssociated": "Associated citations"
		, "unitsAssociated": "Associated units"
		, "unitsSelected": "Selected units"
		, "speciesCatalogView": "Catalog species"
		, "activitiesCatalogView": "Catalog activities"
		, "projectCatalogView": "Catalog projects"
		, "programCatalogView": "Catalog programs"
		, "platformCatalogView": "Catalog platforms"
		, "organisationCatalogView": "Catalog organisations"
		, "speciesCatalogView": "Species catalog"
		, "activitiesCatalogView": "Activities catalog"
		, "projectCatalogView": "Project catalog"
		, "programCatalogView": "Program catalog"
		, "platformCatalogView": "Platform catalog"
		, "organisationCatalogView": "Organisation catalog"
		, "printToPdf": "Print content to PDF"
		, "remove": "Remove"
		, "module": "Module"
+93 −82
Original line number Diff line number Diff line
@@ -3,17 +3,16 @@ define([
	, "app/designs/mapWithSideContent/Controller"
	, "app/designs/mapWithSideContent/layout/MapAndContent"
	, "app/redmicConfig"
	, "dijit/layout/LayoutContainer"
	, "dijit/layout/ContentPane"
	, "dojo/_base/declare"
	, "dojo/_base/lang"
	, "dojo/aspect"
	, "dojo/Deferred"
	, "put-selector/put"
	, "redmic/base/Credentials"
	, "redmic/form/FormContainer"
	, "redmic/modules/atlas/Atlas"
	, "redmic/modules/base/_Filter"
	, "redmic/modules/base/_Selection"
	, "redmic/modules/base/_ShowInPopup"
	, "redmic/modules/base/_Store"
	, "redmic/modules/browser/ListImpl"
	, "redmic/modules/browser/_ButtonsInRow"
@@ -22,9 +21,9 @@ define([
	, "redmic/modules/browser/bars/SelectionBox"
	, "redmic/modules/browser/bars/Pagination"
	, "redmic/modules/browser/bars/Total"
	, "redmic/modules/atlas/Atlas"
	, "redmic/modules/base/_ShowInPopup"
	, 'redmic/modules/form/FormContainerImpl'
	, 'redmic/modules/layout/TabsDisplayer'
	, 'redmic/modules/layout/genericDisplayer/GenericWithTopbarDisplayerImpl'
	, "redmic/modules/map/layer/_AddFilter"
	, "redmic/modules/map/layer/_ListenBounds"
	, "redmic/modules/map/layer/_ListenZoom"
@@ -46,17 +45,16 @@ define([
	, Controller
	, Layout
	, redmicConfig
	, LayoutContainer
	, ContentPane
	, declare
	, lang
	, aspect
	, Deferred
	, put
	, Credentials
	, FormContainer
	, Atlas
	, _Filter
	, _Selection
	, _ShowInPopup
	, _Store
	, ListImpl
	, _ButtonsInRow
@@ -65,9 +63,9 @@ define([
	, SelectionBox
	, Pagination
	, Total
	, Atlas
	, _ShowInPopup
	, FormContainerImpl
	, TabsDisplayer
	, GenericWithTopbarDisplayerImpl
	, _AddFilter
	, _ListenBounds
	, _ListenZoom
@@ -85,6 +83,7 @@ define([
	, TemplatePopup
	, TemplateList
) {

	return declare([Layout, Controller, _Selection, _Store, _Filter], {
		//	summary:
		//		Vista de SpeciesDistribution.
@@ -309,8 +308,27 @@ define([

		_initialize: function() {

			var getMapChannel = lang.hitch(this.map, this.map.getChannel),
				mapChannel = getMapChannel();
			this._createSpeciesCatalog();
			this._createSpeciesTree();
			this._createSettingsForm();
			this._createMapLayers();

			this._tabsDisplayer = new TabsDisplayer({
				parentChannel: this.getChannel()
			});

			var getMapChannel = lang.hitch(this.map, this.map.getChannel);

			this.atlasConfig.addTabChannel = this._tabsDisplayer.getChannel('ADD_TAB');
			this.atlasConfig.getMapChannel = getMapChannel;

			this.queryOnMapConfig.getMapChannel = getMapChannel;

			var QueryOnMapPopup = declare(QueryOnMap).extend(_ShowInPopup);
			this._queryOnMap = new QueryOnMapPopup(this.queryOnMapConfig);
		},

		_createSpeciesCatalog: function() {

			this.searchConfig.queryChannel = this.queryChannel;
			this.textSearch = new TextImpl(this.searchConfig);
@@ -319,8 +337,50 @@ define([
			var BrowserDefinition = declare([ListImpl, _Framework, _ButtonsInRow, _Select]);
			this.browser = new BrowserDefinition(this.browserConfig);

			var tree = declare([CbtreeImpl, _LazyLoad, _LeafSelection/*, _SelectionBoxTree*/]);
			this.tree = new tree(this.treeConfig);
			this._speciesBrowserWithTopbar = new GenericWithTopbarDisplayerImpl({
				parentChannel: this.getChannel(),
				content: this.browser,
				title: this.i18n.speciesCatalogView
			});

			this._publish(this._speciesBrowserWithTopbar.getChannel('ADD_TOPBAR_CONTENT'), {
				content: this.textSearch
			});
		},

		_createSpeciesTree: function() {

			var TreeDefinition = declare([CbtreeImpl, _LazyLoad, _LeafSelection/*, _SelectionBoxTree*/]);
			this.tree = new TreeDefinition(this.treeConfig);

			this._speciesTreeWithTopbar = new GenericWithTopbarDisplayerImpl({
				parentChannel: this.getChannel(),
				content: this.tree,
				title: this.i18n.taxonTree
			});
		},

		_createSettingsForm: function() {

			this._settingsForm = new FormContainerImpl({
				parentChannel: this.getChannel(),
				template: this.formTemplate,
				formContainerConfig: {
					loadInputs: lang.hitch(this, this._inputsFilterSidebarContent)
				}
			});

			this._settingsFormWithTopbar = new GenericWithTopbarDisplayerImpl({
				parentChannel: this.getChannel(),
				content: this._settingsForm,
				title: this.i18n.settings
			});
		},

		_createMapLayers: function() {

			var getMapChannel = lang.hitch(this.map, this.map.getChannel),
				mapChannel = getMapChannel();

			this.d3LayerConfig.mapChannel = mapChannel;

@@ -357,17 +417,6 @@ define([
				mapChannel: mapChannel,
				layerDefinition: 'grid100m'
			});

			this._tabsDisplayer = new TabsDisplayer({
				parentChannel: this.getChannel()
			});

			this.atlasConfig.addTabChannel = this._tabsDisplayer.getChannel('ADD_TAB');
			this.atlasConfig.getMapChannel = getMapChannel;
			this.queryOnMapConfig.getMapChannel = getMapChannel;

			var QueryOnMapPopup = declare(QueryOnMap).extend(_ShowInPopup);
			this._queryOnMap = new QueryOnMapPopup(this.queryOnMapConfig);
		},

		_defineSubscriptions: function () {
@@ -399,33 +448,6 @@ define([

			this.inherited(arguments);

			var browserAndSearchContainer = new LayoutContainer({
				//title: this.i18n.list,
				iconClass: 'fr fr-crab',
				'class': "marginedContainer noScrolledContainer"
			});

			this.gridNode = new ContentPane({
				region: "center",
				'class': 'stretchZone'
			});

			this._publish(this.browser.getChannel("SHOW"), {
				node: this.gridNode.domNode
			});

			this.textSearchNode = new ContentPane({
				'class': "topZone",
				region: "top"
			});

			this._publish(this.textSearch.getChannel("SHOW"), {
				node: this.textSearchNode.domNode
			});

			browserAndSearchContainer.addChild(this.textSearchNode);
			browserAndSearchContainer.addChild(this.gridNode);

			this._publish(this.gridLayer.getChannel('SET_PROPS'), {
				minZoom: this.grid5000MinZoom,
				currentGridLayer: this.currentGridLayer
@@ -436,27 +458,37 @@ define([

			this._clearAndDisconnectLayer(this.pruneClusterLayer);

			// TODO acceso a lo bruto, hasta que se simplifique la estructura de contenedores
			this.tabs = this._tabsDisplayer._container;
			this._addTabsToSideContent();
			this._emitEvt('REFRESH');
		},

			this.tabs.addChild(browserAndSearchContainer);
		_addTabsToSideContent: function() {

			var addTabChannel = this._tabsDisplayer.getChannel('ADD_TAB');

			this._publish(addTabChannel, {
				title: this.i18n.tree,
				title: this.i18n.speciesCatalogView,
				iconClass: 'fr fr-crab',
				channel: this._speciesBrowserWithTopbar.getChannel()
			});

			this._publish(addTabChannel, {
				title: this.i18n.taxonTree,
				iconClass: 'fa fa-sitemap',
				channel: this.tree.getChannel()
				channel: this._speciesTreeWithTopbar.getChannel()
			});

			this.tabs.addChild(this._createFilterSidebarContent());
			this._publish(addTabChannel, {
				title: this.i18n.settings,
				iconClass: 'fa fa-cog',
				channel: this._settingsFormWithTopbar.getChannel()
			});

			this._createAtlas();

			this._publish(this._tabsDisplayer.getChannel('SHOW'), {
				node: this.contentNode
			});

			this._emitEvt('REFRESH');
		},

		_onChangeSelection: function(response) {
@@ -777,27 +809,6 @@ define([
			}
		},

		_createFilterSidebarContent: function() {

			// TODO cambiar por modulo form

			this.formWidget = new FormContainer({
				//title: this.i18n.mode,
				iconClass: 'fa fa-cogs',
				region: "center",
				template: this.formTemplate,
				parentChannel: this.getChannel(),
				width: 8,
				i18n: this.i18n,
				loadInputs: lang.hitch(this, this._inputsFilterSidebarContent),
				isDisableInputs: true
			});

			this.formWidget.startup();

			return this.formWidget;
		},

		_createAtlas: function() {

			this.atlas = new Atlas(this.atlasConfig);
Loading