orbit4-5/app/views/admin/groups/_post.html.erb

71 lines
2.6 KiB
Plaintext

<div class="group-post-item card clearfix wow bounceInUp" data-post-id="<%= post.id.to_s %>">
<div class="group-post-actions tool-tip-parent action">
<button class="group-post-dropdown-toggle toggle">
<span class="caret"></span>
</button>
<ul class="group-post-dropdown action-dropdown">
<% if post.author.to_s != current_user.id.to_s %>
<li class="group-post-dropdown-item">
<a href="#">
<i class="fa fa-flag-o"></i>
Flag inappropriate
</a>
</li>
<% else %>
<li class="group-post-dropdown-item">
<a href="/admin/post/<%= post.to_param %>/edit">
<i class="fa fa-pencil-square-o"></i>
Edit this post
</a>
</li>
<% end %>
<% if is_user_group_admin? || post.author.to_s == current_user.id.to_s%>
<li class="group-post-dropdown-item">
<a href="/admin/posts/<%= post.id.to_s %>" class="delete-post-btn">
<i class="fa fa-trash-o"></i>
Delete this post
</a>
</li>
<% end %>
</ul>
</div>
<div class="group-post-image-wrap">
<a href="/admin/posts/<%= post.to_param %>" class="group-post-link">
<% if !post.group_post_images.blank? %>
<img class="group-post-image" src="<%= post.group_post_images.first.image.thumb.url %>" alt="<%= post.title %>">
<% else %>
<img class="group-post-image" src="/assets/no-image.jpg" alt="Post image">
<% end %>
</a>
</div>
<div class="group-post-content-wrap">
<h3 class="group-post-title">
<a href="/admin/posts/<%= post.to_param %>" class="group-post-link">
<%= post.title %>
</a>
</h3>
<div class="group-post-content">
<% content = strip_tags post.content %>
<%= content[0..250] %>
<%= "..." if content.length > 350 %>
</div>
<div class="group-post-meta-wrap">
<span class="group-post-author">
<%
user = User.find(post.author) rescue nil
if !user.nil?
author = (user.member_profile.name == nil ? user.user_name : user.member_profile.name rescue "")
%>
<i class="group-post-author-icon icon-user"></i> <%= author %>
<% end %>
</span>
<div class="group-post-sub-wrap">
<span class="group-post-postdate">
<% date = DateTime.parse(post.created_at.to_s).strftime("%d %B %H:%M") %>
<i class="group-post-postdate-icon icon-time"></i> <%= date %>
</span>
</div>
</div>
</div>
</div>