Skip to content

Commit

Permalink
finished add asset feature
Browse files Browse the repository at this point in the history
  • Loading branch information
abarnhard committed Aug 15, 2014
1 parent c4a55fe commit c364ee8
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/gamblers.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ exports.create = function(req, res){
};

exports.initAsset = function(req, res){
res.render('gamblers/init-asset');
res.render('gamblers/init-asset', {id:req.params.id});
};

exports.createAsset = function(req, res){
Expand Down
22 changes: 22 additions & 0 deletions app/views/gamblers/init-asset.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
extends ../shared/template
block content
h2 Create New Asset:
form(method='post', action='/gamblers/#{id}/assets/new')
table
tbody
tr
td Name
td: input(name='name', type='text', placeholder='Ronald Boberson')
tr
td Photo
td: input(name='photo', type='text', placeholder='http://www.example.com/boberson.jpg')
tr
td value
td: input(name='value', type='number', placeholder='1000')
tr
td(colspan='2'): button Add Asset


block scripts


24 changes: 24 additions & 0 deletions app/views/gamblers/show.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
extends ../shared/template
block content
h2 Check this person out:
h2: a(href='/gamblers/#{gambler._id.toString()}/assets/new') Add an Item
.gambler(data-gambler-id=gambler._id.toString())
.photo(style='background-image:url(#{gambler.photo});')
.stats
.name: a(href='/gamblers/#{gambler._id}')= gambler.name
.cash $#{gambler.cash.toFixed(2)}
.results
ul
li Wins: #{gambler.results.wins}
li Losses: #{gambler.results.losses}
.spouse(style='background-image:url(#{gambler.spouse.photo});')
p(class='#{gambler.isDivorced ? "divorced" : "married"}').spouse-name= gambler.isDivorced ? 'DIVORCED' : gambler.spouse.name
each asset in gambler.assets
.asset(style='background-image:url(#{asset.photo});')
.info
ul
li.asset-name= asset.name
li $#{asset.value.toFixed(2)}

block scripts

0 comments on commit c364ee8

Please sign in to comment.