Skip to content

EspoCRM – Open Source CRM Application

page content width param

Yuri Kuznetsove29d0959c4b1
diff --git a/application/Espo/Resources/i18n/en_US/Preferences.json b/application/Espo/Resources/i18n/en_US/Preferences.json
index b972e24bb6..8cdf5115d8 100644
--- a/application/Espo/Resources/i18n/en_US/Preferences.json
+++ b/application/Espo/Resources/i18n/en_US/Preferences.json
@@ -22,6 +22,7 @@
"defaultReminders": "Default Reminders",
"defaultRemindersTask": "Default Reminders for Tasks",
"theme": "Theme",
+ "pageContentWidth": "Content Width",
"useCustomTabList": "Custom Tab List",
"addCustomTabs": "Add Custom Tabs",
"tabList": "Tab List",
@@ -44,6 +45,10 @@
"weekStart": {
"0": "Sunday",
"1": "Monday"
+ },
+ "pageContentWidth": {
+ "": "Normal",
+ "Wide": "Wide"
}
},
"labels": {
diff --git a/application/Espo/Resources/layouts/Preferences/detail.json b/application/Espo/Resources/layouts/Preferences/detail.json
index de50339571..928c70b4ca 100644
--- a/application/Espo/Resources/layouts/Preferences/detail.json
+++ b/application/Espo/Resources/layouts/Preferences/detail.json
@@ -100,7 +100,7 @@
"rows": [
[
{"name": "theme"},
- false
+ {"name": "pageContentWidth"}
]
]
},
diff --git a/application/Espo/Resources/metadata/entityDefs/Preferences.json b/application/Espo/Resources/metadata/entityDefs/Preferences.json
index 9191faf8cf..b331253c3c 100644
--- a/application/Espo/Resources/metadata/entityDefs/Preferences.json
+++ b/application/Espo/Resources/metadata/entityDefs/Preferences.json
@@ -148,6 +148,13 @@
"themeParams": {
"type": "jsonObject"
},
+ "pageContentWidth": {
+ "type": "enum",
+ "options": [
+ "",
+ "Wide"
+ ]
+ },
"useCustomTabList": {
"type": "bool",
"default": false
diff --git a/client/src/app.js b/client/src/app.js
index b995688845..571607b636 100644
--- a/client/src/app.js
+++ b/client/src/app.js
@@ -497,6 +497,8 @@ class App {
this.loadStylesheet();
}
+ this.applyUserStyle();
+
if (this.anotherUser) {
this.viewHelper.webSocketManager = null;
this.webSocketManager = null;
@@ -1020,6 +1022,17 @@ class App {
element.setAttribute('href', path);
}
+ /**
+ * @private
+ */
+ applyUserStyle() {
+ const pageContentWidth = this.preferences.get('pageContentWidth');
+
+ if (pageContentWidth) {
+ document.body.dataset.contentWidth = pageContentWidth;
+ }
+ }
+
/**
* @private
* @param {string} username
diff --git a/client/src/views/preferences/record/edit.js b/client/src/views/preferences/record/edit.js
index 5bd0ae5942..dcc2c71411 100644
--- a/client/src/views/preferences/record/edit.js
+++ b/client/src/views/preferences/record/edit.js
@@ -174,11 +174,12 @@ class PreferencesEditRecordView extends EditRecordView {
this.hideField('theme');
}
- this.on('save', initialAttributes => {
+ this.on('save', /** Record */initialAttributes => {
if (
this.model.get('language') !== initialAttributes.language ||
this.model.get('theme') !== initialAttributes.theme ||
- (this.model.get('themeParams') || {}).navbar !== (initialAttributes.themeParams || {}).navbar
+ (this.model.get('themeParams') || {}).navbar !== (initialAttributes.themeParams || {}).navbar ||
+ this.model.get('pageContentWidth') !== initialAttributes.pageContentWidth
) {
this.setConfirmLeaveOut(false);
diff --git a/frontend/less/espo/elements/site.less b/frontend/less/espo/elements/site.less
index d5c8b46929..5910dfbc06 100644
--- a/frontend/less/espo/elements/site.less
+++ b/frontend/less/espo/elements/site.less
@@ -18,3 +18,7 @@ body > footer > p a:visited {
#content > #main[tabindex="-1"] {
outline: none;
}
+
+body[data-content-width="Wide"] {
+ --container-max-width: var(--container-max-width-wide);
+}
diff --git a/frontend/less/espo/root-variables.less b/frontend/less/espo/root-variables.less
index c571b85cfd..e8396bce46 100644
--- a/frontend/less/espo/root-variables.less
+++ b/frontend/less/espo/root-variables.less
@@ -99,6 +99,10 @@
--table-cell-less-padding: var(--3px);
--container-max-width: var(--1440px);
+ --record-grid-max-width: var(--1300px);
+
+ // Internal. Not to be used directly.
+ --container-max-width-wide: calc(var(--1440px) + var(--340px));
//Also set in a CSS variable.
--navbar-width: var(--232px);
@@ -146,8 +150,6 @@
--grid-column-width-small: var(--246px);
--grid-column-width-medium: var(--340px);
- --record-grid-max-width: var(--1300px);
-
// computed
--popover-arrow-width-negative: calc(var(--popover-arrow-width) * -1);
--popover-arrow-outer-width: calc(var(--popover-arrow-width) + var(--1px));