Skip to content

Commit

Permalink
Merge pull request #95 from adaptlearning/enhancement-967
Browse files Browse the repository at this point in the history
enhancement-967: divided into model and view
  • Loading branch information
moloko authored Mar 6, 2017
2 parents 944f2b7 + df92430 commit 358092c
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions js/adapt-contrib-gmcq.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
define(function(require) {
var Mcq = require('components/adapt-contrib-mcq/js/adapt-contrib-mcq');
var Adapt = require('coreJS/adapt');
define([
'coreJS/adapt',
'components/adapt-contrib-mcq/js/adapt-contrib-mcq'
], function(Adapt, Mcq) {

var Gmcq = Mcq.extend({
var Gmcq = Mcq.view.extend({

events: function() {

Expand Down Expand Up @@ -37,16 +38,7 @@ define(function(require) {
},

setupQuestion: function() {
// if only one answer is selectable, we should display radio buttons not checkboxes
this.model.set("_isRadio", (this.model.get("_selectable") == 1) );

this.model.set('_selectedItems', []);

this.setupQuestionItemIndexes();

this.setupRandomisation();

this.restoreUserAnswers();
Mcq.view.prototype.setupQuestion.call(this);

this.listenTo(Adapt, {
'device:changed': this.resizeImage,
Expand Down Expand Up @@ -106,8 +98,9 @@ define(function(require) {
template: 'gmcq'
});

Adapt.register("gmcq", Gmcq);

return Gmcq;
return Adapt.register("gmcq", {
view: Gmcq,
model: Mcq.model.extend({})
});

});

0 comments on commit 358092c

Please sign in to comment.