Skip to content

Instantly share code, notes, and snippets.

@tomelm
Created February 19, 2013 19:20
Show Gist options
  • Save tomelm/4988957 to your computer and use it in GitHub Desktop.
Save tomelm/4988957 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Simple Blog</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<% for (i = posts.length-1; i>=0;i--){ %>
<div class='post'>
<a href='/posts/<%= i %>'><h2 style='display:inline'><%= posts[i].title %></h2></a>
<form method="POST" action='/posts/<%= i %>' style='display:inline'>
<input type='hidden' name='_method' value='delete' />
<input type='submit' value='delete post'/>
</form>
<p><%= posts[i].body %></p>
</div>
<% } %>
<h1>add a post</h1>
<form method='POST' action='/posts'>
<input name='title' id='title_field' placeholder='Post Title' /><br />
<textarea name='body' id='body_field'></textarea><br />
<input type='submit' value='add a post' />
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment