mirror of
https://github.com/wekan/wekan.git
synced 2025-04-23 13:37:09 -04:00
Merge pull request #4941 from helioguardabaxo/add-list-with-position
Added conditional to show after list field only if board has at least…
This commit is contained in:
commit
3fbf9ab98f
2 changed files with 17 additions and 8 deletions
|
@ -51,10 +51,11 @@ template(name="addListForm")
|
|||
+inlinedForm(autoclose=false)
|
||||
input.list-name-input.full-line(type="text" placeholder="{{_ 'add-list'}}"
|
||||
autocomplete="off" autofocus)
|
||||
| {{_ 'add-after-list'}}
|
||||
select.list-position-input.full-line
|
||||
each currentBoard.lists
|
||||
option(value="{{_id}}") {{title}}
|
||||
if currentBoard.getLastList
|
||||
| {{_ 'add-after-list'}}
|
||||
select.list-position-input.full-line
|
||||
each currentBoard.lists
|
||||
option(value="{{_id}}" selected=currentBoard.getLastList.title) {{title}}
|
||||
.edit-controls.clearfix
|
||||
button.primary.confirm(type="submit") {{_ 'save'}}
|
||||
.fa.fa-times-thin.js-close-inlined-form
|
||||
|
|
|
@ -256,12 +256,20 @@ BlazeComponent.extendComponent({
|
|||
{
|
||||
submit(evt) {
|
||||
evt.preventDefault();
|
||||
const lastList = this.currentBoard.getLastList();
|
||||
const titleInput = this.find('.list-name-input');
|
||||
const title = titleInput.value.trim();
|
||||
const positionInput = this.find('.list-position-input');
|
||||
const position = positionInput.value.trim();
|
||||
const ret = Lists.findOne({ boardId: Session.get('currentBoard'), _id: position, archived: false })
|
||||
const sortIndex = JSON.stringify(ret['sort'])
|
||||
let sortIndex = 0
|
||||
if (lastList) {
|
||||
const positionInput = this.find('.list-position-input');
|
||||
const position = positionInput.value.trim();
|
||||
const ret = Lists.findOne({ boardId: Session.get('currentBoard'), _id: position, archived: false })
|
||||
sortIndex = parseInt(JSON.stringify(ret['sort']))
|
||||
sortIndex = sortIndex+1
|
||||
} else {
|
||||
sortIndex = Utils.calculateIndexData(lastList, null).base;
|
||||
}
|
||||
|
||||
if (title) {
|
||||
Lists.insert({
|
||||
title,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue