Reset and execute update display and storage

This commit is contained in:
Berkeley Martinez
2015-11-19 21:51:38 -08:00
parent 4bdf1b2854
commit 74fa49cd75
10 changed files with 142 additions and 85 deletions

View File

@@ -1,4 +1,4 @@
window.common = (function({ $, common = { init: [] }}) {
window.common = (function({ $, Rx, common = { init: [] }}) {
common.ctrlEnterClickHandler = function ctrlEnterClickHandler(e) {
// ctrl + enter or cmd + enter
@@ -15,12 +15,6 @@ window.common = (function({ $, common = { init: [] }}) {
}
};
common.resetEditor = function resetEditor() {
common.editor.setValue(common.replaceSafeTags(common.seed));
common.executeChallenge(true);
common.codeStorage.updateStorage();
};
common.init.push(function($) {
var $marginFix = $('.innerMarginFix');
@@ -133,20 +127,18 @@ window.common = (function({ $, common = { init: [] }}) {
}
});
$('#submitButton').on('click', function() {
common.executeChallenge(true);
});
common.submitBtn$ = Rx.Observable.fromEvent($('#submitButton'), 'click');
if (common.editor) {
$('#reset-button').on('click', common.resetEditor);
}
common.resetBtn$ = Rx.Observable.fromEvent($('#reset-button'), 'click');
if (common.challengeName) {
window.ga('send', 'event', 'Challenge', 'load', common.challengeName);
}
$('#complete-courseware-dialog').on('hidden.bs.modal', function() {
common.editor.focus();
if (common.editor.focus) {
common.editor.focus();
}
});
$('#trigger-issue-modal').on('click', function() {