Skip to content

Commit

Permalink
Update Post views
Browse files Browse the repository at this point in the history
  • Loading branch information
baileylo committed Feb 22, 2011
1 parent 0ff08f4 commit 29091cf
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 28 deletions.
33 changes: 13 additions & 20 deletions app/views/posts/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
<h1>Listing posts</h1>
<h1>Rails Blog Tutorial</h1>

<table>
<tr>
<th>Body</th>
<th>Title</th>
<th></th>
<th></th>
<th></th>
</tr>

<% @posts.each do |post| %>
<tr>
<td><%= post.body %></td>
<td><%= post.title %></td>
<td><%= link_to 'Show', post %></td>
<td><%= link_to 'Edit', edit_post_path(post) %></td>
<td><%= link_to 'Destroy', post, :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
<ul id="blog-list">
<% @posts.each do |post| %>
<li>
<h2 class="post-title"><%= link_to post.title, post %></h2>
<div class="post-body">
<%= post.body %>
</div>
</li>
<% end %>
</ul>

<br />

<% if user_signed_in? %>
<%= link_to 'New Post', new_post_path %>
<% end %>
18 changes: 10 additions & 8 deletions app/views/posts/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<p id="notice"><%= notice %></p>

<p>
<b>Body:</b>
<%= @post.body %>
</p>

<p>
<b>Title:</b>
<%= @post.title %>
<h1><%= @post.title %></h1>
<p class="meta">
Posted by: <%= @post.user.email %> On <%= @post.created_at %>
</p>
<div id="post-body">
<%= @post.body %>
</div id="post-body">



<%= link_to 'Edit', edit_post_path(@post) %> |
<% if user_signed_in? && @post.user == current_user %>
<%= link_to 'Edit', edit_post_path(@post) %>
<% end %>
<%= link_to 'Back', posts_path %>

0 comments on commit 29091cf

Please sign in to comment.