Bill board feature up and running

This commit is contained in:
benmcmahon100
2016-04-12 21:59:57 +01:00
parent a27c5ccdd2
commit 2b2b359514
3 changed files with 70 additions and 28 deletions

View File

@@ -85,21 +85,44 @@ module.exports = function(app) {
}
function billBoard(req, res) {
if(req.user && typeof req.user.currentChallenge.challengeId !== "undefined"){
BillBoard.findOne({}, function(err, data){
if(err){
res.send({err: {type: "Error", message: "Database Error"}, data: null});
if (
req.user
&& typeof req.user.currentChallenge.challengeId !== 'undefined'
) {
BillBoard.findOne({}, function(err, data) {
if (err) {
res.send({
err: {
type: 'Error',
message: 'Database Error'
},
data: null
});
} else {
if (data.active) {
res.send({err: null, data: data.message});
res.send({
err: null,
data: data.message
});
} else {
res.send({err: {type: "warning", message: "Bill Board is not active"}, data: null});
res.send({
err: {
type: 'warning',
message: 'Bill Board is not active'
},
data: null
});
}
}
});
}
else {
res.send({err: {type: "warning", message: "User Not Signed In"}, data: null});
} else {
res.send({
err: {
type: 'warning',
message: 'User Not Signed In'
},
data: null
});
}
}

View File

@@ -20,7 +20,7 @@
div!= success.msg
.row.flashMessage
.col-xs-12
.alert.alert-success.fade.in
#billBoard.alert.alert-success.fade.in(style="display: none;")
button.close(type='button', data-dismiss='alert')
span.ion-close-circled#dismissBill
#billContent