Merge branch 'feature/commit' of https://github.com/freecodecamp/freecodecamp into feature/commit
This commit is contained in:
@ -56,6 +56,11 @@ export default function commit(app) {
|
||||
pledge
|
||||
);
|
||||
|
||||
router.get(
|
||||
'/commit/directory',
|
||||
renderDirectory
|
||||
);
|
||||
|
||||
router.post(
|
||||
'/commit/stop-commitment',
|
||||
sendNonUserToCommit,
|
||||
@ -167,6 +172,13 @@ export default function commit(app) {
|
||||
);
|
||||
}
|
||||
|
||||
function renderDirectory(req, res) {
|
||||
res.render('commit/directory', {
|
||||
title: 'Commit Directory',
|
||||
nonprofits
|
||||
});
|
||||
}
|
||||
|
||||
function completeCommitment(req, res, next) {
|
||||
const { user } = req;
|
||||
|
||||
@ -204,7 +216,7 @@ export default function commit(app) {
|
||||
msg = `No pledge found for user ${user.username}.`;
|
||||
}
|
||||
req.flash('errors', { msg });
|
||||
return res.redirect('/commit');
|
||||
return res.redirect(`/${user.username}`);
|
||||
},
|
||||
next
|
||||
);
|
||||
|
@ -161,6 +161,10 @@ block content
|
||||
.panel.panel-info
|
||||
.panel-heading.text-center Manage Your Account
|
||||
.panel-body
|
||||
.col-xs-12
|
||||
a.btn.btn-lg.btn-block.btn-warning.btn-link-social(href='/logout')
|
||||
span.ion-android-exit
|
||||
| Sign me out of Free Code Camp
|
||||
.col-xs-12
|
||||
a.btn.btn-lg.btn-block.btn-primary.btn-link-social(href='mailto:team@freecodecamp.com')
|
||||
span.ion-email
|
||||
@ -177,12 +181,8 @@ block content
|
||||
| Let other people see all my solutions
|
||||
.col-xs-12
|
||||
a.btn.btn-lg.btn-block.btn-success.btn-link-social(href='/commit')
|
||||
span.ion-android-exit
|
||||
span.ion-edit
|
||||
| Edit my pledge
|
||||
.col-xs-12
|
||||
a.btn.btn-lg.btn-block.btn-warning.btn-link-social(href='/logout')
|
||||
span.ion-android-exit
|
||||
| Sign me out of Free Code Camp
|
||||
.col-xs-12
|
||||
a.btn.btn-lg.btn-block.btn-danger.btn-link-social.confirm-deletion
|
||||
span.ion-trash-b
|
||||
|
21
server/views/commit/directory.jade
Normal file
21
server/views/commit/directory.jade
Normal file
@ -0,0 +1,21 @@
|
||||
extends ../layout
|
||||
block content
|
||||
.panel.panel-info
|
||||
.panel-heading.text-center Commit to one of these nonprofits
|
||||
.panel-body
|
||||
.row
|
||||
.col-xs-12.col-sm-6.col-sm-offset-3
|
||||
for nonprofit in nonprofits
|
||||
.spacer
|
||||
.row
|
||||
.text-center
|
||||
h2= nonprofit.displayName
|
||||
.row
|
||||
.col-xs-12.col-sm-8.col-sm-offset-2
|
||||
img.img-responsive.img-center(src=nonprofit.imgUrl)
|
||||
p= nonprofit.description
|
||||
.row
|
||||
.col-xs-12.col-sm-8.col-sm-offset-2
|
||||
a.text-center.btn.btn-primary.btn-lg.btn-block(href='/commit?nonprofit=#{nonprofit.name}') Go to #{nonprofit.displayName}
|
||||
.spacer
|
||||
|
@ -13,7 +13,7 @@ block content
|
||||
a(href='#{imgUrl}' data-lightbox='img-enlarge' alt='#{imgAlt}')
|
||||
img.img-responsive(src='#{imgUrl}' alt='#{imgAlt}')
|
||||
p= description
|
||||
a or browse our directory
|
||||
a(href='/commit/directory') or browse our directory
|
||||
.spacer
|
||||
form.form(name='commit')
|
||||
.hidden
|
||||
@ -45,17 +45,15 @@ block content
|
||||
.spacer
|
||||
.row
|
||||
.col-xs-12.col-sm-6.col-sm-offset-3.text-center
|
||||
a#commit-btn-submit.btn.btn-block.btn-lg.signup-btn(href='https://www.girldevelopit.com/donate' target='_blank') Commit (and open donate page)
|
||||
a#commit-btn-submit.btn.btn-block.btn-lg.signup-btn(href=donateUrl target='_blank') Commit (and open donate page)
|
||||
.button-spacer
|
||||
.spacer
|
||||
if pledge
|
||||
form.row(name='stop-pledge' action='/commit/stop-commitment' method='post')
|
||||
.col-xs-12.col-sm-6.col-sm-offset-3.text-center
|
||||
button.btn.btn-sm.btn-danger(name='submit' type='submit') Stop my pledge
|
||||
.spacer
|
||||
else
|
||||
.row
|
||||
.col-xs-12.col-sm-6.col-sm-offset-3.text-center
|
||||
h4.col-xs-12.col-sm-6.col-sm-offset-3.text-center
|
||||
a(href='/') Maybe later
|
||||
.spacer
|
||||
script.
|
||||
|
Reference in New Issue
Block a user