Skip to content

Commit

Permalink
Created a template for the product CRUD operations
Browse files Browse the repository at this point in the history
  • Loading branch information
lmarkus committed Dec 5, 2013
1 parent f8e91c2 commit e9037fc
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions public/templates/products.dust
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{>"layouts/master" /}
{<title}
Product Editor
{/title}

{<body}
<h2>Product Editor</h2>
<main role="main">
<div class="mb2">
<fieldset>
<legend>Add a new product</legend>
<form method="POST" action="/products">
<input name="name" placeholder="Product Name"><br>
<input name="price" placeholder="Price"><br>
<input type="hidden" name="_csrf" value="{_csrf}">
<input type="submit" value="Save">
</form>
</fieldset>
</div>

<div class="products">
{?products}
<fieldset>
<legend>Product List</legend>
<ul class="nm-np inline">
{#products}
<li>
<form method="POST" action="/products">
<input type="hidden" name="item_id" value="{.id}">

<h3 class="nm-np">{.name}</h3>
<h4 class="nm-np">{.prettyPrice}</h4>
<h5 class="nm-np tiny">ID: {.id}</h5>

<input type="submit" value="Delete">
<!--If we don't at the Cross-Site Request Forgey token, this POST will be rejected-->
<input type="hidden" name="_csrf" value="{_csrf}">
<input type="hidden" name="_method" value="DELETE">
</form>
</li>
{/products}
</ul>
</fieldset>
{:else}
There are no products :(
{/products}
</div>
</main>
{/body}

0 comments on commit e9037fc

Please sign in to comment.