diff --git a/app.js b/app.js index 29a3c7966b..7f15966228 100644 --- a/app.js +++ b/app.js @@ -372,18 +372,6 @@ app.post( storyController.upvote ); -/** - * Challenge related routes - */ -app.get( - '/challenges/', - challengesController.returnNextChallenge -); -app.get( - '/challenges/:challengeNumber', - challengesController.returnChallenge -); - app.all('/account', passportConf.isAuthenticated); app.get('/account/api', userController.getAccountAngular); @@ -422,10 +410,10 @@ app.post('/completed-bonfire/', bonfireController.completedBonfire); * Courseware related routes */ -app.get('/coursewares/', coursewareController.returnNextCourseware); -app.get('/coursewares/getCoursewareList', coursewareController.showAllCoursewares); +app.get('/challenges/', coursewareController.returnNextCourseware); +app.get('/challenges/getCoursewareList', coursewareController.showAllCoursewares); app.get( - '/coursewares/:coursewareName', + '/challenges/:coursewareName', coursewareController.returnIndividualCourseware ); app.post('/completed-courseware/', coursewareController.completedCourseware); @@ -441,12 +429,6 @@ app.post('/account/delete', userController.postDeleteAccount); app.get('/account/unlink/:provider', userController.getOauthUnlink); app.get('/sitemap.xml', resourcesController.sitemap); -/** - * API examples routes. - * accepts a post request. the challenge id req.body.challengeNumber - * and updates user.challengesHash & user.challengesCompleted - * - */ /** diff --git a/controllers/courseware.js b/controllers/courseware.js index f830358af8..4d992d310e 100644 --- a/controllers/courseware.js +++ b/controllers/courseware.js @@ -23,7 +23,7 @@ exports.showAllCoursewares = function(req, res) { exports.returnNextCourseware = function(req, res) { if (!req.user) { - return res.redirect('../coursewares/start-our-challenges'); + return res.redirect('../challenges/learn-how-free-code-camp-works'); } var completed = req.user.completedCoursewares.map(function (elem) { return elem._id; @@ -50,10 +50,10 @@ exports.returnNextCourseware = function(req, res) { req.flash('errors', { msg: "It looks like you've completed all the courses we have available. Good job!" }); - return res.redirect('../coursewares/start-our-challenges'); + return res.redirect('../challenges/learn-how-free-code-camp-works'); } nameString = courseware.name.toLowerCase().replace(/\s/g, '-'); - return res.redirect('../coursewares/' + nameString); + return res.redirect('../challenges/' + nameString); }); }; @@ -71,14 +71,14 @@ exports.returnIndividualCourseware = function(req, res, next) { req.flash('errors', { msg: "404: We couldn't find a challenge with that name. Please double check the name." }); - return res.redirect('/coursewares') + return res.redirect('/challenges'); } courseware = courseware.pop(); // Redirect to full name if the user only entered a partial var dashedNameFull = courseware.name.toLowerCase().replace(/\s/g, '-'); if (dashedNameFull != dashedName) { - return res.redirect('../coursewares/' + dashedNameFull); + return res.redirect('../challenges/' + dashedNameFull); } var challengeType = { diff --git a/controllers/user.js b/controllers/user.js index 4b41af4c45..50ccf2ba47 100644 --- a/controllers/user.js +++ b/controllers/user.js @@ -297,7 +297,6 @@ exports.returnUser = function(req, res, next) { website3Link: user.portfolio.website3Link, website3Title: user.portfolio.website3Title, website3Image: user.portfolio.website3Image, - challenges: user.completedCoursewares, ch: user.challengesHash, calender: data, moment: moment diff --git a/public/css/main.less b/public/css/main.less index f022a1ac43..5b136853e5 100644 --- a/public/css/main.less +++ b/public/css/main.less @@ -864,8 +864,11 @@ iframe.iphone { } #cal-heatmap { - margin: 0 auto; - background-color: #fefefe; + width: 361px; +} + +.cal-heatmap-container { + background-color: #EEEEEE; } //uncomment this to see the dimensions of all elements outlined in red diff --git a/public/js/lib/coursewares/coursewaresHCJQFramework_v0.1.1.js b/public/js/lib/coursewares/coursewaresHCJQFramework_v0.1.1.js index 0234b5d314..d572181512 100644 --- a/public/js/lib/coursewares/coursewaresHCJQFramework_v0.1.1.js +++ b/public/js/lib/coursewares/coursewaresHCJQFramework_v0.1.1.js @@ -34,10 +34,6 @@ editor.setOption("extraKeys", { var spaces = Array(cm.getOption("indentUnit") + 1).join(" "); cm.replaceSelection(spaces); } - }, - "Ctrl-Enter": function() { - bonfireExecute(); - return false; } }); @@ -115,7 +111,7 @@ var allSeeds = ''; }); })(); -editor.setValue('test'); +editor.setValue(allSeeds); function doLinting () { editor.operation(function () { diff --git a/public/js/main.js b/public/js/main.js index 1fe3f29747..e108d8c9ac 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -118,7 +118,7 @@ $(document).ready(function() { }).success( function(res) { if (res) { - window.location.href = '/coursewares'; + window.location.href = '/challenges'; } } ); diff --git a/views/account/show.jade b/views/account/show.jade index fecdcae731..f762aba3c3 100644 --- a/views/account/show.jade +++ b/views/account/show.jade @@ -97,7 +97,7 @@ block content | Try it out .hidden-xs.col-sm-12 - #cal-heatmap + #cal-heatmap.img-center script(src="//d3js.org/d3.v3.min.js") script(src="//cdn.jsdelivr.net/cal-heatmap/3.3.10/cal-heatmap.min.js") link(rel="stylesheet", href="//cdn.jsdelivr.net/cal-heatmap/3.3.10/cal-heatmap.css") @@ -118,18 +118,4 @@ block content start: new Date().setDate(new Date().getDate() - 90), legendColors: ["#cccccc", "#215f1e"], legend: [1, 2, 3] - }); - - - .col-sm-12 - table.table.table-striped - thead - tr - th Challenge - th Date Finished - for challenge in challenges - tr - td= challenge.name - td= moment(challenge.completedDate, 'X').format("MMM DD, YYYY") - br - + }); \ No newline at end of file diff --git a/views/coursewares/showHTML.jade b/views/coursewares/showHTML.jade index f0e58001eb..8f17094831 100644 --- a/views/coursewares/showHTML.jade +++ b/views/coursewares/showHTML.jade @@ -18,8 +18,6 @@ block content script(src='/js/lib/codemirror/mode/xml/xml.js') script(src='/js/lib/codemirror/mode/css/css.js') script(src='/js/lib/codemirror/mode/htmlmixed/htmlmixed.js') - script(src="https://cdn.jsdelivr.net/ramda/0.10.0/ramda.min.js") - .row.courseware-height .col-xs-12.col-sm-12.col-md-3.col-lg-3 .well @@ -40,23 +38,19 @@ block content span.ion-arrow-up-b | Less information br - .btn.btn-info#showAllCoursewares - - if (cc) - a.btn.btn-primary.btn-lg.btn-block#complete-courseware + a.btn.btn-primary.btn-lg.btn-block#next-courseware-button | Go to my next challenge br | (ctrl + enter) script. var userLoggedIn = true; - - else a.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress - script. - var userLoggedIn = false; + script. + var userLoggedIn = false; br ul#testSuite.list-group - br script(type="text/javascript"). $('#next-courseware-button').attr('disabled', 'disabled'); @@ -64,60 +58,27 @@ block content var challengeSeed = !{JSON.stringify(challengeSeed)}; var passedCoursewareHash = !{JSON.stringify(coursewareHash)}; var challengeName = !{JSON.stringify(name)}; + var passedCoursewareName = challengeName; var prodOrDev = !{JSON.stringify(environment)}; var started = Math.floor(Date.now() / 1000); - var url = ''; - var dashed = !{JSON.stringify(dashedName)}; - console.log(dashed); - .col-xs-12.col-sm-12.col-md-5.col-lg-6 #mainEditorPanel form.code .form-group.codeMirrorView - - script(src='/js/lib/coursewares/coursewaresHCJQFramework_v0.1.1.js') textarea#codeEditor(autofocus=true, style='display: none;') - .col-md-4.col-lg-3 .hidden-xs.hidden-sm img.iphone-position(src="https://s3.amazonaws.com/freecodecamp/iphone6-frame.png") iframe.iphone#preview - - #complete-courseware-dialog.modal(tabindex='-1') - .modal-dialog.animated.zoomIn.fast-animation - .modal-content - .modal-header.challenge-list-header= compliment - a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') × - .modal-body - .text-center - .animated.zoomInDown.delay-half - span.completion-icon.ion-checkmark-circled.text-primary - - if (cc) - - a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block#next-courseware-button(name='_csrf', value=_csrf, ng-disabled='completedWithForm.$invalid && existingUser.length > 0') Go to my next challenge (ctrl + enter) - - if (points && points > 2) - a.animated.fadeIn.btn.btn-lg.btn-block.btn-twitter(target="_blank") - i.fa.fa-twitter   - = phrase - - - else - a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress - - #all-coursewares-dialog.modal(tabindex='-1') - .modal-dialog.animated.fadeInUp.fast-animation - .modal-content - .modal-header.all-list-header Challenges - a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') × - .modal-body - include ../partials/coursewares - script. - $.ajax({ - url: 'https://api-ssl.bitly.com/v3/shorten?access_token=75e7931a19befaafcf108021b6d597e554b2c5c3&longUrl=http%3A%2F%2Ffreecodecamp.com%2Fchallenges%2F' + dashed + '&format=txt' - }) - .success( - function(data) { - console.log(data); - url = "https://twitter.com/intent/tweet?text=I%20just%20#{verb}%20%40FreeCodeCamp%20Challenge:%20#{name}&url=" + data + "&hashtags=LearnToCode, JavaScript"; - $('.btn-twitter').attr('href', url); - } - ); + #complete-courseware-dialog.modal(tabindex='-1') + .modal-dialog.animated.zoomIn.fast-animation + .modal-content + .modal-header.challenge-list-header + = compliment + a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') × + .modal-body + .text-center + .animated.zoomInDown.delay-half + span.completion-icon.ion-checkmark-circled.text-primary + a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress + script(src="/js/lib/coursewares/coursewaresHCJQFramework_v0.1.1.js") \ No newline at end of file