Skip to content

Commit

Permalink
ItemSummaryBlock listens for changes of css class and updates DOM acc…
Browse files Browse the repository at this point in the history
…ordingly
  • Loading branch information
BeritJanssen committed May 27, 2021
1 parent 88c75e6 commit ea11af1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions frontend/src/item-summary-block/item-summary-block-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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);
Expand Down

0 comments on commit ea11af1

Please sign in to comment.