Skip to content

Commit

Permalink
enhanced templating
Browse files Browse the repository at this point in the history
  • Loading branch information
abarnhard committed Aug 5, 2014
1 parent fec7a3b commit deefec3
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 171 deletions.
18 changes: 2 additions & 16 deletions app/views/home/about.jade
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
doctype html
html
head
meta(charset='utf-8')
title eCommerce
link(rel='stylesheet', href='/css/style.css')
body
h1 eCommerce
nav
ul
li: a(href='/') Home
li: a(href='/about') About
li: a(href='/faq') Faq
li: a(href='/items/new') Add Item
li: a(href='/items') View Items

extends ../shared/template
block content
h2 About Page!

18 changes: 2 additions & 16 deletions app/views/home/faq.jade
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
doctype html
html
head
meta(charset='utf-8')
title eCommerce
link(rel='stylesheet', href='/css/style.css')
body
h1 eCommerce
nav
ul
li: a(href='/') Home
li: a(href='/about') About
li: a(href='/faq') Faq
li: a(href='/items/new') Add Item
li: a(href='/items') View Items

extends ../shared/template
block content
h2 Faq Page!

20 changes: 3 additions & 17 deletions app/views/home/index.jade
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
doctype html
html
head
meta(charset='utf-8')
title eCommerce
link(rel='stylesheet', href='/css/style.css')
body
h1 eCommerce
nav
ul
li: a(href='/') Home
li: a(href='/about') About
li: a(href='/faq') Faq
li: a(href='/items/new') Add Item
li: a(href='/items') View Items

h2 Home Page!
extends ../shared/template
block content
h2 Home Page!

70 changes: 28 additions & 42 deletions app/views/items/index.jade
Original file line number Diff line number Diff line change
@@ -1,44 +1,30 @@
doctype html
html
head
meta(charset='utf-8')
title eCommerce
link(rel='stylesheet', href='/css/style.css')
body
.container
h1 eCommerce
nav
ul
li: a(href='/') Home
li: a(href='/about') About
li: a(href='/faq') Faq
li: a(href='/items/new') Add Item
li: a(href='/items') View Items
.itemList
h1 Items
table
thead
tr
th Name
th Length
th Width
th Height
th Weight
th Qty
th MSRP
th % Off
th Cost
tbody
each item in items
tr(style='background-color:#{item.color};')
td: a(href='/items/#{item._id.toString()}')= item.name
td= item.dimensions.l
td= item.dimensions.w
td= item.dimensions.h
td= item.weight
td= item.quantity
td= item.msrp
td= item.percentOff
td= item.cost()
extends ../shared/template
block content
.itemList
h2 Items
table
thead
tr
th Name
th Length
th Width
th Height
th Weight
th Qty
th MSRP
th % Off
th Cost
tbody
each item in items
tr(style='background-color:#{item.color};')
td: a(href='/items/#{item._id.toString()}')= item.name
td= item.dimensions.l
td= item.dimensions.w
td= item.dimensions.h
td= item.weight
td= item.quantity
td= item.msrp
td= item.percentOff
td= item.cost()


60 changes: 23 additions & 37 deletions app/views/items/init.jade
Original file line number Diff line number Diff line change
@@ -1,38 +1,24 @@
doctype html
html
head
meta(charset='utf-8')
title eCommerce
link(rel='stylesheet', href='/css/style.css')
body
.container
h1 eCommerce
nav
ul
li: a(href='/') Home
li: a(href='/about') About
li: a(href='/faq') Faq
li: a(href='/items/new') Add Item
li: a(href='/items') View Items
#newItem
form(method='post', action='/items')
input(name='name', type='text', placeholder='iPad', autofocus=true)
br
input(name='dimensions[l]', type='number', placeholder='length')
br
input(name='dimensions[w]', type='number', placeholder='width')
br
input(name='dimensions[h]', type='number', placeholder='height')
br
input(name='weight', type='number', placeholder='weight')
br
input(name='color', type='color', placeholder='color')
br
input(name='quantity', type='number', placeholder='quantity')
br
input(name='msrp', type='number', placeholder='msrp')
br
input(name='percentOff', type='number', placeholder='percentOff')
br
button Add Item to Database
extends ../shared/template
block content
#newItem
form(method='post', action='/items')
input(name='name', type='text', placeholder='iPad', autofocus=true)
br
input(name='dimensions[l]', type='number', placeholder='length')
br
input(name='dimensions[w]', type='number', placeholder='width')
br
input(name='dimensions[h]', type='number', placeholder='height')
br
input(name='weight', type='number', placeholder='weight')
br
input(name='color', type='color', placeholder='color')
br
input(name='quantity', type='number', placeholder='quantity')
br
input(name='msrp', type='number', placeholder='msrp')
br
input(name='percentOff', type='number', placeholder='percentOff')
br
button Add Item to Database

72 changes: 29 additions & 43 deletions app/views/items/show.jade
Original file line number Diff line number Diff line change
@@ -1,46 +1,32 @@
doctype html
html
head
meta(charset='utf-8')
title eCommerce
link(rel='stylesheet', href='/css/style.css')
body
.container
h1 eCommerce
nav
ul
li: a(href='/') Home
li: a(href='/about') About
li: a(href='/faq') Faq
li: a(href='/items/new') Add Item
li: a(href='/items') View Items
#item
form(method='post', action='/items/#{item._id}')
input(type='hidden', name='_method', value='delete')
table
thead
tr
th Name
th Length
th Width
th Height
th Weight
th Qty
th MSRP
th % Off
th Cost
tbody
tr(style='background-color:#{item.color};')
td= item.name
td= item.dimensions.l
td= item.dimensions.w
td= item.dimensions.h
td= item.weight
td= item.quantity
td= item.msrp
td= item.percentOff
td= item.cost()
button Delete Item
extends ../shared/template
block content
#item
form(method='post', action='/items/#{item._id}')
input(type='hidden', name='_method', value='delete')
table
thead
tr
th Name
th Length
th Width
th Height
th Weight
th Qty
th MSRP
th % Off
th Cost
tbody
tr(style='background-color:#{item.color};')
td= item.name
td= item.dimensions.l
td= item.dimensions.w
td= item.dimensions.h
td= item.weight
td= item.quantity
td= item.msrp
td= item.percentOff
td= item.cost()
button Delete Item



18 changes: 18 additions & 0 deletions app/views/shared/template.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
doctype html
html
head
meta(charset='utf-8')
title Commerce
link(rel='stylesheet', href='/css/style.css')
body
.container
nav
ul
li: a(href='/') Home
li: a(href='/about') About
li: a(href='/faq') Faq
li: a(href='/items/new') Add Item
li: a(href='/items') View Items

block content

0 comments on commit deefec3

Please sign in to comment.