Commit 0cab0010 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Recupera forms de edición en popup y limpia restos

parent e439e0b1
Loading
Loading
Loading
Loading
+0 −77
Original line number Diff line number Diff line
define([
	"dijit/layout/ContentPane"
	, "dojo/_base/declare"
	, "dojo/_base/lang"
	, "dojo/aspect"
	, 'put-selector/put'
	, "RWidgets/layout/DialogComplex"
	, "src/component/form/_CreateKeypad"
], function(
	ContentPane
	, declare
	, lang
	, aspect
	, put
	, DialogComplex
	, _CreateKeypad
) {

	return declare(_CreateKeypad, {
		//	summary:
		//		Extensión del módulo Form para que se muestre en un Dialog.

		constructor: function(args) {

			aspect.before(this, "_afterSetConfigurations", lang.hitch(this, this._setShowInDialogConfigurations));
			aspect.before(this, "_initialize", lang.hitch(this, this._initializeShowInDialog));
		},

		_setShowInDialogConfigurations: function() {

			this.dialogConfig = this._merge([{
				width: this.width || 6,
				height: this.height || "lg",
				title: this.title,
				onCancel: lang.hitch(this, this._cancel),
				notDestroyRecursive: true
			}, this.dialogConfig || {}]);
		},

		_initializeShowInDialog: function() {

			this.dialog = new DialogComplex(this.dialogConfig);
		},

		_getNodeToShowCreateKeypadAfter: function() {

			this.dialog.show().then(lang.hitch(this, function() {

				var formNode = new ContentPane();

				put(formNode.domNode, this.domNode);

				this.dialog.set("centerContent", formNode);

				var keypadNode = new ContentPane();

				this._publish(this.keypad.getChannel("SHOW"), {
					node: keypadNode.domNode
				});

				this.dialog.set("bottomContent", keypadNode);
			}));

			this.node = this.dialog.domNode;
		},

		_hide: function() {

			// TODO revisar, no accede a hide del _Show

			this._emitEvt('HIDE');
			//this.inherited(arguments);

			this.dialog.hide();
		}
	});
});
+8 −8
Original line number Diff line number Diff line
@@ -4,18 +4,20 @@ define([
	, 'dojo/aspect'
	, "src/component/base/_Persistence"
	, 'src/component/form/FormContainerImpl'
	, 'src/component/form/_CreateInternalKeypad'
	, "src/component/form/_ListenModelHasChanged"
	, 'src/component/form/_PublicateChanges'
	, "src/component/form/_ShowInDialog"
	, 'src/component/base/_ShowInPopup'
], function(
	declare
	, lang
	, aspect
	, _Persistence
	, FormContainerImpl
	, _CreateInternalKeypad
	, _ListenModelHasChanged
	, _PublicateChanges
	, _ShowInDialog
	, _ShowInPopup
) {

	return declare(_Persistence, {
@@ -50,13 +52,11 @@ define([

		_initializeAddAtlasCategory: function() {

			var formDefinition = declare([
				FormContainerImpl,
				_ListenModelHasChanged,
				_ShowInDialog
			]);
			var FormDefinition = declare([
				FormContainerImpl, _ListenModelHasChanged, _CreateInternalKeypad
			]).extend(_ShowInPopup);

			this._categoryForm = new formDefinition(this.categoryFormConfig);
			this._categoryForm = new FormDefinition(this.categoryFormConfig);
		},

		_defineAddAtlasCategorySubscriptions: function () {
+11 −5
Original line number Diff line number Diff line
@@ -3,16 +3,19 @@ define([
	, "dojo/_base/lang"
	, "dojo/aspect"
	, "src/component/form/FormContainerImpl"
	, 'src/component/form/_CreateInternalKeypad'
	, "src/component/form/_ListenModelHasChanged"
	, "src/component/form/_ShowInDialog"
	, 'src/component/base/_ShowInPopup'
], function(
	declare
	, lang
	, aspect
	, FormContainerImpl
	, _CreateInternalKeypad
	, _ListenModelHasChanged
	, _ShowInDialog
	, _ShowInPopup
) {

	return declare(null, {
		//	summary:
		//		Extensión para las vistas con formulario en un Dialog.
@@ -45,8 +48,11 @@ define([

		_initializeFormInDialogView: function() {

			var formDef = declare([FormContainerImpl, _ListenModelHasChanged, _ShowInDialog]);
			this.editor = new formDef(this.formConfig);
			var FormDefinition = declare([
				FormContainerImpl, _ListenModelHasChanged, _CreateInternalKeypad
			]).extend(_ShowInPopup);

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

		_afterSaved: function(results) {
+6 −4
Original line number Diff line number Diff line
@@ -185,11 +185,13 @@ define([

		hide: function() {

			if (this.centerContent && this.centerContent.destroyRecursive && !this.notDestroyRecursive) {
			if (this.centerContent) {
				if (this.centerContent.destroyRecursive && !this.notDestroyRecursive) {
					this.centerContent.destroyRecursive();
				} else {
					put(this.centerContent.domNode, '!');
				}
			}

			if (this.bottomContent && this.bottomContent.activeButtons) {
				this.bottomContent.activeButtons();