Skip to content

Commit

Permalink
improve upon @lemonyandrew pull request
Browse files Browse the repository at this point in the history
  • Loading branch information
Quincy Larson committed Jun 20, 2015
1 parent 6078b54 commit ccc29b7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
11 changes: 7 additions & 4 deletions public/js/lib/coursewares/coursewaresJSFramework_0.0.6.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ editor.setOption("extraKeys", {
localBonfire: singleton object that contains properties and methods related to
dealing with the localStorage system.
The keys work off of the variable challenge_name to make unique identifiers per bonfire
Two extra functionalities:
Two extra functionalities:
Added anonymous version checking system incase of future updates to the system
Added keyup listener to editor(myCodeMirror) so the last update has been saved to storage
*/
Expand Down Expand Up @@ -81,7 +81,6 @@ localBonfire.updateStorage = function(){
}
}
localBonfire.updateTimeoutId = null;
console.log('updated!');
};
// ANONYMOUS 1 TIME UPDATE VERSION
(function(){
Expand All @@ -96,7 +95,7 @@ localBonfire.updateStorage = function(){
}
})();

editor.on('keyup', function(codMir, event){
editor.on('keyup', function(codMir, event){
window.clearTimeout(localBonfire.updateTimeoutId);
localBonfire.updateTimeoutId = window.setTimeout(localBonfire.updateStorage, localBonfire.updateWait);
});
Expand All @@ -106,6 +105,10 @@ if (attempts) {
attempts = 0;
}

var resetEditor = function() {
editor.setValue(allSeeds);
localBonfire.updateStorage();
};

var codeOutput = CodeMirror.fromTextArea(document.getElementById("codeOutput"), {
lineNumbers: false,
Expand Down
2 changes: 2 additions & 0 deletions public/js/main_0.0.2.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ $(document).ready(function() {

$('#story-submit').on('click', storySubmitButtonHandler);

$('#reset-button').on('click', resetEditor);

var commentSubmitButtonHandler = function commentSubmitButtonHandler() {
$('#comment-button').unbind('click');
var data = $('#comment-box').val();
Expand Down
17 changes: 16 additions & 1 deletion server/views/coursewares/showBonfire.jade
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ block content
if (user && user.sentSlackInvite)
.button-spacer
.btn-group.input-group.btn-group-justified
label.btn.btn-success#trigger-help-modal
i.fa.fa-refresh
|   Reset
label.btn.btn-success#trigger-help-modal
i.fa.fa-refresh
|   Reset
label.btn.btn-success#trigger-help-modal
i.fa.fa-medkit
|   Help
Expand Down Expand Up @@ -119,7 +125,7 @@ block content
form.code
.form-group.codeMirrorView
textarea#codeEditor(autofocus=true, style='display: none;')
script(src='/js/lib/coursewares/coursewaresJSFramework_0.0.5.js')
script(src='/js/lib/coursewares/coursewaresJSFramework_0.0.6.js')

#complete-courseware-dialog.modal(tabindex='-1')
.modal-dialog.animated.zoomIn.fast-animation
Expand All @@ -140,6 +146,15 @@ block content
= phrase
else
a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
#reset-modal.modal(tabindex='-1')
.modal-dialog.animated.fadeInUp.fast-animation
.modal-content
.modal-header.challenge-list-header Clear your code?
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
.modal-body
h3 This will restore your code editor to its original state.
a.btn.btn-lg.btn-info.btn-block#reset-button(href='#', data-dismiss='modal', aria-hidden='true') Clear my code
a.btn.btn-lg.btn-primary.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel
include ../partials/challenge-modals
script.
var MDNlinks = !{JSON.stringify(MDNlinks)};
Expand Down

0 comments on commit ccc29b7

Please sign in to comment.