diff --git a/frontend/client/modules/crm/src/views/call/list.js b/frontend/client/modules/crm/src/views/call/list.js index 9d2c039feb..c26346a578 100644 --- a/frontend/client/modules/crm/src/views/call/list.js +++ b/frontend/client/modules/crm/src/views/call/list.js @@ -17,56 +17,55 @@ * * 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.Call.List', 'Views.List', function (Dep) { return Dep.extend({ - + actionSetHeld: function (data) { var id = data.id; if (!id) { return; - } + } var model = this.collection.get(id); if (!model) { return; } - + model.set('status', 'Held'); - + this.listenToOnce(model, 'sync', function () { this.notify(false); this.collection.fetch(); }, this); - + this.notify('Saving...'); - model.save(); - + model.save(); + }, - + actionSetNotHeld: function (data) { var id = data.id; if (!id) { return; - } + } var model = this.collection.get(id); if (!model) { return; } - + model.set('status', 'Not Held'); - + this.listenToOnce(model, 'sync', function () { this.notify(false); this.collection.fetch(); }, this); - + this.notify('Saving...'); - model.save(); - + model.save(); }, - + }); - + }); diff --git a/frontend/client/src/views/record/list.js b/frontend/client/src/views/record/list.js index a1c2a84e47..f69bfdf96d 100644 --- a/frontend/client/src/views/record/list.js +++ b/frontend/client/src/views/record/list.js @@ -132,18 +132,15 @@ Espo.define('Views.Record.List', 'View', function (Dep) { this.$el.find('.list > table tbody tr').removeClass('active'); } }, - 'click [data-action="quickEdit"]': function (e) { - var $target = $(e.currentTarget); - var id = $target.data('id'); - var data = $target.data(); - this.quickEdit(id, data); - - }, - 'click [data-action="quickRemove"]': function (e) { - var $target = $(e.currentTarget); - var id = $target.data('id'); - var data = $target.data(); - this.quickRemove(id, data); + 'click .action': function (e) { + $el = $(e.currentTarget); + var action = $el.data('action'); + var method = 'action' + Espo.Utils.upperCaseFirst(action); + if (typeof this[method] == 'function') { + var data = $el.data(); + this[method](data); + e.stopPropagation(); + } }, 'click .checkbox-dropdown [data-action="selectAllResult"]': function (e) { this.selectAllResult(); @@ -785,8 +782,11 @@ Espo.define('Views.Record.List', 'View', function (Dep) { }); }, - quickEdit: function (id, d) { + actionQuickEdit: function (d) { d = d || {} + var id = d.id; + if (!id) return; + if (this.allowQuickEdit) { this.notify('Loading...'); this.createView('quickEdit', 'Modals.Edit', { @@ -811,7 +811,11 @@ Espo.define('Views.Record.List', 'View', function (Dep) { return 'tr[data-id="' + id + '"]'; }, - quickRemove: function (id) { + actionQuickRemove: function (data) { + data = data || {} + var id = data.id; + if (!id) return; + var model = this.collection.get(id); if (!this.getAcl().checkModel(model, 'delete')) { this.notify('Access denied', 'error'); diff --git a/frontend/client/src/views/record/panels/bottom.js b/frontend/client/src/views/record/panels/bottom.js index f70a817961..5d6b37ed9f 100644 --- a/frontend/client/src/views/record/panels/bottom.js +++ b/frontend/client/src/views/record/panels/bottom.js @@ -35,6 +35,7 @@ Espo.define('Views.Record.Panels.Bottom', 'View', function (Dep) { if (typeof this[method] == 'function') { var data = $el.data(); this[method](data); + e.stopPropagation(); } } },