Commit 19bbfdd3 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Limpia y mejora las vistas con tabs restantes

parent 0d09bd1b
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -77,12 +77,17 @@ define([
			this.inherited(arguments);

			if (this.iconKeypadComposite) {
				this._showIconKeypadComposite(this.iconKeypadComposite);
			}
		},

		_showIconKeypadComposite: function(instance) {

			this.keypadZoneNode = put(this._getIconKeypadNode(), 'div.keypadZone');

				this._publish(this.iconKeypadComposite.getChannel('SHOW'), {
			this._publish(instance.getChannel('SHOW'), {
				node: this.keypadZoneNode
			});
			}
		},

		_subKeypadInputComposite: function(res) {
+0 −81
Original line number Diff line number Diff line
define([
	"app/designs/list/_AddFilter"
	, "app/designs/list/Controller"
	, "app/designs/list/layout/NoTitle"
	, "app/designs/base/_Controller"
	, "dojo/_base/declare"
	, "dojo/_base/lang"
	, "redmic/modules/base/_Module"
	, "redmic/modules/base/_Show"
], function (
	_AddFilter
	, Controller
	, Layout
	, _Controller
	, declare
	, lang
	, _Module
	, _Show
){
	return declare([_Module, _Controller, _Show], {
		//	summary:
		//		Controlador para vistas.

		constructor: function(args) {

			this.config = {
				region: "center"
			};

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

		_setControllerConfigurations: function() {

			this.browserConfig = this._merge([{
				parentChannel: this.getChannel(),
				target: this.target,
				idProperty: this.idProperty,
				noDataMessage: null
			}, this.browserConfig || {}]);

			this.browserTarget = this.browserConfig.browserConfig.target;
		},

		_initializeController: function() {

			this.browser = new declare([Layout, Controller, _AddFilter])(this.browserConfig);
		},

		_defineControllerSubscriptions: function() {

			this.subscriptionsConfig.push({
				channel : this.browser.getChildChannel("browser", "BUTTON_EVENT"),
				callback: "_subListBtnEvent"
			});
		},

		postCreate: function() {

			this.inherited(arguments);

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

			this._publish(this.browser.getChildChannel("browser", "CLEAR"));
		},

		_subListBtnEvent: function(evt) {

			var callback = "_" + evt.btnId + "Callback";
			this[callback] && this[callback](evt);
		},

		_updateCompletedStatus: function() {

			this._isCompleted = !!this._totalSelected;
			this._emitEvt('REFRESH_STATUS');
		}
	});
});
+0 −36
Original line number Diff line number Diff line
define([
	'app/designs/base/_Layout'
	, 'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'put-selector/put'
], function(
	_Layout
	, declare
	, lang
	, put
) {

	return declare(_Layout, {
		//	summary:
		//		Layout para vistas que contienen .

		constructor: function(args) {

			this.config = {
				layoutAdditionalClasses: 'layoutContentAndListDesign twoColumnsLayout'
			};

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

		postCreate: function() {

			this.inherited(arguments);

			var centerNode = put(this.domNode, 'div.leftZone');

			this.topNode = put(centerNode, 'div.notFormZone');
			this.centerNode = put(centerNode, 'div.stretchZone');
		}
	});
});
+41 −68
Original line number Diff line number Diff line
@@ -8,16 +8,17 @@ define([
	, "dojo/_base/declare"
	, "dojo/_base/lang"
	, "dojo/aspect"
	, "redmic/modules/atlas/Atlas"
	, "redmic/modules/base/_Filter"
	, "redmic/modules/base/_ShowInPopup"
	, "redmic/modules/base/_Store"
	, "redmic/modules/gateway/MapCenteringGatewayImpl"
	, "redmic/modules/browser/bars/Total"
	, "redmic/modules/browser/_ButtonsInRow"
	, "redmic/modules/browser/_Framework"
	, "redmic/modules/browser/_GeoJsonParser"
	, "redmic/modules/browser/ListImpl"
	, "redmic/modules/atlas/Atlas"
	, "redmic/modules/base/_ShowInPopup"
	, "redmic/modules/gateway/MapCenteringGatewayImpl"
	, 'redmic/modules/layout/genericDisplayer/GenericWithTopbarDisplayerImpl'
	, 'redmic/modules/layout/TabsDisplayer'
	, "redmic/modules/mapQuery/QueryOnMap"
	, "redmic/modules/search/TextImpl"
@@ -32,16 +33,17 @@ define([
	, declare
	, lang
	, aspect
	, Atlas
	, _Filter
	, _ShowInPopup
	, _Store
	, MapCenteringGatewayImpl
	, Total
	, _ButtonsInRow
	, _Framework
	, _GeoJsonParser
	, ListImpl
	, Atlas
	, _ShowInPopup
	, MapCenteringGatewayImpl
	, GenericWithTopbarDisplayerImpl
	, TabsDisplayer
	, QueryOnMap
	, TextImpl
@@ -104,25 +106,44 @@ define([

		_initializeMain: function() {

			this._createBrowser();

			if (!this.notTextSearch) {
				this.searchConfig.queryChannel = this.queryChannel;
				this.textSearch = new TextImpl(this.searchConfig);
				this._createTextSearch();
			}

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

			exts.unshift(ListImpl, _Framework, _ButtonsInRow, _GeoJsonParser);
			this.mapCenteringGateway = new MapCenteringGatewayImpl({
				parentChannel: this.getChannel()
			});
		},

		_createBrowser: function() {

			this.browserConfig.queryChannel = this.queryChannel;
			this.browser = new declare(exts)(this.browserConfig);

			this._mapCenteringGateway();
			var exts = this.browserExts;
			exts.unshift(ListImpl, _Framework, _ButtonsInRow, _GeoJsonParser);
			var BrowserDefinition = declare(exts);
			this.browser = new BrowserDefinition(this.browserConfig);

			this._browserWithTopbar = new GenericWithTopbarDisplayerImpl({
				parentChannel: this.getChannel(),
				content: this.browser,
				title: this.i18n.geographicData
			});
		},

		_mapCenteringGateway: function() {
		_createTextSearch: function() {

			this.mapCenteringGateway = new MapCenteringGatewayImpl({
				parentChannel: this.getChannel()
			this.searchConfig.queryChannel = this.queryChannel;
			this.textSearch = new TextImpl(this.searchConfig);

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

@@ -162,61 +183,13 @@ define([

			this.inherited(arguments);

			this._createBrowserNode();

			if (!this.notTextSearch) {
				this._createTextSearchNode();
			}

			this._createTabContainers();
			this._createAtlas();
		},

		_createTextSearchNode: function() {

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

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

			this.buttonsNode = this.textSearchNode;

			this.browserAndSearchContainer.addChild(this.textSearchNode);
		},

		_createBrowserNode: function() {

			this.browserAndSearchContainer = new LayoutContainer({
				title: "<i class='fa fa-table' title='" + this.i18n.data + "'></i>",
				'class': "marginedContainer noScrolledContainer"
			});

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

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

			this.browserAndSearchContainer.addChild(this.gridNode);
		},

		_createTabContainers: function() {

			this._tabsDisplayer = new TabsDisplayer({
				parentChannel: this.getChannel()
			this._publish(this._tabsDisplayer.getChannel('ADD_TAB'), {
				title: this.i18n.geographicData,
				iconClass: 'fa fa-table',
				channel: this._browserWithTopbar.getChannel()
			});

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

			this.tabs.addChild(this.browserAndSearchContainer);
			this._createAtlas();

			this._publish(this._tabsDisplayer.getChannel('SHOW'), {
				node: this.contentNode
+115 −130
Original line number Diff line number Diff line
@@ -12,12 +12,9 @@ define([
	, "dojo/_base/lang"
	, "dojo/aspect"
	, "RWidgets/Utilities"
	, "redmic/modules/atlas/Atlas"
	, "redmic/modules/base/_Filter"
	, "redmic/modules/form/FormContainerImpl"
	, "redmic/modules/form/_ListenModelHasChanged"
	, "redmic/modules/form/_PublicateChanges"
	, "redmic/modules/form/_CreateKeypad"
	, "redmic/modules/gateway/MapCenteringGatewayImpl"
	, "redmic/modules/base/_ShowInPopup"
	, "redmic/modules/browser/_ButtonsInRow"
	, "redmic/modules/browser/_Framework"
	, "redmic/modules/browser/_Select"
@@ -25,10 +22,14 @@ define([
	, "redmic/modules/browser/ListImpl"
	, "redmic/modules/browser/bars/Order"
	, "redmic/modules/browser/bars/Total"
	, "redmic/modules/form/FormContainerImpl"
	, "redmic/modules/form/_ListenModelHasChanged"
	, "redmic/modules/form/_PublicateChanges"
	, "redmic/modules/form/_CreateKeypad"
	, "redmic/modules/gateway/MapCenteringGatewayImpl"
	, "redmic/modules/layout/dataDisplayer/DataDisplayer"
	, 'redmic/modules/layout/TabsDisplayer'
	, "redmic/modules/atlas/Atlas"
	, "redmic/modules/base/_ShowInPopup"
	, 'redmic/modules/layout/genericDisplayer/GenericWithTopbarDisplayerImpl'
	, "redmic/modules/map/layer/GeoJsonLayerImpl"
	, "redmic/modules/map/layer/_Editable"
	, "redmic/modules/map/layer/_RadiusOnSelect"
@@ -36,7 +37,6 @@ define([
	, "redmic/modules/map/layer/_SelectOnClick"
	, "redmic/modules/mapQuery/QueryOnMap"
	, "redmic/modules/search/TextImpl"
	, "redmic/view/effects/Animation"
	, "templates/CitationPopup"
	, "templates/TaxonList"
], function(
@@ -53,12 +53,9 @@ define([
	, lang
	, aspect
	, Utilities
	, Atlas
	, _Filter
	, FormContainerImpl
	, _ListenModelHasChanged
	, _PublicateChanges
	, _CreateKeypad
	, MapCenteringGatewayImpl
	, _ShowInPopup
	, _ButtonsInRow
	, _Framework
	, _Select
@@ -66,10 +63,14 @@ define([
	, ListImpl
	, Order
	, Total
	, FormContainerImpl
	, _ListenModelHasChanged
	, _PublicateChanges
	, _CreateKeypad
	, MapCenteringGatewayImpl
	, DataDisplayer
	, TabsDisplayer
	, Atlas
	, _ShowInPopup
	, GenericWithTopbarDisplayerImpl
	, GeoJsonLayerImpl
	, _Editable
	, _RadiusOnSelect
@@ -77,10 +78,10 @@ define([
	, _SelectOnClick
	, QueryOnMap
	, TextImpl
	, Animation
	, TemplatePopup
	, TemplateList
) {

	return declare([Layout, Controller, _Main, _Filter, _CompositeInTooltipFromIconKeypad, _EditionView, _LocalSelectionView], {
		//	summary:
		//		Vista base para todas las vistas de edición geográfica.
@@ -157,25 +158,13 @@ define([

		_initializeMain: function() {

			this.searchConfig.queryChannel = this.queryChannel;
			this.textSearch = new declare([TextImpl])(this.searchConfig);

			var FormDefinition = declare([FormContainerImpl, _ListenModelHasChanged, _CreateKeypad])
				.extend(_PublicateChanges);
			this._createBrowser();
			this._createEditor();
			this._createMapLayer();

			this.editor = new FormDefinition(this.formConfig);

			this.browserConfig.queryChannel = this.queryChannel;
			this.browser = new declare([ListImpl, _Framework, _ButtonsInRow, _Select,
				_GeoJsonParser])(this.browserConfig);

			this.geoJsonLayerConfig.associatedIds = [this.browser.getOwnChannel()];
			this.geoJsonLayerConfig.mapChannel = this.map.getChannel();

			var geoJsonLayerDefinition = declare([GeoJsonLayerImpl, _Editable, _Selectable, _SelectOnClick,
				_RadiusOnSelect]);

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

			this.dataDisplayer = new DataDisplayer({
				parentChannel: this.getChannel()
@@ -195,6 +184,49 @@ define([
			});
		},

		_createBrowser: function() {

			this.searchConfig.queryChannel = this.queryChannel;
			this.textSearch = new TextImpl(this.searchConfig);

			this.browserConfig.queryChannel = this.queryChannel;
			var BrowserDefinition = declare([ListImpl, _Framework, _ButtonsInRow, _Select, _GeoJsonParser]);
			this.browser = new BrowserDefinition(this.browserConfig);

			this._browserWithTopbar = new GenericWithTopbarDisplayerImpl({
				parentChannel: this.getChannel(),
				content: this.browser,
				title: this.i18n.geographicData
			});
		},

		_createEditor: function() {

			var FormDefinition = declare([FormContainerImpl, _ListenModelHasChanged, _CreateKeypad])
				.extend(_PublicateChanges);

			this.editor = new FormDefinition(this.formConfig);

			this._editorWithTopbar = new GenericWithTopbarDisplayerImpl({
				parentChannel: this.getChannel(),
				content: this.editor,
				title: this.i18n.form
			});

			this._once(this.editor.getChannel('SHOWN'), lang.hitch(this, this._onceEditorShown));
		},

		_createMapLayer: function() {

			this.geoJsonLayerConfig.associatedIds = [this.browser.getOwnChannel()];
			this.geoJsonLayerConfig.mapChannel = this.map.getChannel();

			var geoJsonLayerDefinition = declare([GeoJsonLayerImpl, _Editable, _Selectable, _SelectOnClick,
				_RadiusOnSelect]);

			this.geoJsonLayer = new geoJsonLayerDefinition(this.geoJsonLayerConfig);
		},

		_setMainOwnCallbacksForEvents: function () {

			this._onEvt('HIDE', lang.hitch(this, this._onHide));
@@ -254,101 +286,43 @@ define([

		postCreate: function() {

			this._createBrowserAndEditorContainers();

			this._createTextSearchNode();
			this.buttonsNode = this._getIconKeypadNode();

			this.inherited(arguments);

			this._createBrowserNode();

			this._createEditorNode();

			this._emitEvt('ADD_LAYER', {layer: this.geoJsonLayer});

			this._createTabContainers();
			this._createAtlas();

			this._emitEvt('REFRESH');
		},

		_createBrowserAndEditorContainers: function() {

			this.browserAndEditorNode = new declare([StackContainer, Animation])({
				'class': "marginedContainer noScrolledContainer",
				title: this.i18n.list,
				region:"center"
			this._publish(this._tabsDisplayer.getChannel('ADD_TAB'), {
				title: this.i18n.geographicData,
				iconClass: 'fa fa-table',
				channel: this._browserWithTopbar.getChannel()
			});

			this.browserAndSearchContainer = new LayoutContainer({
				'class': "noScrolledContainer"
			this._publish(this._tabsDisplayer.getChannel('ADD_TAB'), {
				title: this.i18n.form,
				iconClass: 'fa fa-keyboard-o',
				channel: this._editorWithTopbar.getChannel()
			});

			this.browserAndEditorNode.addChild(this.browserAndSearchContainer);
		},

		_createTabContainers: function() {

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

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

			this.tabs.addChild(this.browserAndEditorNode);
			this._createAtlas();

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

		_createTextSearchNode: function() {

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

			this._publish(this.textSearch.getChannel("SHOW"), {
				node: this.textSearchNode.domNode
			this._emitEvt('ADD_LAYER', {
				layer: this.geoJsonLayer
			});

			this.buttonsNode = this.textSearchNode;

			this.browserAndSearchContainer.addChild(this.textSearchNode);
		},

		_createBrowserNode: function() {

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

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

			this.browserAndSearchContainer.addChild(this.gridNode);
		},

		_createEditorNode: function() {

			this.editorNode = new ContentPane({
				'class': "scrollWrapper"
			});

			this._once(this.editor.getChannel('SHOWN'), lang.hitch(this, function() {
			var self = this;

			this._publish(this.editor.getChannel("SET_METHOD"), {
				"onGetMapLocation": function(obj) {

					self[self._isValidGeometry(obj.point) ? "_onMovePoint" : "_onAddPoint"](obj);
				}
			});
			}));

			this.browserAndEditorNode.addChild(this.editorNode);
		},

		_beforeShowMain: function() {
@@ -362,6 +336,10 @@ define([
				zoom: 7
			});

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

			this._emitEvt('REFRESH');
		},

@@ -415,6 +393,8 @@ define([
				node: this.topbarNode,
				data: title
			});

			this._publish(this._tabsDisplayer.getChannel('RESIZE'));
		},

		_isValidCoordinate: function(value) {
@@ -512,11 +492,7 @@ define([

			var activityId = this.pathVariableId;

			if (!(activityId && activityId.length)) {
				return false;
			}

			return true;
			return !!(activityId && activityId.length);
		},

		_subFormHidden: function() {
@@ -534,19 +510,12 @@ define([

		_changeTabForList: function() {

			this._changeTab(this.browserAndSearchContainer, this.i18n.list);
			this._showBrowserTab();
		},

		_changeTabForForm: function() {

			this._changeTab(this.editorNode, this.i18n.form);
		},

		_changeTab: function(container, title) {

			this.browserAndEditorNode.set('title', title);

			this.browserAndEditorNode.selectChild(container);
			this._showEditorTab();
		},

		_subFormChanged: function(change) {
@@ -563,7 +532,7 @@ define([

		_coordinatesChanged: function(value) {

			channel = this.geoJsonLayer.getChannel("MOVE");
			var channel = this.geoJsonLayer.getChannel("MOVE");

			this._publish(channel, {
				lng: value[0]
@@ -583,12 +552,21 @@ define([

		_onHide: function() {

			this.browserAndEditorNode.selectChild(this.browserAndSearchContainer);
			this._showBrowserTab();
		},

		_getNodeForForm: function () {
		_showBrowserTab: function() {

			this._publish(this._tabsDisplayer.getChannel('SHOW_TAB'), {
				channel: this._browserWithTopbar.getChannel()
			});
		},

			return this.editorNode.domNode;
		_showEditorTab: function() {

			this._publish(this._tabsDisplayer.getChannel('SHOW_TAB'), {
				channel: this._editorWithTopbar.getChannel()
			});
		},

		_subListBtnEvent: function(evt) {
@@ -644,9 +622,16 @@ define([
			return results;
		},

		_getNodeForForm: function() {

			// TODO acceso a lo bruto, remodelar extensiones de vistas para hacer las cositas bien
			return this._editorWithTopbar._contentNode;
		},

		_getIconKeypadNode: function() {

			return this.textSearchNode.domNode;
			// TODO acceso a lo bruto, remodelar extensiones de vistas para hacer las cositas bien
			return this._browserWithTopbar._topbarNode;
		}
	});
});
Loading