Skip to content

Commit

Permalink
reintroduce _startListening in ItemSummaryBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
BeritJanssen committed May 27, 2021
1 parent ea11af1 commit 680d633
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions frontend/src/item-summary-block/item-summary-block-view.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { once, includes, extend } from 'lodash';
import { extend } from 'lodash';
import { ViewOptions as BViewOptions } from 'backbone';

import Model from '../core/model';
import View from '../core/view';
import { oa } from '../common-rdf/ns';
import Node from '../common-rdf/node';
import ldChannel from '../common-rdf/radio';
import FlatItem from '../common-adapters/flat-item-model';
import { getCssClassName, getLabel } from '../utilities/linked-data-utilities';

import itemSummaryBlockTemplate from './item-summary-block-template';

Expand All @@ -33,11 +29,10 @@ export default class ItemSummaryBlockView extends View {
this.model = new FlatItem(this.model);
}
if (this.model['complete']) {
this.render();
this._startListening();
} else {
this.listenToOnce(this.model, 'complete', this.render);
this.listenToOnce(this.model, 'complete', this._startListening);
}
this.listenTo(this.model, 'change:cssClass', this.updateClass);
}

_startListening(): void {
Expand All @@ -50,11 +45,6 @@ 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 680d633

Please sign in to comment.