start making ux changes

This commit is contained in:
Quincy Larson
2015-04-23 23:46:58 -07:00
parent f049ff8f27
commit bf723b522b
9 changed files with 68 additions and 160 deletions

4
app.js
View File

@ -299,9 +299,9 @@ app.get('/nodeschool-challenges', function(req, res) {
app.get('/news', function(req, res) {
res.redirect(301, '/stories/hot');
});
app.get('/learn-to-code', resourcesController.about);
app.get('/learn-to-code', challengeMapController.challengeMap);
app.get('/about', function(req, res) {
res.redirect(301, '/learn-to-code');
res.redirect(301, '/map');
});
app.get('/signin', userController.getSignin);

View File

@ -52,7 +52,28 @@ module.exports = {
if (challenge.challengeType === 4) { return challenge }
});
if (!req.user.profile.picture || req.user.profile.picture === "https://s3.amazonaws.com/freecodecamp/favicons/apple-touch-icon-180x180.png") {
req.user.profile.picture = "https://s3.amazonaws.com/freecodecamp/camper-image-placeholder.png";
req.user.save();
}
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
var date1 = new Date("10/15/2014");
var date2 = new Date();
var timeDiff = Math.abs(date2.getTime() - date1.getTime());
var daysRunning = Math.ceil(timeDiff / (1000 * 3600 * 24));
User.count({}, function (err, camperCount) {
if (err) {
debug('User err: ', err);
return next(err);
}
res.render('challengeMap/show', {
daysRunning: daysRunning,
camperCount: numberWithCommas(camperCount),
title: "A map of all Free Code Camp's Challenges",
bonfires: bonfireList,
waypoints: waypoints,
@ -61,5 +82,6 @@ module.exports = {
completedBonfireList: completedBonfireList,
completedCoursewareList: completedCoursewareList
});
});
}
};

View File

@ -1,59 +0,0 @@
/**
* GET /
* Challenges.
*/
var _ = require('lodash'),
debug = require('debug')('freecc:cntr:challenges'),
Challenge = require('./../models/Challenge'),
resources = require('./resources');
var highestChallengeNumber = 53;
exports.returnNextChallenge = function(req, res) {
if (req.user) {
ch = req.user.challengesHash;
if (req.user.challengesHash[0] > 0) {
var max = Object.keys(ch).reduce(function(max, key) {
return (max === undefined || ch[key] > ch[max]) ? +key : max;
});
nextChallenge = max + 1;
res.redirect('challenges/' + nextChallenge);
} else {
res.redirect('challenges/0');
}
} else {
return res.redirect('../challenges/0');
}
};
exports.returnChallenge = function(req, res, next) {
var challengeNumber = parseInt(req.params.challengeNumber) || 0;
if (challengeNumber > highestChallengeNumber) {
req.flash('errors', {
msg: "It looks like you've either completed all the challenges we have available or requested a challenge we don't have."
});
return res.redirect('../challenges/0');
}
Challenge.find({}, null, { sort: { challengeNumber: 1 } }, function(err, c) {
if (err) {
debug('Challenge err: ', err);
return next(err);
}
res.render('challenges/show', {
title: 'Challenge: ' + c[challengeNumber].name,
name: c[challengeNumber].name,
video: c[challengeNumber].video,
time: c[challengeNumber].time,
steps: c[challengeNumber].steps,
number: challengeNumber,
cc: req.user ? req.user.challengesHash : undefined,
points: req.user ? req.user.points : undefined,
verb: resources.randomVerb(),
phrase: resources.randomPhrase(),
compliment: resources.randomCompliment(),
challenges: c
});
});
};

View File

