Skip to content

Commit 8f96c88

Browse files
authored
New: Allow for instance template overrides (fixes #550)
1 parent 8912c1d commit 8f96c88

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

js/views/adaptView.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class AdaptView extends Backbone.View {
2424
'change:_isHidden': this.toggleHidden,
2525
'change:_isComplete': this.onIsCompleteChange
2626
});
27-
this.isJSX = (this.constructor.template || '').includes('.jsx');
27+
this.isJSX = (this.template || this.constructor.template || '').includes('.jsx');
2828
if (this.isJSX) {
2929
this._classSet = new Set(_.result(this, 'className').trim().split(/\s+/));
3030
this.listenTo(this.model, 'change', this.changed);
@@ -100,7 +100,7 @@ class AdaptView extends Backbone.View {
100100
// Add globals
101101
_globals: Adapt.course.get('_globals')
102102
};
103-
const Template = templates[this.constructor.template.replace('.jsx', '')];
103+
const Template = templates[(this.template || this.constructor.template).replace('.jsx', '')];
104104
this.updateViewProperties();
105105
ReactDOM.render(<Template {...props} />, this.el);
106106
}

0 commit comments

Comments
 (0)