Add the possibility to move tasks without drag and drop
This commit is contained in:
4
assets/js/app.min.js
vendored
4
assets/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
70
assets/js/components/task-move-position.js
Normal file
70
assets/js/components/task-move-position.js
Normal file
@@ -0,0 +1,70 @@
|
||||
Vue.component('task-move-position', {
|
||||
props: ['board', 'saveUrl'],
|
||||
template: '#template-task-move-position',
|
||||
data: function () {
|
||||
return {
|
||||
swimlaneId: 0,
|
||||
columnId: 0,
|
||||
position: 1,
|
||||
columns: [],
|
||||
tasks: [],
|
||||
positionChoice: 'before'
|
||||
}
|
||||
},
|
||||
ready: function () {
|
||||
this.columns = this.board[0].columns;
|
||||
this.columnId = this.columns[0].id;
|
||||
this.tasks = this.columns[0].tasks;
|
||||
},
|
||||
methods: {
|
||||
onChangeSwimlane: function () {
|
||||
var self = this;
|
||||
this.columnId = 0;
|
||||
this.position = 1;
|
||||
this.columns = [];
|
||||
this.tasks = [];
|
||||
this.positionChoice = 'before';
|
||||
|
||||
this.board.forEach(function(swimlane) {
|
||||
if (swimlane.id === self.swimlaneId) {
|
||||
self.columns = swimlane.columns;
|
||||
self.tasks = self.columns[0].tasks;
|
||||
self.columnId = self.columns[0].id;
|
||||
}
|
||||
});
|
||||
},
|
||||
onChangeColumn: function () {
|
||||
var self = this;
|
||||
this.position = 1;
|
||||
this.tasks = [];
|
||||
this.positionChoice = 'before';
|
||||
|
||||
this.columns.forEach(function(column) {
|
||||
if (column.id == self.columnId) {
|
||||
self.tasks = column.tasks;
|
||||
}
|
||||
});
|
||||
},
|
||||
onSubmit: function () {
|
||||
if (this.positionChoice == 'after') {
|
||||
this.position++;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
cache: false,
|
||||
url: this.saveUrl,
|
||||
contentType: "application/json",
|
||||
type: "POST",
|
||||
processData: false,
|
||||
data: JSON.stringify({
|
||||
"column_id": this.columnId,
|
||||
"swimlane_id": this.swimlaneId,
|
||||
"position": this.position
|
||||
}),
|
||||
complete: function() {
|
||||
window.location.reload(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -148,4 +148,8 @@ Kanboard.Popover.prototype.afterOpen = function() {
|
||||
this.app.datePicker();
|
||||
this.app.autoComplete();
|
||||
this.app.tagAutoComplete();
|
||||
|
||||
new Vue({
|
||||
el: '#popover-container'
|
||||
});
|
||||
};
|
||||
|
||||
13
assets/js/vendor.min.js
vendored
13
assets/js/vendor.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user