Skip to content

Instantly share code, notes, and snippets.

@minivan
Created May 23, 2015 00:40
Show Gist options
  • Save minivan/a6ea15e66d34e8fdc024 to your computer and use it in GitHub Desktop.
Save minivan/a6ea15e66d34e8fdc024 to your computer and use it in GitHub Desktop.
The app/views/posts/index.html.erb after the addition of two new fields
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">Azi tu Mâine eu</a>
</div>
<div class="navbar-collapse">
<ul class="nav navbar-nav">
<li>
<%= link_to("Postare nouă", new_post_path) %>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<%= link_to('Logout', destroy_user_session_path, :method => :delete) %>
</li>
</ul>
</div>
</div>
</nav>
<div class="container">
<ul>
<% Post.all.each do |post| %>
<div class="col-lg-4 col-md-6 col-sm-6 col-xs-12">
<div class="panel panel-default">
<div class="panel-heading">
<h5><%= post.title %></h5>
</div>
<div class="panel-body">
<%= cl_image_tag(post.image.path, width: 500, class: 'img-responsive img-thumbnail') %>
<p>
<%= post.body %>
</p>
</div>
<div class="panel-footer">
<span class="label label-default">
<%= "Posted by " + post.user.email %>
</span>
<% if current_user == post.user %>
<%= link_to(post_path(post), method: :delete, class: 'btn btn-danger btn-xs pull-right') do %>
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Delete
<% end %>
<% end %>
<%= link_to(edit_post_path(post), class: 'btn btn-default btn-xs pull-right') do %>
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Edit
<% end %>
</div>
</div>
</div>
</div>
<% end %>
</ul>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment