Created
April 1, 2016 13:47
-
-
Save luisamaro0/6597084f2de1dc33cde7c014ea9f23a5 to your computer and use it in GitHub Desktop.
This file contains 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
<link rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css"> | |
<div class="row"> | |
<div class="panel panel-white post panel"> | |
<div class="post-heading"> | |
<div class="pull-left image"> | |
<img src="http://bootdey.com/img/Content/user_1.jpg" class="img-circle avatar" alt="user profile image"> | |
</div> | |
<div class="pull-left meta"> | |
<div class="title h5"> | |
<b> <%= improvement_action.user.email if improvement_action.user %> </b> | |
</div> | |
<h6 class="text-muted time"> <%= time_ago_in_words(improvement_action.created_at) %> </h6> </h6> | |
</div> | |
</div> | |
<div class="post-description"> | |
<p> <%= improvement_action.description %></p> | |
<div class="stats"> | |
<% if user_signed_in? %> <!-- sign_in user! --> | |
<% if current_user.liked? improvement_action %> <!-- selected button --> | |
<%= link_to like_improvement_action_path(improvement_action), class:"btn btn-default-selected stat-item", method: :put do %> | |
<span class="fa-selected fa-thumbs-up icon" aria-hidden="true"></span> | |
<span > <%= improvement_action.get_upvotes.size %></span> | |
<% end %> | |
<% else %> <!-- unselected button --> | |
<%= link_to like_improvement_action_path(improvement_action), class:"btn btn-default stat-item", method: :put do %> | |
<span class="fa fa-thumbs-up icon" aria-hidden="true"></span> | |
<span > <%= improvement_action.get_upvotes.size %></span> | |
<% end %> | |
<% end %> | |
<% if current_user.disliked? improvement_action %> <!-- selected button --> | |
<%= link_to unlike_improvement_action_path(improvement_action), class:"btn btn-default-selected stat-item", method: :put do %> | |
<span class="fa-selected fa-thumbs-down icon" aria-hidden="true"></span> | |
<span > <%= improvement_action.get_downvotes.size %></span> | |
<% end %> | |
<% else %> <!-- unselected button --> | |
<%= link_to unlike_improvement_action_path(improvement_action), class:"btn btn-default stat-item", method: :put do %> | |
<span class="fa fa-thumbs-down icon" aria-hidden="true"></span> | |
<span > <%= improvement_action.get_downvotes.size %></span> | |
<% end %> | |
<% end %> | |
<% else %> <!-- unsign_in user! --> | |
<%= link_to like_improvement_action_path(improvement_action), class:"btn btn-default stat-item", method: :put do %> | |
<span class="fa fa-thumbs-up icon" aria-hidden="true"></span> | |
<span > <%= improvement_action.get_upvotes.size %></span> | |
<% end %> | |
<%= link_to like_improvement_action_path(improvement_action), class:"btn btn-default stat-item", method: :put do %> | |
<span class="fa fa-thumbs-up icon" aria-hidden="true"></span> | |
<span > <%= improvement_action.get_upvotes.size %></span> | |
<% end %> | |
<% end %> | |
<button type="button" class="btn btn-default stat-item test1" data-toggle="collapse" data-parent="#accordion" href="<%= "#collapse_#{improvement_action.id}" %>"> | |
<span class="glyphicon glyphicon-pencil"></span> Comments (<%= improvement_action.comments.count %>) | |
</button> | |
<div id='<%= "collapse_#{improvement_action.id}" %>' class="panel-collapse collapse"> | |
<div class="panel-body"> | |
<div class="post-footer"> | |
<%= render partial: 'comments/form', locals: { improvement_action: improvement_action } %> | |
<br> | |
<% if improvement_action.comments.count ==1 %> | |
<h4><%= improvement_action.comments.count %> Comment </h4> | |
<% else %> | |
<h4><%= improvement_action.comments.count %> Comments </h4> | |
<% end %> | |
<%= render improvement_action.comments.order("created_at DESC") %> | |
</div> | |
</div> | |
</div> | |
<% if (user_signed_in? && (current_user.id == improvement_action.user_id) || current_user.try(:admin?)) %> | |
<%= link_to [improvement_action], data: { confirm: "Are you sure?" }, class: "btn btn-default stat-item ", style: "float: Right", method: :delete do%> | |
<span class="glyphicon glyphicon-trash"></span> Delete | |
<% end %> | |
<%= link_to edit_improvement_action_path(improvement_action), class: "btn btn-default stat-item", style: "float: Right" do %> | |
<span class="glyphicon glyphicon-pencil"></span> Edit | |
<% end %> | |
<% end %> | |
</div> | |
</div> | |
</div> | |
<hr> | |
</div> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment