Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code tidyup #1436

Merged
merged 3 commits into from
Feb 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions src/core/js/adapt.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ define([
if (settings.offset.left === 0) settings.axis = "y";

if (Adapt.get("_canScroll") !== false) {
// Trigger scrollTo plugin
$.scrollTo(selector, settings);
// Trigger scrollTo plugin
$.scrollTo(selector, settings);
}

// Trigger an event after animation
Expand All @@ -130,7 +130,7 @@ define([
Adapt.trigger(location+':scrolledTo', selector);
}, settings.duration+300);

}
};

Adapt.navigateToElement = function(selector, settings) {
// Allows a selector to be passed in and Adapt will navigate to this element
Expand All @@ -153,14 +153,14 @@ define([
// Then scrollTo element
Adapt.once('pageView:ready', function() {
_.defer(function() {
Adapt.scrollTo(selector, settings)
})
Adapt.scrollTo(selector, settings);
});
});

var shouldReplaceRoute = settings.replace || false;

Backbone.history.navigate('#/id/' + currentPage.get('_id'), {trigger: true, replace: shouldReplaceRoute});
}
};

Adapt.register = function(name, object) {
// Used to register components
Expand All @@ -179,7 +179,7 @@ define([
Adapt.componentStore[name] = object;

return object;
}
};

// Used to map ids to collections
Adapt.setupMapping = function() {
Expand All @@ -202,12 +202,12 @@ define([
}
}

}
};

Adapt.mapById = function(id) {
// Returns collection name that contains this models Id
return Adapt.mappedIds[id];
}
};

Adapt.findById = function(id) {

Expand All @@ -226,15 +226,15 @@ define([

return Adapt[collectionType]._byAdaptID[id][0];

}
};

Adapt.remove = function() {
Adapt.trigger('preRemove');
Adapt.trigger('remove');
_.defer(function() {
Adapt.trigger('postRemove');
})
}
});
};

return Adapt;

Expand Down
4 changes: 2 additions & 2 deletions src/core/js/models/adaptModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ define(function (require) {
this.set({
_isEnabled: true,
_isComplete: false,
_isInteractionComplete: false,
_isInteractionComplete: false
});
break;
case "soft":
Expand Down Expand Up @@ -135,7 +135,7 @@ define(function (require) {
var isInteractionComplete = false;

//number of mandatory children that must be complete or -1 for all
var requireCompletionOf = this.get("_requireCompletionOf")
var requireCompletionOf = this.get("_requireCompletionOf");

if (requireCompletionOf === -1) {
// Check if any return _isInteractionComplete:false
Expand Down
2 changes: 1 addition & 1 deletion src/core/js/models/lockingModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ define([

this.setLockState(attrName, false, {pluginName:pluginName, skipcheck: true});

var totalLockValue = this.getLockCount(attrName, {skipcheck: true})
var totalLockValue = this.getLockCount(attrName, {skipcheck: true});
//console.log(options.pluginName, "attempting to unlock", attrName, "on", this.get("_id"), "lockValue", totalLockValue, this._lockedAttributesValues[attrName]);
if (totalLockValue === 0) {
//console.log(options.pluginName, "unlocking", attrName, "on", this.get("_id"));
Expand Down
2 changes: 1 addition & 1 deletion src/core/js/notify.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ define(function(require) {
model: new NotifyModel(notifyObject)
});

};
}

});
16 changes: 8 additions & 8 deletions src/core/js/views/buttonsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,16 @@ define(function() {

onFeedbackMessageChanged: function(model, changedAttribute) {
if (changedAttribute && this.model.get('_canShowFeedback')) {
//enable feedback button
//enable feedback button
this.$('.buttons-feedback').a11y_cntrl_enabled(true);
} else {
//disable feedback button
this.$('.buttons-feedback').a11y_cntrl_enabled(false)
//disable feedback button
this.$('.buttons-feedback').a11y_cntrl_enabled(false);
}
},

onButtonStateChanged: function(model, changedAttribute) {
//use correct instead of complete to signify button state
//use correct instead of complete to signify button state
if (changedAttribute === 'correct') {
//disable submit button on correct (i.e. no model answer)
this.$('.buttons-action').a11y_cntrl_enabled(false);
Expand All @@ -97,12 +97,12 @@ define(function() {

switch (changedAttribute) {
case "showCorrectAnswer": case "hideCorrectAnswer":
//make model answer button inaccessible but enabled for visual users
// due to inability to represent selected incorrect/correct answers to a screen reader, may need revisiting
//make model answer button inaccessible but enabled for visual users
// due to inability to represent selected incorrect/correct answers to a screen reader, may need revisiting
this.$('.buttons-action').a11y_cntrl(false).html(buttonText).attr('aria-label', ariaLabel);
break;
default:
//enabled button, make accessible and update aria labels and text.
//enabled button, make accessible and update aria labels and text.
this.$('.buttons-action').a11y_cntrl_enabled(true).html(buttonText).attr('aria-label', ariaLabel);
}
}
Expand All @@ -122,7 +122,7 @@ define(function() {

updateAttemptsCount: function(model, changedAttribute) {
var isInteractionComplete = this.model.get('_isInteractionComplete');
var attemptsLeft = (this.model.get('_attemptsLeft')) ? this.model.get('_attemptsLeft') : this.model.get('_attempts')
var attemptsLeft = (this.model.get('_attemptsLeft')) ? this.model.get('_attemptsLeft') : this.model.get('_attempts');
var isCorrect = this.model.get('_isCorrect');
var shouldDisplayAttempts = this.model.get('_shouldDisplayAttempts');
var attemptsString;
Expand Down
2 changes: 1 addition & 1 deletion src/core/js/views/navigationView.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ define(function(require) {
},

render: function() {
var template = Handlebars.templates[this.template]
var template = Handlebars.templates[this.template];
this.$el.html(template(
{
_globals: Adapt.course.get("_globals"),
Expand Down