Use specific layout for map aside

Links in aside change parent location
This commit is contained in:
Berkeley Martinez
2016-01-14 16:03:55 -08:00
parent 7b53a108c3
commit 95dfd2304e
6 changed files with 155 additions and 106 deletions

View File

@ -264,7 +264,7 @@ $(document).ready(function() {
$('#nav-map-btn').on('click', () => { $('#nav-map-btn').on('click', () => {
if (!main.isMapAsideLoad) { if (!main.isMapAsideLoad) {
var mapAside = $('<iframe>'); var mapAside = $('<iframe>');
mapAside.attr('src', '/map-minimal'); mapAside.attr('src', '/map-aside');
$('.map-aside').append(mapAside); $('.map-aside').append(mapAside);
main.isMapAsideLoad = true; main.isMapAsideLoad = true;
} }

View File

@ -398,7 +398,7 @@ module.exports = function(app) {
); );
router.get('/map', showMap.bind(null, false)); router.get('/map', showMap.bind(null, false));
router.get('/map-minimal', showMap.bind(null, true)); router.get('/map-aside', showMap.bind(null, true));
router.get( router.get(
'/challenges/current-challenge', '/challenges/current-challenge',
redirectToCurrentChallenge redirectToCurrentChallenge
@ -618,15 +618,15 @@ module.exports = function(app) {
); );
} }
function showMap(showMinimal, { user }, res, next) { function showMap(showAside, { user }, res, next) {
getSuperBlocks$(challenge$, getCompletedChallengeIds(user)) getSuperBlocks$(challenge$, getCompletedChallengeIds(user))
.subscribe( .subscribe(
superBlocks => { superBlocks => {
res.render('map/show', { const view = showAside ? 'map/showAside' : 'map/show';
res.render(view, {
superBlocks, superBlocks,
title: 'A Map to Learn to Code and Become a Software Engineer', title: 'A Map to Learn to Code and Become a Software Engineer'
showMinimal
}); });
}, },
next next

View File

@ -0,0 +1,8 @@
doctype html
html(lang='en')
head
include partials/meta
include partials/stylesheets
body.map-aside-body
include partials/scripts
block content

View File

@ -3,14 +3,9 @@ html(lang='en')
head head
include partials/meta include partials/meta
include partials/stylesheets include partials/stylesheets
if showMinimal body.no-top-and-bottom-margins.full-screen-body-background
body.map-aside-body include partials/scripts
include partials/scripts include partials/navbar
block content include partials/flash
else block content
body.no-top-and-bottom-margins.full-screen-body-background include partials/footer
include partials/scripts
include partials/navbar
include partials/flash
block content
include partials/footer

View File

@ -1,95 +1,94 @@
extends ../layout-wide extends ../layout-wide
block content block content
if !showMinimal .row
.row .col-xs-12.col-md-6.col-md-offset-3
.col-xs-12.col-md-6.col-md-offset-3 ul
ul for superBlock in superBlocks
for superBlock in superBlocks h2= superBlock.name
h2= superBlock.name for challengeBlock in superBlock.blocks
for challengeBlock in superBlock.blocks .row
.row if (user)
if (user) .col-xs-11.col-sm-8.col-md-9
.col-xs-11.col-sm-8.col-md-9 li.map-p.negative-10
li.map-p.negative-10 | &nbsp;&nbsp;
| &nbsp;&nbsp; a(href='#' + challengeBlock.dashedName)= challengeBlock.name
a(href='#' + challengeBlock.dashedName)= challengeBlock.name if challengeBlock.markNew
if challengeBlock.markNew span.text-info.small &thinsp; &thinsp;
span.text-info.small &thinsp; &thinsp; strong
strong em NEW
em NEW if challengeBlock.isComingSoon
if challengeBlock.isComingSoon span.text-info.small &thinsp; &thinsp;
span.text-info.small &thinsp; &thinsp; strong
strong em Coming Soon
em Coming Soon else
else .hidden-xs.col-sm-3.col-md-2
.hidden-xs.col-sm-3.col-md-2 .col-xs-10.col-sm-8.col-md-9
.col-xs-10.col-sm-8.col-md-9 span.map-p.negative-10
span.map-p.negative-10 a(href='#' + challengeBlock.dashedName)= challengeBlock.name
a(href='#' + challengeBlock.dashedName)= challengeBlock.name if challengeBlock.markNew
if challengeBlock.markNew span.text-info.small &thinsp; &thinsp;
span.text-info.small &thinsp; &thinsp; strong
strong em NEW
em NEW if challengeBlock.isComingSoon
if challengeBlock.isComingSoon span.text-info.small &thinsp; &thinsp;
span.text-info.small &thinsp; &thinsp; strong
strong em Coming Soon
em Coming Soon h2 Full Stack Development Certification
h2 Full Stack Development Certification .row
.row .col-xs-12.col-sm-9.col-md-10
.col-xs-12.col-sm-9.col-md-10 li.map-p.negative-10
li.map-p.negative-10 | &nbsp;&nbsp;
| &nbsp;&nbsp; span.ion-locked.padded-ionic-icon
span.ion-locked.padded-ionic-icon | Greenfield Nonprofit Project 1
| Greenfield Nonprofit Project 1 .col-xs-12.col-sm-9.col-md-10
.col-xs-12.col-sm-9.col-md-10 li.map-p.negative-10
li.map-p.negative-10 | &nbsp;&nbsp;
| &nbsp;&nbsp; span.ion-locked.padded-ionic-icon
span.ion-locked.padded-ionic-icon | Greenfield Nonprofit Project 2
| Greenfield Nonprofit Project 2 .col-xs-12.col-sm-9.col-md-10
.col-xs-12.col-sm-9.col-md-10 li.map-p.negative-10
li.map-p.negative-10 | &nbsp;&nbsp;
| &nbsp;&nbsp; span.ion-locked.padded-ionic-icon
span.ion-locked.padded-ionic-icon | Legacy Nonprofit Project 1
| Legacy Nonprofit Project 1 .col-xs-12.col-sm-9.col-md-10
.col-xs-12.col-sm-9.col-md-10 li.map-p.negative-10
li.map-p.negative-10 | &nbsp;&nbsp;
| &nbsp;&nbsp; span.ion-locked.padded-ionic-icon
span.ion-locked.padded-ionic-icon | Legacy Nonprofit Project 2
| Legacy Nonprofit Project 2 .col-xs-12.col-sm-9.col-md-10
.col-xs-12.col-sm-9.col-md-10 li.map-p.negative-10
li.map-p.negative-10 | &nbsp;&nbsp;
| &nbsp;&nbsp; span.ion-locked.padded-ionic-icon
span.ion-locked.padded-ionic-icon | Claim your Full Stack Development Certification
| Claim your Full Stack Development Certification
h2 Coding Interview Preparation h2 Coding Interview Preparation
.row .row
.col-xs-12.col-sm-9.col-md-10 .col-xs-12.col-sm-9.col-md-10
li.map-p.negative-10 li.map-p.negative-10
| &nbsp;&nbsp; | &nbsp;&nbsp;
span.ion-locked.padded-ionic-icon span.ion-locked.padded-ionic-icon
| Whiteboard Coding Interview Training | Whiteboard Coding Interview Training
.col-xs-12.col-sm-9.col-md-10 .col-xs-12.col-sm-9.col-md-10
li.map-p.negative-10 li.map-p.negative-10
| &nbsp;&nbsp; | &nbsp;&nbsp;
span.ion-locked.padded-ionic-icon span.ion-locked.padded-ionic-icon
| Critical Thinking Interview Training | Critical Thinking Interview Training
.col-xs-12.col-sm-9.col-md-10 .col-xs-12.col-sm-9.col-md-10
li.map-p.negative-10 li.map-p.negative-10
| &nbsp;&nbsp; | &nbsp;&nbsp;
span.ion-locked.padded-ionic-icon span.ion-locked.padded-ionic-icon
| Mock Interview 1 | Mock Interview 1
.col-xs-12.col-sm-9.col-md-10 .col-xs-12.col-sm-9.col-md-10
li.map-p.negative-10 li.map-p.negative-10
| &nbsp;&nbsp; | &nbsp;&nbsp;
span.ion-locked.padded-ionic-icon span.ion-locked.padded-ionic-icon
| Mock Interview 2 | Mock Interview 2
.col-xs-12.col-sm-9.col-md-10 .col-xs-12.col-sm-9.col-md-10
li.map-p.negative-10 li.map-p.negative-10
| &nbsp;&nbsp; | &nbsp;&nbsp;
span.ion-locked.padded-ionic-icon span.ion-locked.padded-ionic-icon
| Mock Interview 3 | Mock Interview 3
hr hr
.row .row
.col-xs-12.col-md-6.col-md-offset-3 .col-xs-12.col-md-6.col-md-offset-3
for superBlock, index in superBlocks for superBlock, index in superBlocks

View File

@ -0,0 +1,47 @@
extends ../layout-map-aside
block content
.row
.col-xs-12.col-md-6.col-md-offset-3
for superBlock, index in superBlocks
for challengeBlock in superBlock.blocks
.row
a(href='#' name=challengeBlock.dashedName)
.spacer.negative-55
.row
h4.bold #{challengeBlock.name} (#{challengeBlock.time})
for challenge in challengeBlock.challenges
.col-xs-12.col-sm-9.col-md-10
if challenge.completed
p.text-primary.ion-checkmark-circled.padded-ionic-icon.negative-15(name="#{challenge.dashedName}") &nbsp;
a(href="/challenges/#{challenge.dashedName}" target='_parent')
= challenge.title
span.sr-only= " Complete"
else if (challenge.type === "bonfire")
p.ion-asterisk.padded-ionic-icon.negative-15(name="#{challenge.dashedName}") &nbsp;
a(name="#{challenge.dashedName}" target='_parent' href="/challenges/#{challenge.dashedName}" class=challenge.isComingSoon ? 'disabled' : '')
span= challenge.title
span.sr-only= " Incomplete"
if challenge.markNew
span.text-success.small &thinsp; &thinsp;
strong
em New
if challengeBlock.isComingSoon
span.text-success.small &thinsp; &thinsp;
strong
em Coming Soon
else
p.ion-ios-circle-outline.padded-ionic-icon.negative-15(name="#{challenge.dashedName}") &nbsp;
a(name="#{challenge.dashedName}" target='_parent' href="/challenges/#{challenge.dashedName}" class=challenge.isComingSoon ? 'disabled' : '')
span= challenge.title
span.sr-only= " Incomplete"
if challenge.markNew
span.text-success.small &thinsp; &thinsp;
strong
em New
if challengeBlock.isComingSoon
span.text-success.small &thinsp; &thinsp;
strong
em Coming Soon
if (index < superBlocks.length)
hr