Skip to content

EspoCRM – Open Source CRM Application

text style buttons in top-right menu

Yuriif8dedce967cd
diff --git a/client/src/views/detail.js b/client/src/views/detail.js
index 62f44acebe..aa461a68b1 100644
--- a/client/src/views/detail.js
+++ b/client/src/views/detail.js
@@ -408,6 +408,7 @@ class DetailView extends MainView {
className: 'btn-s-wide',
text: this.translate('Starred'),
hidden: !isStarred,
+ style: 'text',
//title: this.translate('Unstar'),
onClick: () => this.actionUnstar(),
}, true);
@@ -417,6 +418,7 @@ class DetailView extends MainView {
iconHtml: '<span class="far fa-star fa-sm"></span>',
className: 'btn-s-wide',
text: this.translate('Star'),
+ style: 'text',
//title: this.translate('Star'),
hidden: isStarred || !this.model.has('isStarred'),
onClick: () => this.actionStar(),
diff --git a/client/src/views/main.js b/client/src/views/main.js
index 48aa4a37c6..b873579fe4 100644
--- a/client/src/views/main.js
+++ b/client/src/views/main.js
@@ -62,7 +62,7 @@ class MainView extends View {
* @property {string} [link] A link.
* @property {string} [label] A translatable label.
* @property {string} [labelTranslation] A label translation path.
- * @property {'default'|'danger'|'success'|'warning'} [style] A style. Only for buttons.
+ * @property {'default'|'danger'|'success'|'warning'|'text'} [style] A style. Only for buttons.
* @property {boolean} [hidden] Hidden.
* @property {boolean} [disabled] Disabled.
* @property {Object.<string,string|number|boolean>} [data] Data attribute values.
@@ -781,16 +781,29 @@ class MainView extends View {
* @private
*/
adjustButtons() {
- const $buttons = this.$headerActionsContainer.find('.btn');
+ /** @type {HTMLElement[]} */
+ let buttons = [...this.$headerActionsContainer.get(0)?.querySelectorAll('.btn')];
- $buttons
- .removeClass('radius-left')
- .removeClass('radius-right');
+ if (!buttons) {
+ return;
+ }
+
+ for (const it of buttons) {
+ it.classList.remove('radius-left', 'radius-right');
+ }
+
+ buttons = buttons.filter(it => !it.classList.contains('hidden'));
- const $buttonsVisible = $buttons.filter(':not(.hidden)');
- $buttonsVisible.first().addClass('radius-left');
- $buttonsVisible.last().addClass('radius-right');
+ for (const [i, it] of buttons.entries()) {
+ if (i === 0 || buttons[i - 1].classList.contains('btn-text')) {
+ it.classList.add('radius-left');
+ }
+
+ if (i === buttons.length - 1 || buttons[i + 1].classList.contains('btn-text')) {
+ it.classList.add('radius-right');
+ }
+ }
}
/**
diff --git a/schema/metadata/clientDefs.json b/schema/metadata/clientDefs.json
index 57419234e0..26a607c333 100644
--- a/schema/metadata/clientDefs.json
+++ b/schema/metadata/clientDefs.json
@@ -807,7 +807,8 @@
"success",
"warning",
"danger",
- "info"
+ "info",
+ "text"
],
"description": "A style."
},