mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Avoid set self as parent card, for real
This commit is contained in:
parent
c5e72d1a2b
commit
97822f35fd
2 changed files with 21 additions and 28 deletions
|
|
@ -306,27 +306,27 @@ template(name="cardMorePopup")
|
||||||
h2 {{_ 'change-card-parent'}}
|
h2 {{_ 'change-card-parent'}}
|
||||||
label {{_ 'source-board'}}:
|
label {{_ 'source-board'}}:
|
||||||
select.js-field-parent-board
|
select.js-field-parent-board
|
||||||
|
if isTopLevel
|
||||||
|
option(value="none" selected) {{_ 'custom-field-dropdown-none'}}
|
||||||
|
else
|
||||||
|
option(value="none") {{_ 'custom-field-dropdown-none'}}
|
||||||
each boards
|
each boards
|
||||||
if isParentBoard
|
if isParentBoard
|
||||||
option(value="{{_id}}" selected) {{title}}
|
option(value="{{_id}}" selected) {{title}}
|
||||||
else
|
else
|
||||||
option(value="{{_id}}") {{title}}
|
option(value="{{_id}}") {{title}}
|
||||||
if isTopLevel
|
|
||||||
option(value="none" selected) {{_ 'custom-field-dropdown-none'}}
|
|
||||||
else
|
|
||||||
option(value="none") {{_ 'custom-field-dropdown-none'}}
|
|
||||||
|
|
||||||
label {{_ 'parent-card'}}:
|
label {{_ 'parent-card'}}:
|
||||||
select.js-field-parent-card
|
select.js-field-parent-card
|
||||||
if isTopLevel
|
if isTopLevel
|
||||||
option(value="none" selected) {{_ 'custom-field-dropdown-none'}}
|
option(value="none" selected) {{_ 'custom-field-dropdown-none'}}
|
||||||
else
|
else
|
||||||
|
option(value="none") {{_ 'custom-field-dropdown-none'}}
|
||||||
each cards
|
each cards
|
||||||
if isParentCard
|
if isParentCard
|
||||||
option(value="{{_id}}" selected) {{title}}
|
option(value="{{_id}}" selected) {{title}}
|
||||||
else
|
else
|
||||||
option(value="{{_id}}") {{title}}
|
option(value="{{_id}}") {{title}}
|
||||||
option(value="none") {{_ 'custom-field-dropdown-none'}}
|
|
||||||
br
|
br
|
||||||
| {{_ 'added'}}
|
| {{_ 'added'}}
|
||||||
span.date(title=card.createdAt) {{ moment createdAt 'LLL' }}
|
span.date(title=card.createdAt) {{ moment createdAt 'LLL' }}
|
||||||
|
|
|
||||||
|
|
@ -578,11 +578,14 @@ BlazeComponent.extendComponent({
|
||||||
BlazeComponent.extendComponent({
|
BlazeComponent.extendComponent({
|
||||||
onCreated() {
|
onCreated() {
|
||||||
this.currentCard = this.currentData();
|
this.currentCard = this.currentData();
|
||||||
|
this.parentBoard = new ReactiveVar(null);
|
||||||
this.parentCard = this.currentCard.parentCard();
|
this.parentCard = this.currentCard.parentCard();
|
||||||
if (this.parentCard) {
|
if (this.parentCard) {
|
||||||
this.parentBoard = this.parentCard.board();
|
const list = $('.js-field-parent-card');
|
||||||
|
list.val(this.parentCard._id);
|
||||||
|
this.parentBoard.set(this.parentCard.board()._id);
|
||||||
} else {
|
} else {
|
||||||
this.parentBoard = null;
|
this.parentBoard.set(null);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -601,9 +604,9 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
cards() {
|
cards() {
|
||||||
const currentId = Session.get('currentCard');
|
const currentId = Session.get('currentCard');
|
||||||
if (this.parentBoard) {
|
if (this.parentBoard.get()) {
|
||||||
return Cards.find({
|
return Cards.find({
|
||||||
boardId: this.parentBoard,
|
boardId: this.parentBoard.get(),
|
||||||
_id: {$ne: currentId},
|
_id: {$ne: currentId},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -613,8 +616,8 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
isParentBoard() {
|
isParentBoard() {
|
||||||
const board = this.currentData();
|
const board = this.currentData();
|
||||||
if (this.parentBoard) {
|
if (this.parentBoard.get()) {
|
||||||
return board._id === this.parentBoard;
|
return board._id === this.parentBoard.get();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
@ -628,11 +631,10 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
setParentCardId(cardId) {
|
setParentCardId(cardId) {
|
||||||
if (cardId === 'null') {
|
if (cardId) {
|
||||||
cardId = null;
|
|
||||||
this.parentCard = null;
|
|
||||||
} else {
|
|
||||||
this.parentCard = Cards.findOne(cardId);
|
this.parentCard = Cards.findOne(cardId);
|
||||||
|
} else {
|
||||||
|
this.parentCard = null;
|
||||||
}
|
}
|
||||||
this.currentCard.setParentId(cardId);
|
this.currentCard.setParentId(cardId);
|
||||||
},
|
},
|
||||||
|
|
@ -669,23 +671,14 @@ BlazeComponent.extendComponent({
|
||||||
'change .js-field-parent-board'(evt) {
|
'change .js-field-parent-board'(evt) {
|
||||||
const selection = $(evt.currentTarget).val();
|
const selection = $(evt.currentTarget).val();
|
||||||
const list = $('.js-field-parent-card');
|
const list = $('.js-field-parent-card');
|
||||||
list.empty();
|
|
||||||
if (selection === 'none') {
|
if (selection === 'none') {
|
||||||
this.parentBoard = null;
|
this.parentBoard.set(null);
|
||||||
list.prop('disabled', true);
|
|
||||||
} else {
|
} else {
|
||||||
this.parentBoard = Boards.findOne(selection);
|
subManager.subscribe('board', $(evt.currentTarget).val());
|
||||||
this.parentBoard.cards().forEach(function(card) {
|
this.parentBoard.set(selection);
|
||||||
list.append(
|
|
||||||
$('<option></option>').val(card._id).html(card.title)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
list.prop('disabled', false);
|
list.prop('disabled', false);
|
||||||
}
|
}
|
||||||
list.append(
|
this.setParentCardId(null);
|
||||||
`<option value='none' selected='selected'>${TAPi18n.__('custom-field-dropdown-none')}</option>`
|
|
||||||
);
|
|
||||||
this.setParentCardId('null');
|
|
||||||
},
|
},
|
||||||
'change .js-field-parent-card'(evt) {
|
'change .js-field-parent-card'(evt) {
|
||||||
const selection = $(evt.currentTarget).val();
|
const selection = $(evt.currentTarget).val();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue