-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4e87bce
commit 9094d4c
Showing
9 changed files
with
120 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,25 @@ | ||
'use strict'; | ||
var Gambler = require('../models/gambler'); | ||
|
||
exports.init = function(req, res){ | ||
res.render('gamblers/init'); | ||
}; | ||
|
||
exports.create = function(req, res){ | ||
var gambler = new Gambler(req.body); | ||
gambler.save(function(){ | ||
res.redirect('/gamblers'); | ||
}); | ||
}; | ||
|
||
exports.index = function(req, res){ | ||
Gambler.all(function(err, gamblers){ | ||
res.render('gamblers/index', {gamblers:gamblers}); | ||
}); | ||
}; | ||
|
||
exports.show = function(req, res){ | ||
Gambler.findById(req.params.id, function(gambler){ | ||
res.render('gamblers/show', {gambler:gambler}); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
extends ../shared/template | ||
block content | ||
h2.new New Gambler | ||
form(method='post', action='/gamblers') | ||
#newGambler | ||
label New Gambler | ||
input(name='name', type='text', placeholder='Bob Smith', autofocus=true) | ||
input(name='photo', type='text', placeholder='photo url') | ||
input(name='cash', type='number', placeholder='cash amount') | ||
//input(name='results.wins', type='text', placeholder='wins') | ||
//input(name='results.losses', type='text', placeholder='losses') | ||
#newSpouse | ||
label Spouse | ||
input(name='spouse.name', type='text', placeholder='Sarah Smith') | ||
input(name='spouse.photo', type='text', placeholder='photo url') | ||
#add | ||
button Add Gambler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
extends ../shared/template | ||
block content | ||
h2= gambler.name | ||
|
||
#newGambler | ||
#photo(style='background-image: url(#{gambler.photo});') | ||
#cash $#{gambler.cash} | ||
#spouse | ||
.name= #{gambler.spouse.name} | ||
.photo(style='background-image: url(#{gambler.spouse.photo});') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters