diff options
author | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2019-01-24 20:45:52 +0100 |
---|---|---|
committer | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2019-01-24 20:52:03 +0100 |
commit | c075187088e69d30db31489d75b22f991e1972ff (patch) | |
tree | 8740ca004cedfec888df4963cdc0e506023f07f0 /client/components | |
parent | 416b17062e57f215206e93a85b02ef9eb1ab4902 (diff) | |
download | wekan-c075187088e69d30db31489d75b22f991e1972ff.tar.gz wekan-c075187088e69d30db31489d75b22f991e1972ff.tar.bz2 wekan-c075187088e69d30db31489d75b22f991e1972ff.zip |
swimlane: insert the new swimlane after the one we clicked on
Diffstat (limited to 'client/components')
-rw-r--r-- | client/components/swimlanes/swimlaneHeader.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/client/components/swimlanes/swimlaneHeader.js b/client/components/swimlanes/swimlaneHeader.js index 72437ba4..632a0f50 100644 --- a/client/components/swimlanes/swimlaneHeader.js +++ b/client/components/swimlanes/swimlaneHeader.js @@ -1,3 +1,5 @@ +const { calculateIndexData } = Utils; + BlazeComponent.extendComponent({ editTitle(evt) { evt.preventDefault(); @@ -26,18 +28,25 @@ Template.swimlaneActionPopup.events({ }); BlazeComponent.extendComponent({ + onCreated() { + this.currentSwimlane = this.currentData(); + }, + events() { return [{ submit(evt) { evt.preventDefault(); + const currentBoard = Boards.findOne(Session.get('currentBoard')); + const nextSwimlane = currentBoard.nextSwimlane(this.currentSwimlane); const titleInput = this.find('.swimlane-name-input'); const title = titleInput.value.trim(); + const sortValue = calculateIndexData(this.currentSwimlane, nextSwimlane, 1); + if (title) { Swimlanes.insert({ title, boardId: Session.get('currentBoard'), - // XXX we should insert the swimlane right after the caller - sort: $('.swimlane').length, + sort: sortValue.base, }); titleInput.value = ''; |