Commit 1375f021 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Une catalog y admin de program y project, limpia

Combina las vistas de catálogo y de administración de las entidades de
proyecto y programa, al igual que se hizo con actividad.

Aprovecha para limpiar una funcionalidad en desuso, para acceder a la
parte administrativa filtrando por programa o proyecto los elementos
listados. Sólo existía en la parte interna, por lo que los usuarios no
lo echarán de menos y se simplifica la gestión de vistas.
parent c211fa1d
Loading
Loading
Loading
Loading
+1 −27
Original line number Diff line number Diff line
@@ -49,17 +49,13 @@ define([
				mask: {"download":{}},
				reportService: "activity",

				activityTarget: redmicConfig.services.activity,
				selectionTarget: redmicConfig.services.activity,
				activityProjectTarget: redmicConfig.services.activityProject,
				target: redmicConfig.services.activity,
				perms: null,

				browserExts: [_Select]
			};

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

			this.target = this.activityTarget;
		},

		_setMainConfigurations: function() {
@@ -71,7 +67,6 @@ define([
			}, this.filterConfig || {}]);

			this.browserConfig = this._merge([{
				selectionTarget: this.selectionTarget,
				template: templateList,
				rowConfig: {
					buttonsConfig: {
@@ -110,27 +105,6 @@ define([
			this.textSearchConfig = this._merge([{
				showExpandIcon: true
			}, this.textSearchConfig || {}]);
		},

		_setOwnCallbacksForEvents: function() {

			this._onEvt('CONNECT', this._createTarget);
		},

		_createTarget: function() {

			var target = this.activityTarget;

			if (this.pathVariableId && Number.isInteger(parseInt(this.pathVariableId, 10))) {
				target = lang.replace(this.activityProjectTarget, {
					id: this.pathVariableId
				});
			}

			this._publish(this.getChannel('UPDATE_TARGET'), {
				target: target,
				refresh: true
			});
		}
	});
});
+31 −6
Original line number Diff line number Diff line
@@ -6,10 +6,12 @@ define([
	, "dojo/_base/declare"
	, "dojo/_base/lang"
	, "templates/ProgramList"
	, 'src/catalog/program/_ProgramEdition'
	, "src/component/browser/_Select"
	, "src/component/browser/bars/SelectionBox"
	, "src/component/browser/bars/Order"
	, "src/component/browser/bars/Total"
	, 'src/util/Credentials'
], function(
	_Main
	, Controller
@@ -18,22 +20,35 @@ define([
	, declare
	, lang
	, templateList
	, _ProgramEdition
	, _Select
	, SelectionBox
	, Order
	, Total
	, Credentials
) {
	return declare([Layout, Controller, _Main], {

	var declareItems = [Layout, Controller, _Main];

	if (Credentials.userIsEditor()) {
		declareItems.push(_ProgramEdition);
	}

	return declare(declareItems, {
		//	summary:
		//		Extensión para establecer la configuración de las vistas de program.
		//	description:
		//
		//		Vista de catálogo de programas.

		constructor: function(args) {

			this.config = {
				browserExts: [_Select],
				title: this.i18n.programs
				mask: {"download":{}},
				reportService: "program",
				title: this.i18n.programCatalogView,
				ownChannel: "programCatalog",
				target: redmicConfig.services.program,
				perms: null,
				idProperty: "id"
			};

			lang.mixin(this, this.config, args);
@@ -47,6 +62,16 @@ define([

			this.browserConfig = this._merge([{
				template: templateList,
				rowConfig: {
					buttonsConfig: {
						listButton: [{
							icon: "fa-info-circle",
							btnId: "details",
							title: "info",
							href: this.viewPaths.programDetails
						}]
					}
				},
				bars: [{
					instance: Total
				},{
+61 −0
Original line number Diff line number Diff line
define([
	'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'dojo/aspect'
	, 'app/base/views/extensions/_EditionWizardView'
], function(
	declare
	, lang
	, aspect
	, _EditionWizardView
) {

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

		constructor: function(args) {

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

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

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

		_setProgramEditionBrowserButtons: function() {

			if (!this.listButtonsEdition) {
				console.warn('Tried to add program 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.programEdit
				},{
					icon: 'fa-copy',
					btnId: 'copy',
					title: 'copy',
					href: this.viewPaths.programAdd
				});
			} else {
				console.warn('Tried to add program edition buttons, but edition button group config was not found!');
			}
		}
	});
});
+30 −6
Original line number Diff line number Diff line
@@ -6,10 +6,12 @@ define([
	, "dojo/_base/declare"
	, "dojo/_base/lang"
	, "templates/ProjectList"
	, 'src/catalog/project/_ProjectEdition'
	, "src/component/browser/_Select"
	, "src/component/browser/bars/SelectionBox"
	, "src/component/browser/bars/Order"
	, "src/component/browser/bars/Total"
	, 'src/util/Credentials'
], function(
	_Main
	, Controller
@@ -18,22 +20,34 @@ define([
	, declare
	, lang
	, templateList
	, _ProjectEdition
	, _Select
	, SelectionBox
	, Order
	, Total
	, Credentials
) {
	return declare([Layout, Controller, _Main], {

	var declareItems = [Layout, Controller, _Main];

	if (Credentials.userIsEditor()) {
		declareItems.push(_ProjectEdition);
	}

	return declare(declareItems, {
		//	summary:
		//		Extensión para establecer la configuración de las vistas de project.
		//	description:
		//
		//		Vista de catálogo de proyectos.

		constructor: function(args) {

			this.config = {
				browserExts: [_Select],
				title: this.i18n.projects
				target: redmicConfig.services.project,
				perms: null,
				mask: {"download":{}},
				reportService: "project",
				title: this.i18n.projectCatalogView,
				ownChannel: "projectCatalog"
			};

			lang.mixin(this, this.config, args);
@@ -46,6 +60,16 @@ define([
			}, this.filterConfig || {}]);

			this.browserConfig = this._merge([{
				rowConfig: {
					buttonsConfig: {
						listButton: [{
							icon: "fa-info-circle",
							btnId: "details",
							title: "info",
							href: this.viewPaths.projectDetails
						}]
					}
				},
				template: templateList,
				bars: [{
					instance: Total
+61 −0
Original line number Diff line number Diff line
define([
	'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'dojo/aspect'
	, 'app/base/views/extensions/_EditionWizardView'
], function(
	declare
	, lang
	, aspect
	, _EditionWizardView
) {

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

		constructor: function(args) {

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

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

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

		_setProjectEditionBrowserButtons: function() {

			if (!this.listButtonsEdition) {
				console.warn('Tried to add project 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.projectEdit
				},{
					icon: 'fa-copy',
					btnId: 'copy',
					title: 'copy',
					href: this.viewPaths.projectAdd
				});
			} else {
				console.warn('Tried to add project edition buttons, but edition button group config was not found!');
			}
		}
	});
});
Loading