Merge branch 'fix/theme-flash' of https://github.com/BerkeleyTrue/FreeCodeCamp into BerkeleyTrue-fix/theme-flash

Conflicts:
	common/models/user.js
This commit is contained in:
Quincy Larson
2016-05-12 21:28:29 -07:00
11 changed files with 173 additions and 49 deletions

View File

@@ -6,6 +6,10 @@ export default function globalLocals() {
if (req.csrfToken) {
res.expose({ token: res.locals._csrf }, 'csrf');
}
res.locals.theme = req.user && req.user.theme ||
req.cookies.theme ||
'default';
next();
};
}

View File

@@ -6,7 +6,7 @@ export function ifNoUserRedirectTo(url, message, type = 'errors') {
}
req.flash(type, {
msg: message || `You must be signed to go to ${path}`
msg: message || `You must be signed in to access ${path}`
});
return res.redirect(url);

View File

@@ -5,7 +5,7 @@ block content
h2.text-center Actions
.row
.col-xs-12
a.btn.btn-lg.btn-block.btn-primary.btn-link-social(class = "nightMode-btn") Night Mode
a#night-mode.btn.btn-lg.btn-block.btn-primary.btn-link-social Night Mode
.row
.col-xs-12
if (!user.isGithubCool)
@@ -133,4 +133,4 @@ block content
form(action='/account/delete', method='POST')
input(type='hidden', name='_csrf', value=_csrf)
button.btn.btn-danger.btn-block(type='submit')
| I am 100% sure I want to delete my account and all of my progress
| I am 100% sure I want to delete my account and all of my progress

View File

@@ -8,9 +8,9 @@ html(lang='en')
include partials/scripts
block content
else
body.no-top-and-bottom-margins
include partials/scripts
include partials/navbar
include partials/flash
block content
include partials/footer
body.no-top-and-bottom-margins(class=theme !== 'default' ? theme : '')
include partials/scripts
include partials/navbar
include partials/flash
block content
include partials/footer

View File

@@ -1,6 +1,6 @@
extends ../layout-wide
block content
.mapWrapper
.mapWrapper
.text-center.map-fixed-header
p Challenges required for certifications are marked with a *
.row.map-buttons
@@ -9,7 +9,7 @@ block content
.input-group
input#map-filter.form-control(type="text" placeholder="Type a challenge name" autocomplete="off" value="")
span.input-group-addon
i.fa.fa-search
i.fa.fa-search
hr
include ../partials/flash
#accordion.map-accordion
@@ -122,3 +122,4 @@ block content
p.challenge-title.disabled.text-primary.ion-locked.padded-ionic-icon.negative-15(name="Mock Interview #2") Mock Interview #2
p.challenge-title.disabled.text-primary.ion-locked.padded-ionic-icon.negative-15(name="Mock Interview #3") Mock Interview #3
.spacer
include ../partials/flash

View File

@@ -1,6 +1,6 @@
.container
.row.flashMessage.negative-30
.col-xs-12
.col-xs-12.col-sm-8.col-sm-offset-2.col-md-6.col-md-offset-3
if (messages.errors || messages.error)
.alert.alert-danger.fade.in
button.close(type='button', data-dismiss='alert')

View File

@@ -7,5 +7,11 @@ script.
ga('require', 'displayfeatures');
ga('send', 'pageview');
// Leave the below lines alone!
script.
(function(global) {
global.main = global.main || {};
global.main.isLoggedIn = !{JSON.stringify(!!user)};
global.main.userId = !{JSON.stringify(user && user.id || false)};
}(window))
script(src=rev('/js', 'vendor-main.js'))
script(src=rev('/js', 'main.js'))