From 3ebe30a9c08dbd3b90cce4f8c91951c7842e9723 Mon Sep 17 00:00:00 2001 From: yuri Date: Thu, 12 Apr 2018 14:48:45 +0300 Subject: [PATCH] entity colors and icons --- .../Espo/Controllers/EntityManager.php | 3 ++ application/Espo/Core/Utils/EntityManager.php | 11 ++++++ .../metadata/clientDefs/Account.json | 3 +- .../metadata/clientDefs/Calendar.json | 3 +- .../metadata/clientDefs/Contact.json | 3 +- .../metadata/clientDefs/Document.json | 3 +- .../Resources/metadata/clientDefs/Lead.json | 3 +- .../metadata/clientDefs/Opportunity.json | 3 +- .../Resources/i18n/en_US/EntityManager.json | 3 +- .../Espo/Resources/i18n/en_US/Settings.json | 5 ++- .../layouts/Settings/userInterface.json | 2 ++ .../metadata/entityDefs/Settings.json | 9 +++++ .../entity-manager/modals/edit-entity.tpl | 9 +++++ .../templates/fields/link-parent/detail.tpl | 4 +-- client/res/templates/fields/link/detail.tpl | 4 +-- .../templates/global-search/name-field.tpl | 2 +- client/res/templates/record/bottom.tpl | 6 +++- client/res/templates/record/side.tpl | 6 +++- client/res/templates/site/navbar.tpl | 4 +-- client/src/view-helper.js | 24 +++++++++++++ .../entity-manager/modals/edit-entity.js | 14 +++++++- client/src/views/detail.js | 4 ++- client/src/views/edit.js | 4 ++- client/src/views/email/detail.js | 4 ++- .../fields/link-multiple-with-columns.js | 6 +++- .../views/fields/link-multiple-with-role.js | 6 +++- client/src/views/fields/link-multiple.js | 8 ++++- client/src/views/fields/link-parent.js | 7 +++- client/src/views/fields/link.js | 8 ++++- client/src/views/global-search/name-field.js | 22 ++++++++++-- client/src/views/list.js | 4 ++- client/src/views/main.js | 4 +++ client/src/views/record/detail-bottom.js | 3 ++ client/src/views/record/detail-side.js | 3 ++ .../src/views/record/panels/relationship.js | 7 ++++ client/src/views/site/navbar.js | 35 +++++++++++++++---- client/src/views/stream/message.js | 3 +- frontend/less/espo-vertical/layout.less | 34 +++++++++++++----- frontend/less/espo-vertical/variables.less | 2 +- frontend/less/espo/custom.less | 22 +++++++++++- frontend/less/espo/variables.less | 2 ++ 41 files changed, 263 insertions(+), 49 deletions(-) diff --git a/application/Espo/Controllers/EntityManager.php b/application/Espo/Controllers/EntityManager.php index 532a62816e..76d46d2747 100644 --- a/application/Espo/Controllers/EntityManager.php +++ b/application/Espo/Controllers/EntityManager.php @@ -83,6 +83,9 @@ class EntityManager extends \Espo\Core\Controllers\Base if (isset($data['textFilterFields']) && is_array($data['textFilterFields'])) { $params['textFilterFields'] = $data['textFilterFields']; } + if (!empty($data['color'])) { + $params['color'] = $data['color']; + } $result = $this->getContainer()->get('entityManagerUtil')->create($name, $type, $params); diff --git a/application/Espo/Core/Utils/EntityManager.php b/application/Espo/Core/Utils/EntityManager.php index e555fd6685..e4d2a940e7 100644 --- a/application/Espo/Core/Utils/EntityManager.php +++ b/application/Espo/Core/Utils/EntityManager.php @@ -302,6 +302,10 @@ class EntityManager $clientDefsContents = str_replace('{'.$key.'}', $value, $clientDefsContents); } $clientDefsData = Json::decode($clientDefsContents, true); + + if (array_key_exists('color', $params)) { + $clientDefsData['color'] = $params['color']; + }; $this->getMetadata()->set('clientDefs', $name, $clientDefsData); $this->getBaseLanguage()->set('Global', 'scopeNames', $name, $labelSingular); @@ -387,6 +391,13 @@ class EntityManager $this->getMetadata()->set('entityDefs', $name, $entityDefsData); } + if (array_key_exists('color', $data)) { + $clientDefsData = [ + 'color' => $data['color'] + ]; + $this->getMetadata()->set('clientDefs', $name, $clientDefsData); + } + $this->getMetadata()->save(); $this->getLanguage()->save(); if ($isCustom) { diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Account.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Account.json index 07a60d624d..27e6e00cb7 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Account.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Account.json @@ -74,5 +74,6 @@ "detailConvert": { "type": "detail" } - } + }, + "color": "#edc755" } diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Calendar.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Calendar.json index 39f6691efc..ea497047a7 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Calendar.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Calendar.json @@ -9,5 +9,6 @@ "modeList": ["month", "agendaWeek", "agendaDay", "timeline"], "canceledStatusList": ["Not Held", "Canceled"], "completedStatusList": ["Held", "Completed"], - "additionalColorList": ["#AB78AD", "#CC9B45"] + "additionalColorList": ["#AB78AD", "#CC9B45"], + "iconClass": "glyphicon glyphicon-calendar" } \ No newline at end of file diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Contact.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Contact.json index 8d6a44d4ea..216fb4dc63 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Contact.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Contact.json @@ -116,5 +116,6 @@ } } } - } + }, + "color": "#70a9d7" } \ No newline at end of file diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Document.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Document.json index 927c0c0546..c2c1422874 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Document.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Document.json @@ -25,5 +25,6 @@ } ] } - } + }, + "iconClass": "glyphicon glyphicon-file" } diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Lead.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Lead.json index 6326b5fcef..cd733c24b1 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Lead.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Lead.json @@ -155,5 +155,6 @@ } } } - } + }, + "color": "#d69cc7" } \ No newline at end of file diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Opportunity.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Opportunity.json index 15bfb9c689..b4cf16a582 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Opportunity.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Opportunity.json @@ -70,5 +70,6 @@ "listForContact": { "type": "listSmall" } - } + }, + "color": "#91c36a" } diff --git a/application/Espo/Resources/i18n/en_US/EntityManager.json b/application/Espo/Resources/i18n/en_US/EntityManager.json index cc6dfee8fb..99aea3ed5f 100644 --- a/application/Espo/Resources/i18n/en_US/EntityManager.json +++ b/application/Espo/Resources/i18n/en_US/EntityManager.json @@ -28,7 +28,8 @@ "audited": "Audited", "auditedForeign": "Foreign Audited", "statusField": "Status Field", - "beforeSaveCustomScript": "Before Save Custom Script" + "beforeSaveCustomScript": "Before Save Custom Script", + "color": "Color" }, "options": { "type": { diff --git a/application/Espo/Resources/i18n/en_US/Settings.json b/application/Espo/Resources/i18n/en_US/Settings.json index b598a66063..d737e18dda 100644 --- a/application/Espo/Resources/i18n/en_US/Settings.json +++ b/application/Espo/Resources/i18n/en_US/Settings.json @@ -94,7 +94,10 @@ "adminNotifications": "System notifications in administration panel", "adminNotificationsNewVersion": "Show notification when new EspoCRM version is available", "textFilterUseContainsForVarchar": "Use 'contains' opertor when filtering varchar fields", - "authTokenPreventConcurrent": "Only one auth token per user" + "authTokenPreventConcurrent": "Only one auth token per user", + "scopeColorsDisabled": "Disable scope colors", + "tabColorsDisabled": "Disable tab colors", + "tabIconsDisabled": "Disable tab icons" }, "options": { "weekStart": { diff --git a/application/Espo/Resources/layouts/Settings/userInterface.json b/application/Espo/Resources/layouts/Settings/userInterface.json index f84704f4fb..6da9dbb400 100644 --- a/application/Espo/Resources/layouts/Settings/userInterface.json +++ b/application/Espo/Resources/layouts/Settings/userInterface.json @@ -7,6 +7,8 @@ [{"name": "recordsPerPage"},{"name": "displayListViewRecordCount"}], [{"name": "recordsPerPageSmall"}, {"name": "avatarsDisabled"}], [{"name": "tabList"},{"name": "quickCreateList"}], + [{"name": "scopeColorsDisabled"}, {"name": "tabIconsDisabled"}], + [{"name": "tabColorsDisabled"}, false], [{"name": "dashboardLayout", "fullWidth": true}] ] } diff --git a/application/Espo/Resources/metadata/entityDefs/Settings.json b/application/Espo/Resources/metadata/entityDefs/Settings.json index d45e968502..84cc882585 100644 --- a/application/Espo/Resources/metadata/entityDefs/Settings.json +++ b/application/Espo/Resources/metadata/entityDefs/Settings.json @@ -456,6 +456,15 @@ "textFilterUseContainsForVarchar": { "type": "bool", "tooltip": true + }, + "scopeColorsDisabled": { + "type": "bool" + }, + "tabColorsDisabled": { + "type": "bool" + }, + "tabIconsDisabled": { + "type": "bool" } } } diff --git a/client/res/templates/admin/entity-manager/modals/edit-entity.tpl b/client/res/templates/admin/entity-manager/modals/edit-entity.tpl index bda115bb36..415ebe4b6d 100644 --- a/client/res/templates/admin/entity-manager/modals/edit-entity.tpl +++ b/client/res/templates/admin/entity-manager/modals/edit-entity.tpl @@ -79,3 +79,12 @@ {{/if}} {{/unless}} + +
+
+ +
+ {{{color}}} +
+
+
diff --git a/client/res/templates/fields/link-parent/detail.tpl b/client/res/templates/fields/link-parent/detail.tpl index f47efd68b8..4068fbdbd2 100644 --- a/client/res/templates/fields/link-parent/detail.tpl +++ b/client/res/templates/fields/link-parent/detail.tpl @@ -1,5 +1,3 @@ -{{#if idValue}} -{{nameValue}} -{{else}} +{{#if idValue}}{{#if iconHtml}}{{{iconHtml}}}{{/if}}{{nameValue}}{{else}} {{#if valueIsSet}}{{translate 'None'}}{{else}}...{{/if}} {{/if}} diff --git a/client/res/templates/fields/link/detail.tpl b/client/res/templates/fields/link/detail.tpl index 0fba42c538..df4b6f5f9b 100644 --- a/client/res/templates/fields/link/detail.tpl +++ b/client/res/templates/fields/link/detail.tpl @@ -1,5 +1,3 @@ -{{#if idValue}} -{{nameValue}} -{{else}} +{{#if idValue}}{{#if iconHtml}}{{{iconHtml}}}{{/if}}{{nameValue}}{{else}} {{#if valueIsSet}}{{translate 'None'}}{{else}}...{{/if}} {{/if}} diff --git a/client/res/templates/global-search/name-field.tpl b/client/res/templates/global-search/name-field.tpl index 4b740fb940..d745507ab9 100644 --- a/client/res/templates/global-search/name-field.tpl +++ b/client/res/templates/global-search/name-field.tpl @@ -1 +1 @@ -{{{name}}} +{{{iconHtml}}}{{{name}}} diff --git a/client/res/templates/record/bottom.tpl b/client/res/templates/record/bottom.tpl index 9c79ef2823..05cea492c5 100644 --- a/client/res/templates/record/bottom.tpl +++ b/client/res/templates/record/bottom.tpl @@ -26,7 +26,11 @@ {{#unless notRefreshable}} {{/unless}} - {{title}} + {{#if titleHtml}} + {{{titleHtml}}} + {{else}} + {{title}} + {{/if}} {{#unless notRefreshable}} {{/unless}} diff --git a/client/res/templates/record/side.tpl b/client/res/templates/record/side.tpl index 8124213456..4337294d7a 100644 --- a/client/res/templates/record/side.tpl +++ b/client/res/templates/record/side.tpl @@ -27,7 +27,11 @@ {{#unless notRefreshable}} {{/unless}} - {{title}} + {{#if titleHtml}} + {{{titleHtml}}} + {{else}} + {{title}} + {{/if}} {{#unless notRefreshable}} {{/unless}} diff --git a/client/res/templates/site/navbar.tpl b/client/res/templates/site/navbar.tpl index 2505ec4519..34787d0c43 100644 --- a/client/res/templates/site/navbar.tpl +++ b/client/res/templates/site/navbar.tpl @@ -12,7 +12,7 @@