Created
February 19, 2013 21:07
-
-
Save tomelm/4989934 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<html> | |
<head> | |
<title>Simple Blog</title> | |
<link href="http://cdn.jsdelivr.net/bootstrap/2.3.0/css/bootstrap-responsive.min.css" rel="stylesheet" type="text/css"> | |
<style> | |
body { | |
margin: 0 auto; | |
width: 600px; | |
} | |
.post { | |
background: #eee; | |
border: 1px solid #ccc; | |
margin: 5px; | |
padding: 10px; | |
} | |
.add_post { | |
background: #eee; | |
border: 1px solid #ccc; | |
margin: 5px; | |
padding: 10px; | |
border-radius: 10px; | |
} | |
</style> | |
</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> | |
<% } %> | |
<div class="add_post"> | |
<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> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment