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

Evita duplicados en compartir selección

Corrige efecinquitis con checkboxes de habilitar la compartición de la
selección guardada.

También oculta si se cambia de vista.
parent 7dbb995a
Loading
Loading
Loading
Loading
+17 −6
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ define([
	, 'redmic/base/Credentials'
	, 'redmic/modules/base/_Module'
	, 'redmic/modules/base/_Selection'
	, 'redmic/modules/base/_Show'
	, 'redmic/modules/base/_ShowInPopup'
], function(
	alertify
@@ -19,10 +20,11 @@ define([
	, Credentials
	, _Module
	, _Selection
	, _Show
	, _ShowInPopup
) {

	return declare([_Module, _Selection], {
	return declare([_Module, _Show, _Selection], {
		//	summary:
		//		Gestor de selecciones persistentes.
		//	description:
@@ -55,6 +57,11 @@ define([
			lang.mixin(this, this.config, args);
		},

		_setOwnCallbacksForEvents: function() {

			this._onEvt('ANCESTOR_HIDDEN', lang.hitch(this, this._onSelectionManagerAncestorHidden));
		},

		_setConfigurations: function() {

			this.loadSelectionConfig = this._merge([{
@@ -167,7 +174,10 @@ define([
		_saveNewSelection: function(selectionId) {

			var promptCbk = lang.hitch(this, this._getSaveParametersAndStore, selectionId),
				prompt = alertify.prompt(this.i18n.newNameMessage, '', promptCbk);
				prompt = alertify.prompt(this.i18n.newNameMessage, '', promptCbk, function() {

					this.destroy();
				});

			prompt.setHeader(this.i18n.saveSelection);
			this._addSharedCheckbox(prompt);
@@ -187,10 +197,6 @@ define([

		_addSharedCheckbox: function(prompt) {

			if (this._sharedCheckbox) {
				return;
			}

			var promptContent = prompt.elements.content,
				sharedCheckboxId = this.getOwnChannel() + '-sharedCheckbox';

@@ -318,6 +324,11 @@ define([
					id: settingsId
				});
			}
		},

		_onSelectionManagerAncestorHidden: function() {

			this._loadSelection && this._publish(this._loadSelection.getChannel('HIDE'));
		}
	});
});