@ -4,13 +4,6 @@ $(document).ready(function() {
ga('send', 'event', 'Challenge', 'load', challengeName);
}
// When introducing a new announcement, change the localStorage attribute
// and the HTML located in the footer
if (!localStorage || !localStorage.nodeSchoolAnnouncement) {
$('#announcementModal').modal('show');
localStorage.fccShowAnnouncement = "true";
}
var CSRF_HEADER = 'X-CSRF-Token';
var setCSRFToken = function(securityToken) {
@ -204,10 +197,6 @@ $(document).ready(function() {
}
});
$('.all-challenges').on('click', function() {
$('#show-all-dialog').modal('show');
});
$('#showAllButton').on('click', function() {
$('#show-all-dialog').modal('show');
});

View File

@ -5,10 +5,19 @@ block content
.panel-heading.text-center
h1 Challenge Map
.panel-body
.row
.col-xs-12.col-sm-12.col-md-10.col-md-offset-2
h3 Complete all of these challenges from top to bottom.
h3 Then we'll assign you to your first nonprofit project.
.col-xs-12
if (Math.random() > 0.99)
img.img-responsive.img-center(src='https://s3.amazonaws.com/freecodecamp/wide-social-banner-dino.png')
else
img.img-responsive.img-center(src='https://s3.amazonaws.com/freecodecamp/wide-social-banner.png')
.col-xs-12.col-md-8.col-md-offset-2
h2.text-center
span.text-primary #{camperCount}  
| campers have joined our community
br
| since we launched  
span.text-primary #{daysRunning}  
| days ago.
h2
span.fa.fa-flag
|   Waypoints (200 hours of lessons)
@ -92,7 +101,7 @@ block content
li
a(href="/challenges/#{basejump.name}")= basejump.name
h2
span.ion-ios-heart   Nonprofit Projects (800 hours of real-world experience)
span.ion-ios-heart   Nonprofit Projects (800 hours of real-world experience)*
h3.negative-15
ul
.row
@ -101,3 +110,23 @@ block content
.col-xs-12.col-sm-9.col-md-10
li
a(href="/nonprofits/directory") Browse our nonprofit projects
p * Complete all Waypoints, Bonfires, Ziplines and Basejumps to be assigned your first nonprofit project
//#announcementModal.modal(tabindex='-1')
// .modal-dialog
// .modal-content
// .modal-header.challenge-list-header We've updated our curriculum
// a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
// .modal-body
// h3.text-left We now have a 1,600 hour curriculum and tons of new challenges. Read more about it
// a(href='http://blog.freecodecamp.com', target='_blank') here
// | .
// a.btn.btn-lg.btn-info.btn-block(name='_csrf', value=_csrf, aria-hidden='true', href='http://blog.freecodecamp.com/', target='_blank') Take me to the blog post.
// a.btn.btn-lg.btn-primary.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Thanks for the heads-up!
//script.
// $(document).ready(function () {
// if (!localStorage || !localStorage.newCurriculum) {
// $('#announcementModal').modal('show');
// localStorage.campWideMeeting = "true";
// }
// });

View File

@ -1,50 +0,0 @@
extends ../layout
block content
.row
.col-sm-12.col-md-12.col-xs-12
.panel.panel-primary
.panel-heading.text-center
h1 #{name} (takes #{time} minutes)
script.
var challengeName = null;
.panel.panel-body
.embed-responsive.embed-responsive-16by9
iframe.embed-responsive-item(src='//player.vimeo.com/video/#{video}')
.col-xs-12.col-sm-10.col-sm-offset-1.col-md-8.col-md-offset-2
h3 Steps:
h4
ol
for step in steps
li!= step
.btn.btn-primary.btn-big.btn-block.completed-challenge I've completed this challenge
.ten-pixel-break
.btn.btn-success.btn-big.btn-block.all-challenges Show me all the challenges
#complete-challenge-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-challenge-button(name='_csrf', value=_csrf, aria-hidden='true') Take me to my next challenge
- 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
script.
$.ajax({
url: 'https://api-ssl.bitly.com/v3/shorten?access_token=75e7931a19befaafcf108021b6d597e554b2c5c3&longUrl=http%3A%2F%2Ffreecodecamp.com%2Fchallenges%2F' + !{JSON.stringify(number)} + '&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);
}
);

View File

@ -4,7 +4,6 @@
a.ion-social-twitch-outline(href="/twitch")  Twitch 
a.ion-social-github(href="http://github.com/freecodecamp", target='_blank')  Github  
a.ion-social-twitter(href="http://twitter.com/freecodecamp", target='_blank')  Twitter  
a.ion-information-circled(href="/learn-to-code")  About  
a.ion-locked(href="/privacy")  Privacy  
.col-xs-12.visible-xs.visible-sm
a.ion-speakerphone(href='http://blog.freecodecamp.com', target='_blank')
@ -15,7 +14,5 @@
span.sr-only Free Code Camp on GitHub
a.ion-social-twitter(href="http://twitter.com/freecodecamp", target='_blank')
span.sr-only Free Code Camp on Twitter
a.ion-information-circled(href="/learn-to-code")
span.sr-only About Free Code Camp
a.ion-locked(href="/privacy")
span.sr-only Free Code Camp's Privacy Policy

View File

@ -1,3 +1 @@
nav.navbar.navbar-default.navbar-fixed-top.nav-height
.container
include ./navbar

View File

@ -63,21 +63,3 @@ block content
.col-xs-12.github-and-twitter-button-text
html.
<iframe src="http://ghbtns.com/github-btn.html?user=freecodecamp&repo=freecodecamp&type=watch&count=true&size=large" height="30" width="170" frameborder="0" scrolling="0" style="width:170px; height: 30px;" allowTransparency="true"></iframe>
//#announcementModal.modal(tabindex='-1')
// .modal-dialog
// .modal-content
// .modal-header.challenge-list-header Camp-wide Meeting on Saturday at Noon EST
// a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
// .modal-body
// h3.text-left We'll live-stream some of Free Code Camp's new features, and campers will show what they're building. Live Saturday, March 28 at Noon EST on our &thinsp;
// a(href='http://twitch.tv/freecodecamp', target='_blank') Twitch.tv channel
// | .
// a.btn.btn-lg.btn-info.btn-block(name='_csrf', value=_csrf, aria-hidden='true', href='http://twitch.tv/freecodecamp', target='_blank') Take me to Twitch so I can follow Free Code Camp
// a.btn.btn-lg.btn-primary.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Thanks for the heads-up!
//script.
// $(document).ready(function () {
// if (!localStorage || !localStorage.campWideMeeting) {
// $('#announcementModal').modal('show');
// localStorage.campWideMeeting = "true";
// }
// });