dashlet row actions
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* 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/record/list-expanded', ['views/record/list-expanded', 'crm:views/call/record/list'], function (Dep, List) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
actionSetHeld: function (data) {
|
||||
List.prototype.actionSetHeld.call(this, data);
|
||||
},
|
||||
|
||||
actionSetNotHeld: function (data) {
|
||||
List.prototype.actionSetNotHeld.call(this, data);
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,50 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* 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/record/row-actions/dashlet', ['views/record/row-actions/view-and-edit'], function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
getActions: function () {
|
||||
var actions = Dep.prototype.getActions.call(this);
|
||||
|
||||
if (this.options.acl.edit && !~['Held', 'Not Held'].indexOf(this.model.get('status'))) {
|
||||
actions.push({
|
||||
action: 'setHeld',
|
||||
label: 'Set Held',
|
||||
data: {
|
||||
id: this.model.id
|
||||
}
|
||||
});
|
||||
actions.push({
|
||||
action: 'setNotHeld',
|
||||
label: 'Set Not Held',
|
||||
data: {
|
||||
id: this.model.id
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return actions;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
@@ -19,7 +19,7 @@
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('Crm:Views.Call.Record.RowActions.Default', 'Views.Record.RowActions.Default', function (Dep) {
|
||||
Espo.define('crm:views/call/record/row-actions/default', 'views/record/row-actions/default', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('Crm:Views.Dashlets.Calls', 'Views.Dashlets.Abstract.RecordList', function (Dep) {
|
||||
Espo.define('crm:views/dashlets/calls', 'views/dashlets/abstract/record-list', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
@@ -27,6 +27,10 @@ Espo.define('Crm:Views.Dashlets.Calls', 'Views.Dashlets.Abstract.RecordList', fu
|
||||
|
||||
scope: 'Call',
|
||||
|
||||
listViewName: 'Crm:Call.Record.ListExpanded',
|
||||
|
||||
rowActionsView: 'Crm:Call.Record.RowActions.Dashlet',
|
||||
|
||||
defaultOptions: {
|
||||
sortBy: 'dateStart',
|
||||
asc: true,
|
||||
|
||||
@@ -27,6 +27,10 @@ Espo.define('Crm:Views.Dashlets.Meetings', 'Views.Dashlets.Abstract.RecordList',
|
||||
|
||||
scope: 'Meeting',
|
||||
|
||||
listViewName: 'Crm:Meeting.Record.ListExpanded',
|
||||
|
||||
rowActionsView: 'Crm:Meeting.Record.RowActions.Dashlet',
|
||||
|
||||
defaultOptions: {
|
||||
sortBy: 'dateStart',
|
||||
asc: true,
|
||||
|
||||
@@ -27,6 +27,10 @@ Espo.define('Crm:Views.Dashlets.Tasks', 'Views.Dashlets.Abstract.RecordList', fu
|
||||
|
||||
scope: 'Task',
|
||||
|
||||
listViewName: 'Crm:Task.Record.ListExpanded',
|
||||
|
||||
rowActionsView: 'Crm:Task.Record.RowActions.Dashlet',
|
||||
|
||||
defaultOptions: {
|
||||
sortBy: 'dateEnd',
|
||||
asc: true,
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* 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/meeting/record/list-expanded', ['views/record/list-expanded', 'crm:views/meeting/record/list'], function (Dep, List) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
actionSetHeld: function (data) {
|
||||
List.prototype.actionSetHeld.call(this, data);
|
||||
},
|
||||
|
||||
actionSetNotHeld: function (data) {
|
||||
List.prototype.actionSetNotHeld.call(this, data);
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,50 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* 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/meeting/record/row-actions/dashlet', ['views/record/row-actions/view-and-edit'], function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
getActions: function () {
|
||||
var actions = Dep.prototype.getActions.call(this);
|
||||
|
||||
if (this.options.acl.edit && !~['Held', 'Not Held'].indexOf(this.model.get('status'))) {
|
||||
actions.push({
|
||||
action: 'setHeld',
|
||||
label: 'Set Held',
|
||||
data: {
|
||||
id: this.model.id
|
||||
}
|
||||
});
|
||||
actions.push({
|
||||
action: 'setNotHeld',
|
||||
label: 'Set Not Held',
|
||||
data: {
|
||||
id: this.model.id
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return actions;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,34 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* 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/task/record/list-expanded', ['views/record/list-expanded', 'crm:views/task/record/list'], function (Dep, List) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
rowActionsView: 'Crm:Task.Record.RowActions.Default',
|
||||
|
||||
actionSetCompleted: function (data) {
|
||||
List.prototype.actionSetCompleted.call(this, data);
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -25,6 +25,28 @@ Espo.define('Crm:Views.Task.Record.List', 'Views.Record.List', function (Dep) {
|
||||
|
||||
rowActionsView: 'Crm:Task.Record.RowActions.Default',
|
||||
|
||||
actionSetCompleted: function (data) {
|
||||
var id = data.id;
|
||||
if (!id) {
|
||||
return;
|
||||
}
|
||||
var model = this.collection.get(id);
|
||||
if (!model) {
|
||||
return;
|
||||
}
|
||||
|
||||
model.set('status', 'Completed');
|
||||
|
||||
this.listenToOnce(model, 'sync', function () {
|
||||
this.notify(false);
|
||||
this.collection.fetch();
|
||||
}, this);
|
||||
|
||||
this.notify('Saving...');
|
||||
model.save();
|
||||
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* 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/task/record/row-actions/dashlet', 'views/record/row-actions/view-and-edit', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
getActions: function () {
|
||||
var actions = Dep.prototype.getActions.call(this);
|
||||
|
||||
if (this.options.acl.edit && !~['Completed', 'Canceled'].indexOf(this.model.get('status'))) {
|
||||
actions.push({
|
||||
action: 'setCompleted',
|
||||
label: 'Complete',
|
||||
data: {
|
||||
id: this.model.id
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return actions;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
@@ -17,15 +17,15 @@
|
||||
*
|
||||
* 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.Task.Record.RowActions.Default', 'Views.Record.RowActions.Default', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
|
||||
getActions: function () {
|
||||
var actions = Dep.prototype.getActions.call(this);
|
||||
|
||||
|
||||
if (this.options.acl.edit && !~['Completed', 'Canceled'].indexOf(this.model.get('status'))) {
|
||||
actions.push({
|
||||
action: 'setCompleted',
|
||||
@@ -35,9 +35,9 @@ Espo.define('Crm:Views.Task.Record.RowActions.Default', 'Views.Record.RowActions
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return actions;
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
@@ -31,6 +31,8 @@ Espo.define('Views.Dashlets.Abstract.RecordList', ['Views.Dashlets.Abstract.Base
|
||||
|
||||
listViewExpanded: 'Record.ListExpanded',
|
||||
|
||||
listViewName: null,
|
||||
|
||||
_template: '<div class="list-container">{{{list}}}</div>',
|
||||
|
||||
layoutType: 'expanded',
|
||||
@@ -62,7 +64,7 @@ Espo.define('Views.Dashlets.Abstract.RecordList', ['Views.Dashlets.Abstract.Base
|
||||
collection.maxSize = this.getOption('displayRecords');
|
||||
collection.where = searchManager.getWhere();
|
||||
|
||||
var viewName = (this.layoutType == 'expanded') ? this.listViewExpanded : this.listViewColumn;
|
||||
var viewName = this.listViewName || ((this.layoutType == 'expanded') ? this.listViewExpanded : this.listViewColumn);
|
||||
|
||||
this.listenToOnce(collection, 'sync', function () {
|
||||
this.createView('list', viewName, {
|
||||
|
||||
Reference in New Issue
Block a user