From ea11af18951e0a7f72e7f9fc6f240647365abccc Mon Sep 17 00:00:00 2001 From: BeritJanssen Date: Thu, 27 May 2021 15:44:50 +0200 Subject: [PATCH] ItemSummaryBlock listens for changes of css class and updates DOM accordingly --- frontend/src/item-summary-block/item-summary-block-view.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/src/item-summary-block/item-summary-block-view.ts b/frontend/src/item-summary-block/item-summary-block-view.ts index 1041868c..c35e9b5b 100644 --- a/frontend/src/item-summary-block/item-summary-block-view.ts +++ b/frontend/src/item-summary-block/item-summary-block-view.ts @@ -37,6 +37,7 @@ export default class ItemSummaryBlockView extends View { } else { this.listenToOnce(this.model, 'complete', this.render); } + this.listenTo(this.model, 'change:cssClass', this.updateClass); } _startListening(): void { @@ -49,6 +50,11 @@ export default class ItemSummaryBlockView extends View { render(): this { this.$el.html(this.template(this.model.attributes)); + this.updateClass(); + return this; + } + + updateClass(): this { let currentClass = this.model.get('cssClass'); if (this.setClass != currentClass) { this.$el.removeClass(this.setClass);