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

Reubica extensiones base de vistas de la app

parent 55c5cd54
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4,18 +4,18 @@ define([
	, 'dojo/Deferred'
	, 'dojo/promise/all'
	, 'dojo/store/Memory'
	, 'src/app/component/view/_View'
	, 'src/component/base/_Module'
	, 'src/redmicConfig'
	, 'app/base/views/_View'
], function(
	declare
	, lang
	, Deferred
	, all
	, Memory
	, _View
	, _Module
	, redmicConfig
	, _View
) {

	return declare(_Module, {
+73 −0
Original line number Diff line number Diff line
define([
	"dojo/_base/declare"
	, "dojo/_base/lang"
	, "dojo/aspect"
	, "app/base/views/_ListenRequestError"
	,'./_SettingsHandler'
	'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'dojo/aspect'
], function(
	declare
	, lang
	, aspect
	, _ListenRequestError
	, _SettingsHandler
) {

	return declare([_ListenRequestError, _SettingsHandler], {
	return declare(null, {
		//	summary:
		//		Extensión común para todas los módulos usados como vistas. Se adjunta automáticamente cuando la
		//		navegación a través de la app requiere un módulo como contenido principal a mostrar.
		//		Gestiona la publicación de meta tags de la vista actual, preparando lo necesario para trabajar con
		//		ellas.

		constructor: function(args) {

			this.config = {
				viewActions: {
					PUT_META_TAGS: "putMetaTags"
				metaTagsHandlerActions: {
					PUT_META_TAGS: 'putMetaTags'
				},
				viewEvents: {
					PUT_META_TAGS: "putMetaTags"
				metaTagsHandlerEvents: {
					PUT_META_TAGS: 'putMetaTags'
				}
			};

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

			aspect.before(this, "_mixEventsAndActions", this._mixEventsAndActionsView);

			this._doEvtFacadeView &&
				aspect.before(this, "_doEvtFacade", this._doEvtFacadeView);
			this._setOwnCallbacksForEventsView &&
				aspect.before(this, "_setOwnCallbacksForEvents", this._setOwnCallbacksForEventsView);

			this._initializeView && aspect.before(this, "_initialize", this._initializeView);
			aspect.after(this, "_definePublications", this._defineViewPublications);
			aspect.before(this, "_beforeShow", this._beforeShowView);
			aspect.before(this, "_afterShow", this._afterShowView);
			aspect.before(this, '_mixEventsAndActions', this._mixMetaTagsHandlerEventsAndActionsView);
			aspect.after(this, '_definePublications', this._defineMetaTagsHandlerPublications);
			aspect.before(this, '_afterShow', this._afterShowMetaTagsHandler);
		},

		_mixEventsAndActionsView: function() {
		_mixMetaTagsHandlerEventsAndActionsView: function() {

			lang.mixin(this.events, this.viewEvents);
			lang.mixin(this.actions, this.viewActions);
			delete this.viewEvents;
			delete this.viewActions;
			lang.mixin(this.events, this.metaTagsHandlerEvents);
			lang.mixin(this.actions, this.metaTagsHandlerActions);
			delete this.metaTagsHandlerEvents;
			delete this.metaTagsHandlerActions;
		},

		_defineViewPublications: function() {
		_defineMetaTagsHandlerPublications: function() {

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

		_beforeShowView: function(request) {

		},

		_afterShowView: function(request) {
		_afterShowMetaTagsHandler: function() {

			var callback = this._putMetaTags || this._putDefaultMetaTags;

			lang.hitch(this, callback)();
		},

@@ -73,7 +58,7 @@ define([
			//	summary:
			//		Manda a publicar la información necesaria para que se generen las meta-tags
			//		de la vista actual. Debe ejecutarse después del show de la vista, ya que este
			//		indica mediante el flag "metaTags" si debe o no generarse.
			//		indica mediante el flag 'metaTags' si debe o no generarse.
			//		*** Función por defecto (posibilidad de sobreescribir para enviar más datos) ***
			//	tags:
			//		private
@@ -83,11 +68,6 @@ define([
					view: this.ownChannel
				});
			}
		},

		_goTo404: function() {

			globalThis.location.href = "/404";
		}
	});
});
+9 −5
Original line number Diff line number Diff line
define([
	"dojo/_base/declare"
	'dojo/_base/declare'
],
function(
	declare
) {

	return declare(null, {
		//	summary:
		//		Gestiona los errores de los request
		//	description:
		//		Permite gestionar los errores de las peticiones a la API
		//		Gestiona los errores de los request hacia la API

		_errorAvailable: function(error, status) {

@@ -17,6 +16,11 @@ function(
			} /*else if (status === 500) {
				this._goTo500();
			}*/
		},

		_goTo404: function() {

			globalThis.location.href = '/404';
		}
	});
});
+20 −0
Original line number Diff line number Diff line
define([
	'dojo/_base/declare'
	, 'src/app/component/view/_MetaTagsHandler'
	, 'src/app/component/view/_RequestErrorHandler'
	, 'src/app/component/view/_SettingsHandler'
], function(
	declare
	, _MetaTagsHandler
	, _RequestErrorHandler
	, _SettingsHandler
) {

	return declare([_MetaTagsHandler, _RequestErrorHandler, _SettingsHandler], {
		//	summary:
		//		Extensión común para todas los componentes usados como vistas, es decir, aquellos que con instanciados
		//		tras reconocer un valor concreto en la ruta actual. Cuando la navegación a través de la app requiere que
		//		se instancie un nuevo componente, esta extensión se adjunta automáticamente a la lista de dependencias
		//		del mismo.
	});
});
Loading