diff options
| author | Aurélien Warnon <awa@odoo.com> | 2019-05-16 14:51:12 +0000 |
|---|---|---|
| committer | Aurélien Warnon <awa@odoo.com> | 2019-09-20 12:12:09 +0000 |
| commit | 869a5b83a57d8a4132507fe89e2bf59c8f5336db (patch) | |
| tree | b52c3485e6d9a1cb59a4ad1ca7ba1b8a62b1de84 /addons/web/static/src | |
| parent | f783a1cc94c877fc339aa096e427ada9c4d415c4 (diff) | |
[IMP] web: add capability to disable records drag/drop on kanban views
This commit adds a recordsDraggable option on the kanban view that allows to completly disable
the drag and drop feature.
This is a preliminary work for the social 'Feeds' kanban where the user should not be able to drag and drop posts.
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/js/views/kanban/kanban_column.js | 3 | ||||
| -rw-r--r-- | addons/web/static/src/js/views/kanban/kanban_view.js | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/kanban/kanban_column.js b/addons/web/static/src/js/views/kanban/kanban_column.js index b4aecd7a236..0facd099370 100644 --- a/addons/web/static/src/js/views/kanban/kanban_column.js +++ b/addons/web/static/src/js/views/kanban/kanban_column.js @@ -59,6 +59,7 @@ var KanbanColumn = Widget.extend({ this.KanbanRecord = options.KanbanRecord || KanbanRecord; // the KanbanRecord class to use this.records_editable = options.records_editable; this.records_deletable = options.records_deletable; + this.recordsDraggable = options.recordsDraggable; this.relation = options.relation; this.offset = 0; this.remaining = data.count - this.data_records.length; @@ -100,7 +101,7 @@ var KanbanColumn = Widget.extend({ defs.push(this._addRecord(this.data_records[i])); } - if (!config.device.isMobile) { + if (this.recordsDraggable && !config.device.isMobile) { // deactivate sortable in mobile mode. It does not work anyway, // and it breaks horizontal scrolling in kanban views. Someday, we // should find a way to use the touch events to make sortable work. diff --git a/addons/web/static/src/js/views/kanban/kanban_view.js b/addons/web/static/src/js/views/kanban/kanban_view.js index 62205a2fc46..d265ca6ae6b 100644 --- a/addons/web/static/src/js/views/kanban/kanban_view.js +++ b/addons/web/static/src/js/views/kanban/kanban_view.js @@ -65,6 +65,7 @@ var KanbanView = BasicView.extend({ archivable: archAttrs.archivable ? !!JSON.parse(archAttrs.archivable) : true, group_creatable: activeActions.group_create && !config.device.isMobile, quickCreateView: archAttrs.quick_create_view || null, + recordsDraggable: archAttrs.records_draggable ? !!JSON.parse(archAttrs.records_draggable) : true, hasProgressBar: !!progressBar, }; this.rendererParams.record_options = { |
