Skip to content

Commit

Permalink
Merge ed20b9a into 1e3afa4
Browse files Browse the repository at this point in the history
  • Loading branch information
Demilade Bamgbose committed Oct 20, 2016
2 parents 1e3afa4 + ed20b9a commit d504a3e
Show file tree
Hide file tree
Showing 27 changed files with 714 additions and 100 deletions.
17 changes: 8 additions & 9 deletions app/controllers/history.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ var mongoose = require('mongoose'),
exports.userHistory = function (req, res) {
History.find({players: req.params.id})
.populate('players', 'name')
.populate('winner', 'name')
.exec(function (err, history) {
.populate('winner', 'name') // history.player.name
.exec(function (err, history) { //try another .populate for winner
if (err) {
res.json(err);
}
Expand All @@ -15,17 +15,16 @@ exports.userHistory = function (req, res) {

exports.saveGameHistory = function (req, res) {
History.findOne({gameId: req.body.gameId}, function (err, history) {
if (!history) {
if (history) {
res.json(history);
}
else{
History.create(req.body, function (err, history) {
if(err){
res.json(err);
}
res.json(history);
});
} else{
res.json({
message: 'history already exists'
});
}
});
};
Expand All @@ -36,7 +35,7 @@ exports.deleteHistory = function (req, res) {
res.json(err);
}
res.json({
message: 'history deleted'
message: 'History deleted'
});
});
};
};
6 changes: 4 additions & 2 deletions app/views/includes/foot.jade
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ script(type='text/javascript', src='/lib/underscore/underscore-min.js')
script(type='text/javascript', src='/lib/bootstrap/dist/js/bootstrap.js')

//AngularJS
script(type='text/javascript', src='https://code.angularjs.org/1.1.5/angular.js')
script(type='text/javascript', src='https://code.angularjs.org/1.1.5/angular-resource.js')
script(type='text/javascript', src='/lib/angular/angular.min.js')
script(type='text/javascript', src='/lib/angular-resource/angular-resource.min.js')
script(type='text/javascript', src='/lib/angular-sanitize/angular-sanitize.min.js')
script(type='text/javascript', src='https://code.angularjs.org/1.1.5/angular-cookies.js')
script(type='text/javascript', src='/lib/angular-route/angular-route.min.js')

//Angular UI
script(type='text/javascript', src='/lib/angular-bootstrap/ui-bootstrap-tpls.js')
Expand Down
1 change: 1 addition & 0 deletions app/views/includes/head.jade
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ head

link(rel='stylesheet', href='/lib/bootstrap/dist/css/bootstrap.css')
link(rel='stylesheet', href='/css/landing.css')
link(rel='stylesheet', href='/css/game.css')


//if lt IE 9
Expand Down
2 changes: 2 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"angular": "^1.5.8",
"angular-mocks": "^1.5.8",
"angular-resource": "^1.5.8",
"angular-route": "^1.5.8",
"angular-sanitize": "^1.5.8",
"jasmine-jquery": "^2.1.1"
},
"exportsOverride": {
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ gulp.task('karma',function (done) {
});

gulp.task('sass', function(){
return gulp.src('public/css/common.scss')
return gulp.src('public/css/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('public/css/'));
});
Expand Down
19 changes: 15 additions & 4 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,24 @@ module.exports = function(config) {
'public/lib/angular-mocks/angular-mocks.js',
'./src/app/**/*.js',
'./src/app/*.js',
'public/js/*.js',
'public/js/**/*.js',
'public/js/controllers/history.ctr.js',
'public/js/services/history.fac.js',
'./src/test/**/*.js',
'public/views/*.tpl.html', // Ralph: load template file for the directives
'./src/test/*.js',
'test/app/*.test.js',
'test/app/**/*.test.js',
{pattern: 'test/app/response.json', watched: true, served: true, included: false}
],


// list of files to exclude
exclude: [
plugins: [
'karma-jasmine',
'karma-chrome-launcher',
'karma-coverage',
'karma-jasmine-html-reporter',
'karma-ng-html2js-preprocessor'
],

// test results reporter to use
Expand All @@ -48,7 +54,12 @@ module.exports = function(config) {
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'./src/app/**/*.js': ['coverage']
'./src/app/**/*.js': ['coverage'],
'public/views/*.tpl.html': 'ng-html2js' // Ralph: add ng-html2js to watch the template files
},

ngHtml2JsPreprocessor: {
stripPrefix: 'public' //Ralph: strip public away from the link of the template
},

coverageReporter: {
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
"karma-coverage": "^1.1.1",
"karma-jasmine": "^1.0.2",
"karma-jasmine-html-reporter": "^0.2.2",
"mocha": "^3.1.0"
"karma-ng-html2js-preprocessor": "^1.0.0",
"mocha": "^3.1.0",
"ng-html2js": "^3.0.0"
}
}
141 changes: 141 additions & 0 deletions public/css/game.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
.container {
width: 100%;
margin: 0; }

.game-cards {
height: 180px;
border: 1px solid black;
width: 130px;
margin: 50px;
background-color: black;
border-radius: 5px;
color: white; }
.game-cards p {
font-size: smaller; }

.players-cards {
height: 500px; }

.deck-of-black-cards {
box-shadow: -2px -2px 0 0 #000000;
border-top: 1px solid #ebebe0;
border-left: 1px solid #ebebe0;
line-height: 180px;
text-align: center;
font-size: 25px; }

.black-card {
padding: 10px;
height: 200px;
width: 150px;
font-size: medium; }
.black-card u {
position: relative;
content: '';
display: inline-block;
width: 25%;
text-decoration: none;
height: 1em;
border-bottom: 0.125em solid #ffffff;
margin-bottom: -0.125em; }

.start-game,
.awaiting-players {
margin-top: 100px; }

#start-game p {
margin-left: 10px; }

.question-holder {
padding-left: 100px; }

.black-cards-bar {
height: 300px;
border-bottom: 3px solid #eee; }

#white-cards-bar {
border-left: 3px solid #eee; }

.exit {
font-size: 18px; }

.timer-place {
margin-top: 69px; }

.time {
padding: 0 10%;
font-weight: bolder;
font-size: 72px; }

.avatar {
border-radius: 100%;
width: 50px;
height: 50px;
line-height: 50px;
background-color: #4074f5;
color: #ffffff; }

.name {
width: 100px;
margin: auto; }

.score {
border-radius: 100%;
width: 50px;
height: 50px;
line-height: 50px;
background-color: #a9a9a9; }

.flex-container {
background-color: #eeeeee;
border-radius: 50px;
box-shadow: 0 3px 1px #808080;
display: flex;
height: 50px;
margin: 30px 0;
max-width: 200px; }

.flex-item {
text-align: center; }

.white-cards-holder {
height: 500px; }
.white-cards-holder .game-cards {
background-color: #ffffff;
border: 1px solid #d6d6c2;
color: #000000;
float: left;
margin: 10px;
padding: 10px; }

.player-holder {
position: relative; }

.is-czar {
border-bottom-left-radius: 2px;
border-bottom-right-radius: 2px;
background-color: #3498db;
box-shadow: 0 2px 1px #808080;
font-weight: 800;
left: 70px;
padding: 2px;
position: absolute;
text-align: center;
top: 50px;
width: 49px; }

.instruction-text {
font-size: 20px;
font-weight: 800;
padding: 10px;
text-align: center;
width: auto; }

info-modal {
height: 100px;
left: 0;
margin: 0 auto;
position: fixed;
right: 0;
text-align: center;
top: 50px; }
Loading

0 comments on commit d504a3e

Please sign in to comment.