[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.
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -1052,6 +1052,8 @@ attributes:
|
||||
whether it should be possible to create records without switching to the
|
||||
form view. By default, ``quick_create`` is enabled when the Kanban view is
|
||||
grouped by many2one, selection, char or boolean fields, and disabled when not.
|
||||
``records_draggable``
|
||||
whether it should be possible to drag records when kanban is grouped. Default: true.
|
||||
|
||||
Set to ``true`` to always enable it, and to ``false`` to always disable it.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user