mirror of
https://github.com/wekan/wekan.git
synced 2025-12-18 00:10:13 +01:00
Card Details, description edit is now saved at popup
This commit is contained in:
parent
125c84b6b5
commit
fb66b84b58
5 changed files with 36 additions and 11 deletions
|
|
@ -1,5 +1,5 @@
|
|||
template(name="cardDetailsPopup")
|
||||
+cardDetails
|
||||
+cardDetails(popupCard)
|
||||
|
||||
template(name="cardDetails")
|
||||
section.card-details.js-card-details(class='{{#if cardMaximized}}card-details-maximized{{/if}}' class='{{#if isMiniScreen}}card-details-popup{{/if}}'): .card-details-canvas
|
||||
|
|
|
|||
|
|
@ -537,6 +537,13 @@ BlazeComponent.extendComponent({
|
|||
},
|
||||
}).register('cardDetails');
|
||||
|
||||
Template.cardDetailsPopup.helpers({
|
||||
popupCard() {
|
||||
const ret = Utils.getPopupCard();
|
||||
return ret;
|
||||
},
|
||||
});
|
||||
|
||||
BlazeComponent.extendComponent({
|
||||
template() {
|
||||
return 'exportCard';
|
||||
|
|
@ -587,16 +594,15 @@ Template.editCardSortOrderForm.onRendered(function () {
|
|||
// XXX Recovering the currentCard identifier form a session variable is
|
||||
// fragile because this variable may change for instance if the route
|
||||
// change. We should use some component props instead.
|
||||
docId: Session.get('currentCard'),
|
||||
docId: Utils.getCurrentCardId(),
|
||||
};
|
||||
}
|
||||
|
||||
close(isReset = false) {
|
||||
if (this.isOpen.get() && !isReset) {
|
||||
const draft = this.getValue().trim();
|
||||
if (
|
||||
draft !== Cards.findOne(Session.get('currentCard')).getDescription()
|
||||
) {
|
||||
let card = Utils.getCurrentCard();
|
||||
if (card && draft !== card.getDescription()) {
|
||||
UnsavedEdits.set(this._getUnsavedEditKey(), this.getValue());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,6 +148,8 @@ BlazeComponent.extendComponent({
|
|||
// If the card is already selected, we want to de-select it.
|
||||
// XXX We should probably modify the minicard href attribute instead of
|
||||
// overwriting the event in case the card is already selected.
|
||||
} else if (Utils.isMiniScreen()) {
|
||||
Session.set('popupCard', this.currentData()._id);
|
||||
} else if (Session.equals('currentCard', this.currentData()._id)) {
|
||||
evt.stopImmediatePropagation();
|
||||
evt.preventDefault();
|
||||
|
|
|
|||
|
|
@ -8,12 +8,8 @@ Blaze.registerHelper('currentBoard', () => {
|
|||
});
|
||||
|
||||
Blaze.registerHelper('currentCard', () => {
|
||||
const cardId = Session.get('currentCard');
|
||||
if (cardId) {
|
||||
return Cards.findOne(cardId);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
const ret = Utils.getCurrentCard();
|
||||
return ret;
|
||||
});
|
||||
|
||||
Blaze.registerHelper('currentList', () => {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,25 @@
|
|||
Utils = {
|
||||
getCurrentCardId() {
|
||||
let ret = Session.get('currentCard');
|
||||
if (!ret) {
|
||||
ret = Utils.getPopupCardId();
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
getPopupCardId() {
|
||||
const ret = Session.get('popupCard');
|
||||
return ret;
|
||||
},
|
||||
getCurrentCard() {
|
||||
const cardId = Utils.getCurrentCardId();
|
||||
const ret = Cards.findOne(cardId);
|
||||
return ret;
|
||||
},
|
||||
getPopupCard() {
|
||||
const cardId = Utils.getPopupCardId();
|
||||
const ret = Cards.findOne(cardId);
|
||||
return ret;
|
||||
},
|
||||
reload () {
|
||||
// we move all window.location.reload calls into this function
|
||||
// so we can disable it when running tests.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue