mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
swimlane: insert the new swimlane after the one we clicked on
This commit is contained in:
parent
416b17062e
commit
c075187088
2 changed files with 22 additions and 2 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
const { calculateIndexData } = Utils;
|
||||||
|
|
||||||
BlazeComponent.extendComponent({
|
BlazeComponent.extendComponent({
|
||||||
editTitle(evt) {
|
editTitle(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
|
@ -26,18 +28,25 @@ Template.swimlaneActionPopup.events({
|
||||||
});
|
});
|
||||||
|
|
||||||
BlazeComponent.extendComponent({
|
BlazeComponent.extendComponent({
|
||||||
|
onCreated() {
|
||||||
|
this.currentSwimlane = this.currentData();
|
||||||
|
},
|
||||||
|
|
||||||
events() {
|
events() {
|
||||||
return [{
|
return [{
|
||||||
submit(evt) {
|
submit(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
||||||
|
const nextSwimlane = currentBoard.nextSwimlane(this.currentSwimlane);
|
||||||
const titleInput = this.find('.swimlane-name-input');
|
const titleInput = this.find('.swimlane-name-input');
|
||||||
const title = titleInput.value.trim();
|
const title = titleInput.value.trim();
|
||||||
|
const sortValue = calculateIndexData(this.currentSwimlane, nextSwimlane, 1);
|
||||||
|
|
||||||
if (title) {
|
if (title) {
|
||||||
Swimlanes.insert({
|
Swimlanes.insert({
|
||||||
title,
|
title,
|
||||||
boardId: Session.get('currentBoard'),
|
boardId: Session.get('currentBoard'),
|
||||||
// XXX we should insert the swimlane right after the caller
|
sort: sortValue.base,
|
||||||
sort: $('.swimlane').length,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
titleInput.value = '';
|
titleInput.value = '';
|
||||||
|
|
|
||||||
|
|
@ -351,6 +351,17 @@ Boards.helpers({
|
||||||
return Swimlanes.find({ boardId: this._id, archived: false }, { sort: { sort: 1 } });
|
return Swimlanes.find({ boardId: this._id, archived: false }, { sort: { sort: 1 } });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
nextSwimlane(swimlane) {
|
||||||
|
return Swimlanes.findOne({
|
||||||
|
boardId: this._id,
|
||||||
|
archived: false,
|
||||||
|
sort: { $gte: swimlane.sort },
|
||||||
|
_id: { $ne: swimlane._id },
|
||||||
|
}, {
|
||||||
|
sort: { sort: 1 },
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
hasOvertimeCards(){
|
hasOvertimeCards(){
|
||||||
const card = Cards.findOne({isOvertime: true, boardId: this._id, archived: false} );
|
const card = Cards.findOne({isOvertime: true, boardId: this._id, archived: false} );
|
||||||
return card !== undefined;
|
return card !== undefined;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue