Commit 8a88d426 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Revisa funcionalidad de títulos de vistas detalle

Elimina selección desde título de vistas detalle.

Elimina funcionalidad de tabs en título de vistas detalle.

Reestructura contenedores para mejorar la distribución de contenido, con
texto arriba y botones debajo.

Mejora estilos y permite leer más contenido, aprovechando mejor el
espacio.
parent c4b2edcd
Loading
Loading
Loading
Loading
+0 −35
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@ define([
	"dojo/_base/declare"
	, "dojo/_base/lang"
	, "dojo/aspect"
	, "put-selector/put"
	, "redmic/modules/base/_Module"
	, "redmic/modules/base/_Show"
	, "./_ControllerItfc"
@@ -10,7 +9,6 @@ define([
	declare
	, lang
	, aspect
	, put
	, _Module
	, _Show
	, _ControllerItfc
@@ -66,39 +64,6 @@ define([
			this._onEvt("SHOW", lang.hitch(this, this._onControllerShown));
		},

		_updateTitleClassSelector: function() {

			var node = this._getTitleNode();
			node && put(node, this.titleClassSelector);
		},

		_updateTitle: function(title) {

			var titleNode = this._getTitleNode(),
				titleValue = title || this.title;

			if (!titleNode) {
				return;
			}

			put(titleNode, '[title=$]', titleValue);
			titleNode.innerHTML = titleValue;
		},

		_setTitle: function(title) {

			if (this.titleSpanNode) {
				put(this.titleSpanNode, "!");
			}

			this.titleSpanNode = put(this._titleNode, "span[title=$].titleRedmic", title, title);
		},

		_getTitleNode: function() {

			return this.titleSpanNode;
		},

		_resizeControllerAfterShow: function() {

			this.resize && this.resize();
+33 −0
Original line number Diff line number Diff line
@@ -54,6 +54,39 @@ define([
			put(this.domNode, childNode);
		},

		_updateTitleClassSelector: function() {

			var node = this._getTitleNode();
			node && put(node, this.titleClassSelector);
		},

		_updateTitle: function(title) {

			var titleNode = this._getTitleNode(),
				titleValue = title || this.title;

			if (!titleNode) {
				return;
			}

			put(titleNode, '[title=$]', titleValue);
			titleNode.innerHTML = titleValue;
		},

		_setTitle: function(title) {

			if (this.titleSpanNode) {
				put(this.titleSpanNode, "!");
			}

			this.titleSpanNode = put(this._titleNode, "span[title=$].designLayoutTitle", title, title);
		},

		_getTitleNode: function() {

			return this.titleSpanNode;
		},

		// TODO sustituto de método de dijit, cuando se resuelvan todas las dependencias, eliminar y usar el interno
		addChild: function(child) {

+8 −68
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@ define([
	, "dojo/query"
	, "put-selector/put"
	, "redmic/modules/layout/templateDisplayer/TemplateDisplayer"
	, "RWidgets/Utilities"
	, "templates/DefaultDetailsTitle"
], function (
	declare
@@ -14,7 +13,6 @@ define([
	, query
	, put
	, TemplateDisplayer
	, Utilities
	, TemplateTitle
){
	return declare(null, {
@@ -84,9 +82,9 @@ define([

		_createContainerTitle: function() {

			this.topNode = put("div.infoTitle");
			this.topNode = put("div.infoTitle.infoTitleBackground");

			this.titleNode = put(this.topNode, "div.infoTitle.infoTitleBackground.title");
			this.titleNode = put(this.topNode, "div.title");

			if (this.centerTitle) {
				put(this.titleNode, ".centerTitle");
@@ -111,11 +109,8 @@ define([

			var leftButtons = this._titleLeftButtonsList.concat(this.titleLeftButtonsList || []),
				rightButtons = this._titleRightButtonsList.concat(this.titleRightButtonsList || []);
			this._insertButtonsIcons(leftButtons.reverse(), rightButtons.reverse());

			if (this.tabs && this.tabs.length > 0) {
				this._insertTabs();
			}
			this._insertButtonsIcons(leftButtons.reverse(), rightButtons.reverse());
		},

		_createTitle: function() {
@@ -141,9 +136,11 @@ define([
				return;
			}

			this._titleLeftNode = put(this.titleNode, "div.left");
			this._titleCenterNode = put(this.titleNode, "div.center");
			this._titleRightNode = put(this.titleNode, "div.right.hidden");
			this._titleCenterNode = this.titleNode;

			this._titleButtonsNode = put(this.topNode, 'div.buttons')
			this._titleLeftNode = put(this._titleButtonsNode, "div.left");
			this._titleRightNode = put(this._titleButtonsNode, "div.right.hidden");
		},

		_addIdTitle: function() {
@@ -171,63 +168,6 @@ define([
			}
		},

		_insertTabs: function() {

			if (this._tabstitleNode) {
				this._tabstitleNode = put(this._tabstitleNode, "!");
			}

			this._tabstitleNode = put(this.titleNode, "div.tabs");

			for (var i = 0; i < this.tabs.length; i++) {
				this._insertTab(this.tabs[i]);
			}
		},

		_insertTab: function(tab) {

			if (tab.select || !this._insertTabByCondition(tab)) {
				return;
			}

			var tabClass = '.tab.tabSelect',
				tabTitleKey = tab.title,
				tabTitleValue = this.i18n[tabTitleKey] || tabTitleKey,
				tabNode = put(this._tabstitleNode, 'div' + tabClass + ' a', tabTitleValue);

			if (tab.href) {
				tabNode.setAttribute('href', lang.replace(tab.href, this.data));
				tabNode.setAttribute('d-state-url', true);
			}
		},

		_insertTabByCondition: function(tab) {

			if (tab.condition) {
				return tab.condition(this.data);
			}

			var conditionHrefPath = tab.conditionHref,
				conditionValue = tab.conditionValue,
				conditionHref;

			if (!conditionHrefPath) {
				return true;
			}

			conditionHref = Utilities.getDeepProp(this.data, conditionHrefPath, this.pathSeparator);

			if (conditionValue) {
				if (conditionHref === conditionValue) {
					return true;
				}
			} else if (conditionHref) {
				return true;
			}

			return false;
		},

		_insertButtonsIcons: function(leftButtons, rightButtons) {

			var i;
+0 −93
Original line number Diff line number Diff line
define([
	"dojo/_base/declare"
	, "dojo/_base/lang"
	, "dojo/aspect"
	, "redmic/modules/base/_Selection"
	, "put-selector/put"
], function (
	declare
	, lang
	, aspect
	, _Selection
	, put
) {

	return declare(_Selection, {
		//	summary:
		//		Extensión para añadir selection al la vista de detalles

		constructor: function(args) {

			aspect.after(this, "_addDataInTitle", this._groupSelected);
			aspect.after(this, "_createTitle", this._createTitleSelection);
		},

		_createTitleSelection: function() {

			if (this._checkBoxNode) {
				return;
			}

			this._selectItem = false;
			this._classDefaultSelection = "selectionDetails fa fa-";
			this._checkBoxNode = put(this._titleLeftNode, "span");
			this._checkBoxNode.setAttribute("class", this._classDefaultSelection + "square-o");
			this._checkBoxNode.onclick = lang.hitch(this, this._onClickSelection);
		},

		_groupSelected: function() {

			this._emitEvt("GROUP_SELECTED");
		},

		_onClickSelection: function() {

			this._toggleSelectionItem();
		},

		_toggleSelectionItem: function() {

			if (this._selectItem) {
				if (this.data) {
					this._emitEvt("DESELECT", [this.data[this.idProperty]]);
				}
				this._checkBoxDeselect();
			} else {
				if (this.data) {
					this._emitEvt("SELECT", [this.data[this.idProperty]]);
				}
				this._checkBoxSelect();
			}
		},

		_select: function(id, total) {

			this.inherited(arguments);

			if (this.data && this.data[this.idProperty] == id) {
				this._checkBoxSelect();
			}
		},

		_deselect: function(id, total) {

			this.inherited(arguments);

			if (this.data && this.data[this.idProperty] == id) {
				this._checkBoxDeselect();
			}
		},

		_checkBoxSelect: function() {

			this._selectItem = true;
			this._checkBoxNode.setAttribute("class", this._classDefaultSelection + "check-square-o");
		},

		_checkBoxDeselect: function() {

			this._selectItem = false;
			this._checkBoxNode.setAttribute("class", this._classDefaultSelection + "square-o");
		}
	});
});
+1 −3
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@ define([
	, "app/designs/details/Controller"
	, "app/designs/details/Layout"
	, "app/designs/details/_AddTitle"
	, "app/designs/details/_TitleSelection"
	, "app/redmicConfig"
	, "dojo/_base/declare"
	, "dojo/_base/lang"
@@ -23,7 +22,6 @@ define([
	, Controller
	, Layout
	, _AddTitle
	, _TitleSelection
	, redmicConfig
	, declare
	, lang
@@ -39,7 +37,7 @@ define([
	, TemplateOrganisation
	, TemplatePlatform
){
	return declare([Layout, Controller, _Main, _AddTitle, _TitleSelection], {
	return declare([Layout, Controller, _Main, _AddTitle], {
		//	summary:
		//		Base de vistas detalle de la rama de actividades.

Loading