Commit 6f226263 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Unifica y limpia catálogo y detalle de especies

parent 8e06fbdd
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -467,6 +467,7 @@ var viewLayers = {
	, 'src/catalog/platform/PlatformCatalogView': {}
	, 'src/catalog/program/ProgramCatalogView': {}
	, 'src/catalog/project/ProjectCatalogView': {}
	, 'src/catalog/species/SpeciesCatalogView': {}

	// vistas detalle
	, 'src/detail/activity/ActivityDetailView': {}
@@ -474,6 +475,7 @@ var viewLayers = {
	, 'src/detail/platform/PlatformDetailView': {}
	, 'src/detail/program/ProgramDetailView': {}
	, 'src/detail/project/ProjectDetailView': {}
	, 'src/detail/species/SpeciesDetailView': {}

	// mantenimiento
	, 'src/maintenance/domain/DomainMaintenanceView': {}
@@ -482,7 +484,6 @@ var viewLayers = {

	, 'app/home/views/HomeView': {}

	, 'app/catalog/views/SpeciesCatalogView': {}
	, 'app/catalog/views/StacBrowserView': {}

	, 'app/administrative/views/ContactView': {}
@@ -491,7 +492,6 @@ var viewLayers = {
	, 'app/administrative/views/AnimalView': {}

	, 'app/administrative/taxonomy/views/MisIdentificationView': {}
	, 'app/administrative/taxonomy/views/SpeciesView': {}
	, 'app/administrative/taxonomy/views/GenusView': {}
	, 'app/administrative/taxonomy/views/FamilyView': {}
	, 'app/administrative/taxonomy/views/OrderView': {}
@@ -527,14 +527,12 @@ var viewLayers = {
	, 'app/viewers/views/RealTimeView': {}
	, 'app/viewers/views/RealTimeDashboardView': {}

	, 'app/details/views/SpeciesDetailsView': {}
	, 'app/details/views/ServiceOGCCatalogDetailsView': {}
	, 'app/details/views/DocumentDetailsView': {}
	, 'app/details/views/BibliographyDetailsView': {}
	, 'app/details/views/ContactDetailsView': {}
	, 'app/details/views/ServiceOGCDetailsView': {}
	, 'app/details/views/StatisticsDetailsView': {}
	, 'app/details/views/SpeciesCatalogDetailsView': {}

	, 'app/edition/views/ActivityEditionView': {}
	, 'app/edition/views/DeviceEditionView': {}
+51 −40
Original line number Diff line number Diff line
define([
	"app/designs/base/_Main"
	, "app/designs/textSearchFacetsList/Controller"
	, "app/designs/textSearchFacetsList/Layout"
	'app/designs/base/_Main'
	, 'app/designs/textSearchFacetsList/Controller'
	, 'app/designs/textSearchFacetsList/Layout'
	, 'src/redmicConfig'
	, "dojo/_base/declare"
	, "dojo/_base/lang"
	, "templates/SpeciesList"
	, "src/component/browser/_Select"
	, "src/component/browser/bars/SelectionBox"
	, "src/component/browser/bars/Order"
	, "src/component/browser/bars/Total"
	, "src/component/tree/_HierarchicalFilter"
	, "src/component/tree/_LazyLoad"
	, "src/component/tree/CbtreeImpl"
	, 'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'templates/SpeciesList'
	, 'src/catalog/_GenerateReport'
	, 'src/component/browser/_Select'
	, 'src/component/browser/bars/SelectionBox'
	, 'src/component/browser/bars/Order'
	, 'src/component/browser/bars/Total'
	, 'src/component/tree/_HierarchicalFilter'
	, 'src/component/tree/_LazyLoad'
	, 'src/component/tree/CbtreeImpl'
], function(
	_Main
	, Controller
@@ -21,6 +22,7 @@ define([
	, declare
	, lang
	, templateList
	, _GenerateReport
	, _Select
	, SelectionBox
	, Order
@@ -29,24 +31,29 @@ define([
	, _LazyLoad
	, CbtreeImpl
) {
	return declare([Layout, Controller, _Main], {

	return declare([Layout, Controller, _Main, _GenerateReport], {
		//	summary:
		//
		//	description:
		//
		//		Vista de catálogo de especies.

		constructor: function(args) {

			this.config = {
				title: this.i18n.speciesCatalogView,
				ownChannel: 'speciesCatalog',
				target: redmicConfig.services.species,

				filtersInTabs: true,
				layoutAdditionalClasses: 'layoutTextSearchFacetsListDesign speciesMainTextSearchFacetsListDesign',
				browserExts: [_Select],
				title: this.i18n.species,
				layoutAdditionalClasses: 'layoutTextSearchFacetsListDesign speciesMainTextSearchFacetsListDesign'

				reportService: 'species'
			};

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

		_setMainConfigurations: function() {
		_setConfigurations: function() {

			this.filterConfig = this._merge([{
				returnFields: redmicConfig.returnFields.species
@@ -55,11 +62,11 @@ define([
			this.browserConfig = this._merge([{
				orderConfig: {
					options: [
						{value: "scientificName"},
						{value: "authorship"},
						{value: "status.name", label: this.i18n.status},
						{value: "commonName"},
						{value: "updated"}
						{value: 'scientificName'},
						{value: 'authorship'},
						{value: 'status.name', label: this.i18n.status},
						{value: 'commonName'},
						{value: 'updated'}
					]
				},
				template: templateList,
@@ -73,7 +80,12 @@ define([
				}],
				rowConfig: {
					buttonsConfig: {
						listButton: []
						listButton: [{
							icon: 'fa-info-circle',
							btnId: 'details',
							title: 'info',
							href: this.viewPaths.speciesDetails
						}]
					}
				}
			}, this.browserConfig || {}]);
@@ -84,23 +96,23 @@ define([
			}, this.facetsConfig || {}]);
		},

		_initializeMain: function() {
		_initialize: function() {

			var tree = declare([CbtreeImpl, _LazyLoad, _HierarchicalFilter]);
			this.tree = new tree({
			var TreeDefinition = declare([CbtreeImpl, _LazyLoad, _HierarchicalFilter]);
			this.tree = new TreeDefinition({
				parentChannel: this.getChannel(),
				selectorChannel: this.getChannel(),
				queryExternalChannel: this.queryChannel,
				target: redmicConfig.services.taxons,
				idProperty: "path",
				itemLabel: "{rank.name} - {scientificName} ({leaves})",
				idProperty: 'path',
				itemLabel: '{rank.name} - {scientificName} ({leaves})',
				createQuery: function(item) {

					var query = {
						returnFields: redmicConfig.returnFields.taxonsTree,
						regexp: [{
							field: "path",
							exp: "root.[0-9]+"
							field: 'path',
							exp: 'root.[0-9]+'
						}]
					};

@@ -108,7 +120,7 @@ define([
						return query;
					}

					query.regexp[0].exp = item.path + ".[0-9]+";
					query.regexp[0].exp = item.path + '.[0-9]+';

					return query;
				},
@@ -117,7 +129,6 @@ define([
					return item.rank.name === 'Genus';
				}
			});

		},

		_setMainOwnCallbacksForEvents: function() {
@@ -129,12 +140,12 @@ define([

			this.inherited(arguments);

			this._publish(this.tree.getChannel("SHOW"), {
			this._publish(this.tree.getChannel('SHOW'), {
				node: this.filter2.domNode
			});

			this.filter1.set("title", this.i18n.attributes);
			this.filter2.set("title", this.i18n.taxonTree);
			this.filter1.set('title', this.i18n.attributes);
			this.filter2.set('title', this.i18n.taxonTree);
		},

		_onSpeciesMainShown: function() {
+58 −0
Original line number Diff line number Diff line
define([
	'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'dojo/aspect'
	, 'app/administrative/taxonomy/views/_AddCompositeTaxon'
	, 'app/base/views/extensions/_EditionWizardView'
], function(
	declare
	, lang
	, aspect
	, _AddCompositeTaxon
	, _EditionWizardView
) {

	return declare([_AddCompositeTaxon, _EditionWizardView], {
		//	summary:
		//		Extensión de vista de catálogo de especies para añadir funcionalidad relativa a la edición de
		//		registros.

		constructor: function(args) {

			this.config = {
				addPath: this.viewPaths.speciesAdd
			};

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

			aspect.before(this, '_setBrowserButtons', lang.hitch(this, this._setSpeciesEditionBrowserButtons));
		},

		_setSpeciesEditionBrowserButtons: function() {

			if (!this.listButtonsEdition) {
				console.warn('Tried to add species edition buttons, but edition buttons config was not found!');
				return;
			}

			var findIndexCallback = lang.hitch(this, function(button) {

				return button.groupId && button.groupId === this._editionGroupId;
			});

			var editionButtonIndex = this.listButtonsEdition.findIndex(findIndexCallback);

			if (editionButtonIndex !== -1) {
				this.listButtonsEdition[editionButtonIndex].icons.push({
					icon: 'fa-edit',
					btnId: 'edit',
					title: 'edit',
					option: 'default',
					href: this.viewPaths.speciesEdit
				});
			} else {
				console.warn('Tried to add species edition buttons, but edition button group config was not found!');
			}
		}
	});
});
+25 −16
Original line number Diff line number Diff line
define([
	'src/redmicConfig'
	, "dojo/_base/declare"
	, "dojo/_base/lang"
	, "src/component/browser/_ButtonsInRow"
	, "src/component/browser/_Framework"
	, 'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'src/component/browser/_ButtonsInRow'
	, 'src/component/browser/_Framework'
	, 'src/detail/_GenerateReport'
	, "templates/LoadingCustom"
	, "templates/SpeciesInfo"
	, "templates/SpeciesTitle"
	, "./_DetailsBase"
	, "./SpeciesLocation"
	, 'templates/LoadingCustom'
	, 'templates/SpeciesInfo'
	, 'templates/SpeciesTitle'
	, 'app/designs/details/main/_DetailsBase'
	, 'app/designs/details/main/SpeciesLocation'
], function(
	redmicConfig
	, declare
@@ -34,17 +34,26 @@ define([
				templateTitle: TemplateTitle,
				templateInfo: TemplateInfo,
				target: redmicConfig.services.species,
				reportService: "species",
				reportService: 'species',
				ancestorsTarget: redmicConfig.services.taxonAncestors,
				documentTarget: "documents",
				activityTarget: "activities",
				infoTarget: "infoTarget",
				titleWidgetTarget: "titleWidgetTarget"
				documentTarget: 'documents',
				activityTarget: 'activities',
				infoTarget: 'infoTarget',
				titleWidgetTarget: 'titleWidgetTarget',
				pathParent: redmicConfig.viewPaths.speciesCatalog
			};

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

		_setConfigurations: function() {

			this.viewPathsWidgets = {
				documents: redmicConfig.viewPaths.bibliographyDetails,
				activities: redmicConfig.viewPaths.activityDetails
			};
		},

		_setMainConfigurations: function() {

			this.inherited(arguments);
@@ -59,7 +68,7 @@ define([
					props: {
						noDataMessage: TemplateCustom({
							message: this.i18n.noAssociatedDocuments,
							iconClass: "fr fr-no-data"
							iconClass: 'fr fr-no-data'
						})
					}
				}
@@ -154,7 +163,7 @@ define([
			this._speciesData = lang.clone(res.data);

			this._emitEvt('REQUEST', {
				method: "POST",
				method: 'POST',
				target: this.target[3],
				action: '_search',
				query: {
+41 −0
Original line number Diff line number Diff line
define([
	'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'dojo/aspect'
	, 'src/redmicConfig'
], function(
	declare
	, lang
	, aspect
	, redmicConfig
) {

	return declare(null, {
		//	summary:
		//		Extensión de vista de detalle de especies para añadir funcionalidad relativa a la edición de
		//		registros.

		constructor: function(args) {

			this.config = {
			};

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

			aspect.after(this, '_setConfigurations', lang.hitch(this, this._setSpeciesEditionConfigurations));
		},

		_setSpeciesEditionConfigurations: function() {

			if (!this._titleRightButtonsList) {
				this._titleRightButtonsList = [];
			}

			this._titleRightButtonsList.push({
				icon: 'fa-edit',
				href: redmicConfig.viewPaths.speciesEdit,
				title: this.i18n.edit
			});
		}
	});
});
Loading