Commit 1d773524 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Comienza a dinamizar vistas detalle de activity

Decide que layout mostrar para la actividad en base a la configuración
externa recibida. Si no la hay, mantiene el comportamiento anterior de
vincular una visualización con un valor concreto de categoría de la
actividad.

Agrupa configuraciones de widgets de vistas de detalle en un mismo
lugar, para evitar su dispersión entre distintos niveles. En progreso.

Inaugura nuevo directorio de código fuente, como primeros pasos para
reestructurar los recursos del proyecto #87.

Mueve lógica de vista detalle de actividad a una nueva ubicación,
separándola de otros recursos relativos a su estructura y
representación, que aporta el concepto de diseño.

Fix #88.
parent 3b65aba9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -38,13 +38,13 @@ define([
		_setMainConfigurations: function() {

			this.widgetConfigs = this._merge([{
				contactList: this._contactsConfig()
				contactList: this._getContactsConfig()
			}, this.widgetConfigs || {}]);

			this.inherited(arguments);
		},

		_contactsConfig: function() {
		_getContactsConfig: function() {

			return {
				width: 3,
+6 −6
Original line number Diff line number Diff line
@@ -32,15 +32,15 @@ define([
		_setMainConfigurations: function() {

			this.widgetConfigs = this._merge([{
				info: this._infoConfig({
				info: this._getInfoConfig({
					template: TemplateInfo
				}),
				additionalInfo: this._setAdditionalConfig(this.i18n.projects, TemplateProjects,
				childActivitiesOrProjects: this._getChildActivitiesOrProjectsConfig(this.i18n.projects, TemplateProjects,
					this.viewPathsWidgets.projects),
				organisationList: this._organisationsConfig(),
				platformList: this._platformsConfig(),
				contactList: this._contactsConfig(),
				documentList: this._documentsConfig()
				organisationList: this._getOrganisationsConfig(),
				platformList: this._getPlatformsConfig(),
				contactList: this._getContactsConfig(),
				documentList: this._getDocumentsConfig()
			}, this.widgetConfigs || {}]);
		}
	});
+6 −6
Original line number Diff line number Diff line
@@ -32,16 +32,16 @@ define([
		_setMainConfigurations: function() {

			this.widgetConfigs = this._merge([{
				info: this._infoConfig({
				info: this._getInfoConfig({
					template: TemplateInfo
				}),
				additionalInfo: this._setAdditionalConfig(this.i18n.activities, TemplateActivities,
				childActivitiesOrProjects: this._getChildActivitiesOrProjectsConfig(this.i18n.activities, TemplateActivities,
					this.viewPathsWidgets.activities
				),
				organisationList: this._organisationsConfig(),
				platformList: this._platformsConfig(),
				contactList: this._contactsConfig(),
				documentList: this._documentsConfig()
				organisationList: this._getOrganisationsConfig(),
				platformList: this._getPlatformsConfig(),
				contactList: this._getContactsConfig(),
				documentList: this._getDocumentsConfig()
			}, this.widgetConfigs || {}]);
		}
	});
+16 −45
Original line number Diff line number Diff line
@@ -4,9 +4,7 @@ define([
	, "dojo/_base/lang"
	, "redmic/modules/browser/_ButtonsInRow"
	, "redmic/modules/browser/_Framework"
	, "redmic/modules/browser/ListImpl"
	, "redmic/modules/browser/bars/Total"
	, "templates/DocumentList"
	, 'src/view/detail/_WidgetDefinition'
	, "templates/LoadingCustom"
	, "templates/SpeciesInfo"
	, "templates/SpeciesTitle"
@@ -18,9 +16,7 @@ define([
	, lang
	, _ButtonsInRow
	, _Framework
	, ListImpl
	, Total
	, TemplateDocuments
	, _WidgetDefinition
	, TemplateCustom
	, TemplateInfo
	, TemplateTitle
@@ -28,7 +24,7 @@ define([
	, SpeciesLocation
) {

	return declare([_DetailsBase], {
	return declare([_DetailsBase, _WidgetDefinition], {
		//	summary:
		//		Vista detalle de especies.

@@ -62,6 +58,18 @@ define([
				target: this.titleWidgetTarget
			}, this.titleWidgetConfig || {}]);

			var documentListConfig = this._merge([
				this._getDocumentsConfig(),
				{
					props: {
						noDataMessage: TemplateCustom({
							message: this.i18n.noAssociatedDocuments,
							iconClass: "fr fr-no-data"
						})
					}
				}
			]);

			this.widgetConfigs = this._merge([
				this.widgetConfigs || {},
				{
@@ -74,7 +82,7 @@ define([
					activityList: {
						height: 3
					},
					documentList: this._documentsConfig(),
					documentList: documentListConfig,
					map: {
						width: 6,
						height: 4,
@@ -88,43 +96,6 @@ define([
			]);
		},

		_documentsConfig: function() {

			return {
				width: 3,
				height: 2,
				type: declare([ListImpl, _Framework, _ButtonsInRow]),
				props: {
					title: this.i18n.documents,
					target: this.documentTarget,
					template: TemplateDocuments,
					bars: [{
						instance: Total
					}],
					rowConfig: {
						buttonsConfig: {
							listButton: [{
								icon: "fa-file-pdf-o",
								btnId: "downloadPdf",
								title: this.i18n.download,
								condition: "url",
								href: redmicConfig.viewPaths.bibliographyDetails
							},{
								icon: "fa-info-circle",
								btnId: "details",
								title: this.i18n.info,
								href: this.viewPathsWidgets.documents
							}]
						}
					},
					noDataMessage: TemplateCustom({
						message: this.i18n.noAssociatedDocuments,
						iconClass: "fr fr-no-data"
					})
				}
			};
		},

		_clearModules: function() {

			this.inherited(arguments);
+2 −177
Original line number Diff line number Diff line
@@ -3,39 +3,16 @@ define([
	, "app/designs/details/Controller"
	, "app/designs/details/Layout"
	, "app/designs/details/_AddTitle"
	, "app/redmicConfig"
	, "dojo/_base/declare"
	, "dojo/_base/lang"
	, "redmic/modules/base/_Filter"
	, "redmic/modules/browser/_ButtonsInRow"
	, "redmic/modules/browser/_Framework"
	, "redmic/modules/browser/ListImpl"
	, "redmic/modules/browser/bars/Pagination"
	, "redmic/modules/browser/bars/Total"
	, "redmic/modules/layout/templateDisplayer/TemplateDisplayer"
	, "templates/ContactSet"
	, "templates/DocumentList"
	, "templates/OrganisationSet"
	, "templates/PlatformSet"

], function(
	_Main
	, Controller
	, Layout
	, _AddTitle
	, redmicConfig
	, declare
	, lang
	, _Filter
	, _ButtonsInRow
	, _Framework
	, ListImpl
	, Pagination
	, Total
	, TemplateDisplayer
	, TemplateContacts
	, TemplateDocuments
	, TemplateOrganisation
	, TemplatePlatform
){
	return declare([Layout, Controller, _Main, _AddTitle], {
		//	summary:
@@ -59,158 +36,6 @@ define([
			lang.mixin(this, this.config, args);
		},

		_organisationsConfig: function() {

			return {
				width: 3,
				height: 2,
				type: declare([ListImpl, _Framework, _ButtonsInRow]),
				props: {
					title: this.i18n.organisations,
					target: this.organisationTarget,
					template: TemplateOrganisation,
					bars: [{
						instance: Total
					}],
					rowConfig: {
						buttonsConfig: {
							listButton: [{
								icon: "fa-info-circle",
								btnId: "details",
								title: this.i18n.info,
								href: this.viewPathsWidgets.organisations,
								pathToItem: "organisation"
							}]
						}
					}
				}
			};
		},

		_platformsConfig: function() {

			return {
				width: 3,
				height: 2,
				type: declare([ListImpl, _Framework, _ButtonsInRow]),
				props: {
					title: this.i18n.platforms,
					target: this.platformTarget,
					template: TemplatePlatform,
					bars: [{
						instance: Total
					}],
					rowConfig: {
						buttonsConfig: {
							listButton: [{
								icon: "fa-info-circle",
								btnId: "details",
								title: this.i18n.info,
								href: this.viewPathsWidgets.platforms,
								pathToItem: "platform"
							}]
						}
					}
				}
			};
		},

		_contactsConfig: function() {

			return {
				width: 3,
				height: 2,
				type: declare([ListImpl, _Framework]),
				props: {
					title: this.i18n.contacts,
					target: this.contactTarget,
					template: TemplateContacts,
					bars: [{
						instance: Total
					}]
				}
			};
		},

		_documentsConfig: function() {

			return {
				width: 3,
				height: 2,
				type: declare([ListImpl, _Framework, _ButtonsInRow]),
				props: {
					title: this.i18n.documents,
					target: this.documentTarget,
					template: TemplateDocuments,
					bars: [{
						instance: Total
					}],
					rowConfig: {
						buttonsConfig: {
							listButton: [{
								icon: "fa-file-pdf-o",
								btnId: "downloadPdf",
								title: this.i18n.download,
								condition: "url",
								href: redmicConfig.viewPaths.bibliographyDetails
							},{
								icon: "fa-info-circle",
								btnId: "details",
								title: this.i18n.info,
								href: this.viewPathsWidgets.documents
							}]
						}
					}
				}
			};
		},

		_setAdditionalConfig: function(title, template, href) {

			return {
				width: 3,
				height: 2,
				type: declare([ListImpl, _Framework, _ButtonsInRow, _Filter]),
				props: {
					title: title,
					bars: [{
						instance: Total
					},{
						instance: Pagination
					}],
					template: template,
					rowConfig: {
						buttonsConfig: {
							listButton: [{
								icon: "fa-info-circle",
								btnId: "details",
								title: this.i18n.info,
								href: href
							}]
						}
					}
				}
			};
		},

		_infoConfig: function(obj) {

			return {
				width: obj.width || 3,
				height: obj.height || 6,
				type: TemplateDisplayer,
				props: {
					title: this.i18n.info,
					template: obj.template,
					"class": "containerDetails",
					classEmptyTemplate: "contentListNoData",
					target: this.infoTarget || this.target,
					associatedIds: [this.ownChannel],
					shownOption: this.shownOptionInfo
				}
			};
		},

		_clearModules: function() {

			this._publish(this._getWidgetInstance('info').getChannel('CLEAR'));
@@ -238,7 +63,7 @@ define([
			var target = lang.replace(this._targetListRank, {
					id: this.pathVariableId
				}),
				widgetInstance = this._getWidgetInstance('additionalInfo');
				widgetInstance = this._getWidgetInstance('childActivitiesOrProjects');

			this._publish(widgetInstance.getChannel("UPDATE_TARGET"), {
				target: target
Loading