From c15fc89f52288bddf77fdb4e45cacc3cac13a807 Mon Sep 17 00:00:00 2001 From: yuri Date: Mon, 2 Feb 2015 15:35:35 +0200 Subject: [PATCH] refresh panel --- application/Espo/Resources/i18n/en_US/Global.json | 7 ++++--- .../crm/src/views/lead/record/detail-side.js | 3 ++- .../crm/src/views/record/panels/activities.js | 4 ++++ .../modules/crm/src/views/record/panels/tasks.js | 14 +++++++++----- frontend/client/res/templates/record/bottom.tpl | 10 +++++++++- frontend/client/res/templates/record/side.tpl | 10 +++++++++- frontend/client/src/views/record/detail-side.js | 5 +++++ frontend/client/src/views/record/edit-side.js | 12 ++++++------ .../client/src/views/record/panels/relationship.js | 4 ++++ frontend/client/src/views/record/panels/side.js | 10 +++++----- 10 files changed, 57 insertions(+), 22 deletions(-) diff --git a/application/Espo/Resources/i18n/en_US/Global.json b/application/Espo/Resources/i18n/en_US/Global.json index ea8b1840ff..22ee0b916f 100644 --- a/application/Espo/Resources/i18n/en_US/Global.json +++ b/application/Espo/Resources/i18n/en_US/Global.json @@ -57,8 +57,8 @@ "Unlinking...": "Unlinking...", "Posting...": "Posting...", "Username can not be empty!": "Username can not be empty!", - "Cache is not enabled": "Cache is not enabled", - "Cache has been cleared": "Cache has been cleared", + "Cache is not enabled": "Cache is not enabled", + "Cache has been cleared": "Cache has been cleared", "Rebuild has been done": "Rebuild has been done", "Saving...": "Saving...", "Modified": "Modified", @@ -167,7 +167,8 @@ "noRecordsUpdated": "No records were updated", "massRemoveResult": "{count} records have been removed", "massRemoveResultSingle": "{count} record has been removed", - "noRecordsRemoved": "No records were removed" + "noRecordsRemoved": "No records were removed", + "clickToRefresh": "Click to refresh" }, "boolFilters": { "onlyMy": "Only My", diff --git a/frontend/client/modules/crm/src/views/lead/record/detail-side.js b/frontend/client/modules/crm/src/views/lead/record/detail-side.js index a198e37942..070dc776c5 100644 --- a/frontend/client/modules/crm/src/views/lead/record/detail-side.js +++ b/frontend/client/modules/crm/src/views/lead/record/detail-side.js @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with EspoCRM. If not, see http://www.gnu.org/licenses/. - ************************************************************************/ + ************************************************************************/ Espo.define('Crm:Views.Lead.Record.DetailSide', 'Views.Record.DetailSide', function (Dep) { @@ -29,6 +29,7 @@ Espo.define('Crm:Views.Lead.Record.DetailSide', 'Views.Record.DetailSide', funct name: 'convertedTo', label: 'Converted To', view: 'Record.Panels.Side', + notRefreshable: true, options: { fields: [], mode: 'detail', diff --git a/frontend/client/modules/crm/src/views/record/panels/activities.js b/frontend/client/modules/crm/src/views/record/panels/activities.js index c515ce1c1e..830e56f628 100644 --- a/frontend/client/modules/crm/src/views/record/panels/activities.js +++ b/frontend/client/modules/crm/src/views/record/panels/activities.js @@ -287,6 +287,10 @@ Espo.define('Crm:Views.Record.Panels.Activities', 'Views.Record.Panels.Relations }); }, + + actionRefresh: function () { + this.collection.fetch(); + } }); }); diff --git a/frontend/client/modules/crm/src/views/record/panels/tasks.js b/frontend/client/modules/crm/src/views/record/panels/tasks.js index 9cbb0be770..625353e64a 100644 --- a/frontend/client/modules/crm/src/views/record/panels/tasks.js +++ b/frontend/client/modules/crm/src/views/record/panels/tasks.js @@ -116,7 +116,7 @@ Espo.define('Crm:Views.Record.Panels.Tasks', 'Views.Record.Panels.Relationship', this.$el.find('.list-container').html(this.translate('No Access')); this.$el.find('.button-container').remove(); return; - }; + }; this.getCollectionFactory().create('Task', function (collection) { this.collection = collection; @@ -139,11 +139,11 @@ Espo.define('Crm:Views.Record.Panels.Tasks', 'Views.Record.Panels.Relationship', }, function (view) { view.render(); }); - }.bind(this)); - this.collection.fetch(); + }.bind(this)); + this.collection.fetch(); }, this); }, - + actionCreateTask: function (data) { var self = this; var link = 'tasks'; @@ -166,7 +166,11 @@ Espo.define('Crm:Views.Record.Panels.Tasks', 'Views.Record.Panels.Relationship', }); }); }.bind(this)); - }, + }, + + actionRefresh: function () { + this.collection.fetch(); + } }); }); diff --git a/frontend/client/res/templates/record/bottom.tpl b/frontend/client/res/templates/record/bottom.tpl index bad11a3e76..6a10e2bbd3 100644 --- a/frontend/client/res/templates/record/bottom.tpl +++ b/frontend/client/res/templates/record/bottom.tpl @@ -18,7 +18,15 @@ {{/if}} -

{{title}}

+

+ {{#unless notRefreshable}} + + {{/unless}} + {{title}} + {{#unless notRefreshable}} + + {{/unless}} +

{{{var name ../this}}} diff --git a/frontend/client/res/templates/record/side.tpl b/frontend/client/res/templates/record/side.tpl index d454309e1c..b8e2d8617c 100644 --- a/frontend/client/res/templates/record/side.tpl +++ b/frontend/client/res/templates/record/side.tpl @@ -14,7 +14,15 @@ {{/if}}
-

{{translate label scope=../../scope}}

+

+ {{#unless notRefreshable}} + + {{/unless}} + {{title}} + {{#unless notRefreshable}} + + {{/unless}} +

{{/if}}
diff --git a/frontend/client/src/views/record/detail-side.js b/frontend/client/src/views/record/detail-side.js index 9e91b82573..d7237d51bd 100644 --- a/frontend/client/src/views/record/detail-side.js +++ b/frontend/client/src/views/record/detail-side.js @@ -98,6 +98,11 @@ if ('getActions' in view) { p.actions = this.filterActions(view.getActions()); } + if (p.label) { + p.title = this.translate(p.label, 'labels', this.scope); + } else { + p.title = view.title; + } }.bind(this)); }.bind(this)); }, diff --git a/frontend/client/src/views/record/edit-side.js b/frontend/client/src/views/record/edit-side.js index 645d00ef76..309761c3ca 100644 --- a/frontend/client/src/views/record/edit-side.js +++ b/frontend/client/src/views/record/edit-side.js @@ -17,12 +17,12 @@ * * You should have received a copy of the GNU General Public License * along with EspoCRM. If not, see http://www.gnu.org/licenses/. - ************************************************************************/ + ************************************************************************/ Espo.define('Views.Record.EditSide', 'Views.Record.DetailSide', function (Dep) { return Dep.extend({ - + mode: 'edit', panels: [ @@ -33,11 +33,11 @@ Espo.define('Views.Record.EditSide', 'Views.Record.DetailSide', function (Dep) { options: { fields: ['assignedUser', 'teams'], mode: 'edit', - } - } - ], + } + } + ], - }); + }); }); diff --git a/frontend/client/src/views/record/panels/relationship.js b/frontend/client/src/views/record/panels/relationship.js index ba6b3cd425..6515cf95f5 100644 --- a/frontend/client/src/views/record/panels/relationship.js +++ b/frontend/client/src/views/record/panels/relationship.js @@ -134,6 +134,10 @@ Espo.define('Views.Record.Panels.Relationship', ['Views.Record.Panels.Bottom', ' return []; }, + actionRefresh: function () { + this.collection.fetch(); + }, + actionEditRelated: function (id) { this.notify('Loading...'); this.createView('quickEdit', 'Modals.Edit', { diff --git a/frontend/client/src/views/record/panels/side.js b/frontend/client/src/views/record/panels/side.js index dc25e77b91..f97f0e782f 100644 --- a/frontend/client/src/views/record/panels/side.js +++ b/frontend/client/src/views/record/panels/side.js @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with EspoCRM. If not, see http://www.gnu.org/licenses/. - ************************************************************************/ + ************************************************************************/ Espo.define('Views.Record.Panels.Side', 'View', function (Dep) { @@ -35,9 +35,9 @@ Espo.define('Views.Record.Panels.Side', 'View', function (Dep) { }, mode: 'detail', - + actions: null, - + readOnly: false, setup: function () { @@ -49,7 +49,7 @@ Espo.define('Views.Record.Panels.Side', 'View', function (Dep) { } this.createFields(); }, - + getFieldList: function () { var fields = []; this.fields.forEach(function (item) { @@ -107,7 +107,7 @@ Espo.define('Views.Record.Panels.Side', 'View', function (Dep) { }, this); return fields; }, - + getActions: function () { return this.actions || []; },