From a7bd7e3729b420e62f74fb8b53b78c3bff9a1c14 Mon Sep 17 00:00:00 2001 From: Akira Laine Date: Tue, 2 Feb 2016 21:00:48 +1100 Subject: [PATCH] worked on video challenge superblock fixed rebase merge errors Fix videos route Fix hikes broken true/false fixed component name --- common/app/routes/Hikes/components/Hikes.jsx | 2 +- common/app/routes/Hikes/flux/Actions.js | 4 ++-- common/app/routes/Hikes/index.js | 2 +- .../{hikes => 04-video-challenges}/computer-basics.json | 0 .../{hikes => 04-video-challenges}/programming.json | 0 server/boot/a-react.js | 4 ++-- server/boot/challenge.js | 9 +++++++++ server/views/map/show.jade | 6 +++--- 8 files changed, 18 insertions(+), 9 deletions(-) rename seed/challenges/{hikes => 04-video-challenges}/computer-basics.json (100%) rename seed/challenges/{hikes => 04-video-challenges}/programming.json (100%) diff --git a/common/app/routes/Hikes/components/Hikes.jsx b/common/app/routes/Hikes/components/Hikes.jsx index 95aef149fd..ba5a324447 100644 --- a/common/app/routes/Hikes/components/Hikes.jsx +++ b/common/app/routes/Hikes/components/Hikes.jsx @@ -37,7 +37,7 @@ export default contain( componentWillMount() { const { appActions } = this.props; - appActions.setTitle('Hikes'); + appActions.setTitle('Videos'); }, renderMap(hikes) { diff --git a/common/app/routes/Hikes/flux/Actions.js b/common/app/routes/Hikes/flux/Actions.js index 2ca539c731..6ef70eff96 100644 --- a/common/app/routes/Hikes/flux/Actions.js +++ b/common/app/routes/Hikes/flux/Actions.js @@ -314,8 +314,8 @@ export default Actions({ location: { action: 'PUSH', pathname: currentHike && currentHike.dashedName ? - `/hikes/${ currentHike.dashedName }` : - '/hikes' + `/videos/${ currentHike.dashedName }` : + '/videos' } }; } diff --git a/common/app/routes/Hikes/index.js b/common/app/routes/Hikes/index.js index a53ac3193d..fa8ba7863d 100644 --- a/common/app/routes/Hikes/index.js +++ b/common/app/routes/Hikes/index.js @@ -7,7 +7,7 @@ import Hike from './components/Hike.jsx'; */ export default { - path: 'hikes', + path: 'videos', component: Hikes, childRoutes: [{ path: ':dashedName', diff --git a/seed/challenges/hikes/computer-basics.json b/seed/challenges/04-video-challenges/computer-basics.json similarity index 100% rename from seed/challenges/hikes/computer-basics.json rename to seed/challenges/04-video-challenges/computer-basics.json diff --git a/seed/challenges/hikes/programming.json b/seed/challenges/04-video-challenges/programming.json similarity index 100% rename from seed/challenges/hikes/programming.json rename to seed/challenges/04-video-challenges/programming.json diff --git a/server/boot/a-react.js b/server/boot/a-react.js index 41f7f7fe15..e3d7711839 100644 --- a/server/boot/a-react.js +++ b/server/boot/a-react.js @@ -15,8 +15,8 @@ const debug = debugFactory('freecc:react-server'); const routes = [ '/jobs', '/jobs/*', - '/hikes', - '/hikes/*' + '/videos', + '/videos/*' ]; const devRoutes = []; diff --git a/server/boot/challenge.js b/server/boot/challenge.js index 12d91accc5..70c0534969 100644 --- a/server/boot/challenge.js +++ b/server/boot/challenge.js @@ -223,6 +223,15 @@ function getSuperBlocks$(challenge$, completedChallenges) { const isComingSoon = _.every(blockArray, 'isComingSoon'); const isRequired = _.every(blockArray, 'isRequired'); + blockArray = blockArray.map(challenge => { + if (challenge.challengeType == 6 && challenge.type === 'hike') { + challenge.url = '/videos/' + challenge.dashedName; + } else { + challenge.url = '/challenges/' + challenge.dashedName; + } + return challenge; + }); + return { isBeta, isComingSoon, diff --git a/server/views/map/show.jade b/server/views/map/show.jade index cee817ede0..345761b46d 100644 --- a/server/views/map/show.jade +++ b/server/views/map/show.jade @@ -31,12 +31,12 @@ block content for challenge in challengeBlock.challenges if challenge.completed p.challenge-title.faded.text-primary.ion-checkmark-circled.padded-ionic-icon.negative-15(name="#{challenge.dashedName}") - a(href="/challenges/#{challenge.dashedName}" target='_parent') + a(href="#{challenge.url}" target='_parent') = challenge.title span.sr-only= " Complete" else if challenge.isRequired p.challenge-title.ion-ios-circle-outline.padded-ionic-icon.negative-15(name="#{challenge.dashedName}") - a(name="#{challenge.dashedName}" target='_parent' href="/challenges/#{challenge.dashedName}" class=challenge.isComingSoon ? 'disabled' : '') + a(name="#{challenge.dashedName}" target='_parent' href="#{challenge.url}" class=challenge.isComingSoon ? 'disabled' : '') span= challenge.title span.sr-only= " Incomplete" if challenge.markNew @@ -51,7 +51,7 @@ block content strong * else p.challenge-title.ion-ios-circle-outline.padded-ionic-icon.negative-15(name="#{challenge.dashedName}") - a(name="#{challenge.dashedName}" target='_parent' href="/challenges/#{challenge.dashedName}" class=challenge.isComingSoon ? 'disabled' : '') + a(name="#{challenge.dashedName}" target='_parent' href="#{challenge.url}" class=challenge.isComingSoon ? 'disabled' : '') span= challenge.title span.sr-only= " Incomplete" if challenge.markNew