Skip to content

Commit

Permalink
New: Allow for instance template overrides (fixes #550)
Browse files Browse the repository at this point in the history
  • Loading branch information
guywillis authored Jun 7, 2024
1 parent 8912c1d commit 8f96c88
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/views/adaptView.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class AdaptView extends Backbone.View {
'change:_isHidden': this.toggleHidden,
'change:_isComplete': this.onIsCompleteChange
});
this.isJSX = (this.constructor.template || '').includes('.jsx');
this.isJSX = (this.template || this.constructor.template || '').includes('.jsx');
if (this.isJSX) {
this._classSet = new Set(_.result(this, 'className').trim().split(/\s+/));
this.listenTo(this.model, 'change', this.changed);
Expand Down Expand Up @@ -100,7 +100,7 @@ class AdaptView extends Backbone.View {
// Add globals
_globals: Adapt.course.get('_globals')
};
const Template = templates[this.constructor.template.replace('.jsx', '')];
const Template = templates[(this.template || this.constructor.template).replace('.jsx', '')];
this.updateViewProperties();
ReactDOM.render(<Template {...props} />, this.el);
}
Expand Down

0 comments on commit 8f96c88

Please sign in to comment.