Incremental steps towards building the bonfire challenge views

This commit is contained in:
Nathan Leniz
2015-01-22 11:59:55 -05:00
parent 99dcbd16e5
commit 094b937148
7 changed files with 45 additions and 6 deletions

View File

@ -56,7 +56,7 @@ LINKEDIN_SECRET='LINKEDIN APP SECRET'
```bash
# Seed your database with the challenges
node seed_data/seed_challenges.js
node seed_data/seed.js
# start the application
gulp

View File

@ -64,6 +64,7 @@ exports.returnBonfire = function(req, res, next) {
publicTests: c[bonfireNumber].publicTests,
privateTests: c[bonfireNumber].privateTests,
challengeSeed: c[bonfireNumber].challengeSeed,
challengeEntryPoint: c[bonfireNumber].challengeEntryPoint,
cc: req.user ? req.user.bonfiresHash : undefined,
points: req.user ? req.user.points : undefined,

View File

@ -20,7 +20,7 @@ var bonfireSchema = new mongoose.Schema({
publicTests: Array,
privateTests: Array,
challengeSeed: String,
bonfireNumber: Number,
bonfireNumber: Number
});
module.exports = mongoose.model('Bonfire', bonfireSchema);

View File

@ -20,6 +20,7 @@
"assert.deepEqual(palindrome(\"nope\"), false);"
],
"challengeSeed": "function palindrome(str) {\n // Good luck!\n return true;\n}\n\n",
"challengeEntryPoint": "palindrome(!!!)",
"bonfireNumber": 1
}
]

39
views/bonfire/show.jade Normal file
View File

@ -0,0 +1,39 @@
extends ../layout
block content
.row
.col-sm-12.col-md-12.col-xs-12
.panel.panel-primary
.panel-heading.text-center #{name} (Level #{difficulty} bonfire)
.panel.panel-body
.col-xs-12.col-sm-10.col-sm-offset-1.col-md-8.col-md-offset-2
h3 Details
h4
ol
for sentence in description
li!= sentence
.ten-pixel-break
.btn.btn-success.btn-big.btn-block.all-challenges Show me all the challenges
#complete-dialog.modal(tabindex='-1')
.modal-dialog.animated.zoomIn.fast-animation
.modal-content
.modal-header.challenge-list-header Nicely done!
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
.modal-body
.text-center
.animated.zoomInDown.delay-half
span.landing-icon.ion-checkmark-circled.text-primary
- if (cc)
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block.next-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(href="https://twitter.com/intent/tweet?text=I%20just%20#{verb}%20Free%20Code%20Camp%20Challenge%20%23#{number}:%20#{name}&url=http%3A%2F%2Ffreecodecamp.com/challenges/#{number}&hashtags=learntocode, javascript" 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-challenges-dialog.modal(tabindex='-1')
.modal-dialog.animated.fadeInUp.fast-animation
.modal-content
.modal-header.challenge-list-header Challenges
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
.modal-body
include ../partials/bonfires

View File

@ -2,7 +2,5 @@ h3
ol(start='0')
for challenge in challenges
li
a(href="/challenges/#{challenge.challengeNumber}", class="#{ (cc && cc[challenge.challengeNumber] > 0) ? 'strikethrough' : '' }") #{challenge.name}
|   (#{challenge.time} mins)
a.btn.btn-lg.btn-primary.btn-block(href="/done-with-first-100-hours", class="#{ ((cc && cc[53] === 0) || (!cc)) ? 'disabled' : '' }") I'm done with all the challenges!
a(href="/bonfire/#{bonfire.bonfireNumber}", class="#{ (cc && cc[bonfire.bonfireNumber] > 0) ? 'strikethrough' : '' }") #{bonfire.name}
|   (Level #{bonfire.difficulty})