From 2360b75f9751cd8a7d3cb2853cd9bb4a9e99cbb8 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Thu, 11 Jul 2024 13:22:30 +0300 Subject: [PATCH] panel actions --- client/res/templates/record/panel-actions.tpl | 77 ++++++++++--------- client/src/views/record/panels-container.js | 10 ++- client/src/views/record/panels/bottom.js | 8 +- 3 files changed, 54 insertions(+), 41 deletions(-) diff --git a/client/res/templates/record/panel-actions.tpl b/client/res/templates/record/panel-actions.tpl index 35290ad13b..55db8c933c 100644 --- a/client/res/templates/record/panel-actions.tpl +++ b/client/res/templates/record/panel-actions.tpl @@ -1,43 +1,44 @@ {{#each buttonList}} - + {{/each}} {{#if actionList}} - - + + {{/if}} diff --git a/client/src/views/record/panels-container.js b/client/src/views/record/panels-container.js index e701289a35..897bd4bff0 100644 --- a/client/src/views/record/panels-container.js +++ b/client/src/views/record/panels-container.js @@ -65,13 +65,16 @@ class PanelsContainerRecordView extends View { * * @typedef {Object} module:views/record/panels-container~button * - * @property {string} action An action. + * @property {string} [action] An action. + * @property {string} [name] A name. Required if a handler is used. * @property {boolean} [hidden] Hidden. * @property {string} [label] A label. Translatable. * @property {string} [html] A HTML. * @property {string} [text] A text. * @property {string} [title] A title (on hover). Translatable. * @property {Object.} [data] Data attributes. + * @property {string} [handler] A handler. + * @property {string} [actionFunction] An action function. * @property {function()} [onClick] A click event. */ @@ -81,12 +84,15 @@ class PanelsContainerRecordView extends View { * @typedef {Object} module:views/record/panels-container~action * * @property {string} [action] An action. + * @property {string} [name] A name. Required if a handler is used. * @property {string} [link] A link URL. * @property {boolean} [hidden] Hidden. * @property {string} [label] A label. Translatable. * @property {string} [html] A HTML. * @property {string} [text] A text. * @property {Object.} [data] Data attributes. + * @property {string} [handler] A handler. + * @property {string} [actionFunction] An action function. * @property {function()} [onClick] A click event. */ @@ -497,7 +503,7 @@ class PanelsContainerRecordView extends View { return; } - this.panelList.filter(item => item.name === name).forEach(item => { + this.panelList.filter(item => item.name === name).forEach(item => { item.hidden = true; if (typeof item.tabNumber !== 'undefined') { diff --git a/client/src/views/record/panels/bottom.js b/client/src/views/record/panels/bottom.js index 0a983ab691..07201321d4 100644 --- a/client/src/views/record/panels/bottom.js +++ b/client/src/views/record/panels/bottom.js @@ -123,6 +123,12 @@ class BottomPanelView extends View { this.buttonList = Espo.Utils.cloneDeep(this.defs.buttonList || this.buttonList || []); this.actionList = Espo.Utils.cloneDeep(this.defs.actionList || this.actionList || []); + this.actionList.forEach(it => { + if (it.name) { + it.action = it.name; + } + }); + this.fieldList = this.options.fieldList || this.fieldList || []; this.recordViewObject = this.options.recordViewObject; @@ -251,7 +257,7 @@ class BottomPanelView extends View { } } else { - field = item; + field = item; } if (!(field in this.model.defs.fields)) {