Converted Gantt from js to Jade. Part 2.

Thanks to xet7 !
This commit is contained in:
Lauri Ojansivu 2025-12-29 15:26:16 +02:00
parent 2d3bef9033
commit 3af3c9a89d
3 changed files with 14 additions and 19 deletions

View file

@ -5,7 +5,7 @@ template(name="ganttView")
.gantt-view
h2 {{_ 'board-view-gantt'}}
if hasSelectedCard
+ganttCard
+ganttCard(selectedCard)
each weeks
table.gantt-table
thead

View file

@ -1,7 +1,2 @@
template(name="ganttCard")
.gantt-card-wrapper
.gantt-card-header
h3 {{_ 'card-details'}}
button.js-close-gantt-card.close-button ×
.gantt-card-content
+cardDetails(selectedCard)
+cardDetails(selectedCard)

View file

@ -6,23 +6,23 @@ BlazeComponent.extendComponent({
},
selectedCard() {
// Get the selected card from the parent ganttView template
const parentView = this.view.parentView;
if (parentView && parentView.templateInstance) {
const cardId = parentView.templateInstance().selectedCardId.get();
return cardId ? ReactiveCache.getCard(cardId) : null;
}
return null;
// The selected card is now passed as a parameter to the component
return this.currentData();
},
events() {
return [
{
'click .js-close-gantt-card'(event) {
// Find the parent ganttView template and clear the selected card
const parentView = this.view.parentView;
if (parentView && parentView.templateInstance) {
parentView.templateInstance().selectedCardId.set(null);
'click .js-close-card-details'(event) {
event.preventDefault();
// Find the ganttView template instance and clear selectedCardId
let view = Blaze.currentView;
while (view) {
if (view.templateInstance && view.templateInstance().selectedCardId) {
view.templateInstance().selectedCardId.set(null);
break;
}
view = view.parentView;
}
},
},