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

135 lines
6.4 KiB
Plaintext
Raw Normal View History

2015-03-31 07:51:04 +00:00
<% content_for :page_specific_css do -%>
<%= stylesheet_link_tag "lib/group/group-main" %>
<%= stylesheet_link_tag "//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" %>
<%= stylesheet_link_tag "//cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.6/animate.min.css" %>
2015-03-31 07:51:04 +00:00
<% end -%>
<% content_for :page_specific_javascript do -%>
<%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/jquery.cycle2/20140415/jquery.cycle2.min.js" %>
2015-04-14 07:18:58 +00:00
<%= javascript_include_tag "lib/jquery.form" %>
2015-04-14 07:31:41 +00:00
<%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/jquery.cycle2/20140415/jquery.cycle2.center.min.js" %>
<%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/wow/1.1.2/wow.min.js" %>
2015-04-14 07:31:41 +00:00
<%= javascript_include_tag "group.js" %>
2015-03-31 07:51:04 +00:00
<% end -%>
<article class="group-show-post wrapper">
<ul class="group-page-pagenation breadcrumb">
2015-04-28 14:24:25 +00:00
<li><a href="<%= admin_groups_path %>">My Groups</a> <span class="divider">/</span></li>
<li><a href="<%= admin_group_path(@group) %>"><%= @group.title %></a> <span class="divider">/</span></li>
<li class="active"><%= @post.title %></li>
</ul>
<header class="group-show-post-meta">
<div class="group-show-post-heading-wrap clearfix">
<h2 class="group-show-post-title"><%= @post.title %></h2>
<div class="group-show-post-avatar-wrap">
<a class="group-show-post-avatar-username-toggle tool-tip-parent" href="#">
<%
user = User.find(@post.author) rescue nil
if !user.nil?
2015-04-14 07:18:58 +00:00
author = (user.member_profile.name == nil ? user.user_name : user.member_profile.name rescue "")
avatar = (!user.member_profile.avatar.nil? ? user.member_profile.avatar.thumb.url : "/assets/member-pic.png" rescue "/assets/member-pic.png")
end
%>
<img class="group-show-post-avatar" src="<%= avatar %>" alt="">
<span class="group-show-post-username tool-tip"><%= author %></span>
2015-03-31 07:51:04 +00:00
</a>
</div>
</div>
<div class="group-show-post-sub-wrap">
<span class="group-show-post-postdate">
2015-04-28 14:24:25 +00:00
<% date = DateTime.parse(@post.created_at.to_s).strftime("%d %B %H:%M ") %>
<i class="group-show-post-postdate-icon icon-time"></i> <%= date %>
2015-03-31 07:51:04 +00:00
</span>
<!-- <span class="group-show-post-time">10:25</span> -->
2015-03-31 07:51:04 +00:00
</div>
</header>
<section class="group-show-post-image-wrap">
<ul class="group-show-post-image-list cycle-slideshow"
2015-03-31 07:51:04 +00:00
data-cycle-slides="li"
data-cycle-prev=".group-show-post-cycle-prev"
data-cycle-next=".group-show-post-cycle-next"
2015-03-31 07:51:04 +00:00
data-cycle-fx="fade"
data-cycle-log="false"
2015-04-14 07:31:41 +00:00
data-cycle-center-horz=true
data-cycle-center-vert=true
2015-03-31 07:51:04 +00:00
>
<% @post.group_post_images.each do |gpi| %>
<li class="group-show-post-image-item"><img class="group-show-post-banner-image" src="<%= gpi.image.url %>" alt="<%= @post.title %>"></li>
<% end %>
2015-03-31 07:51:04 +00:00
</ul>
<div class="group-show-post-cycle-prev cycle-nav"><i class="group-show-post-cycle-nav-icon icon-chevron-left"></i></div>
<div class="group-show-post-cycle-next cycle-nav"><i class="group-show-post-cycle-nav-icon icon-chevron-right"></i></div>
2015-03-31 07:51:04 +00:00
</section>
<section class="group-show-post-content">
<%= @post.content.html_safe %>
2015-03-31 07:51:04 +00:00
</section>
<div class="group-show-post-attachment-wrap">
2015-04-14 07:18:58 +00:00
<% if !@post.group_post_files.blank? %>
<span class="group-show-post-attachments">
2015-04-14 07:18:58 +00:00
<% @post.group_post_files.each do |gpf| %>
<a href="/admin/posts/file/<%= gpf.id.to_s %>" class="button button-primary button-small"><i class="group-show-post-attachment-file-format fa fa-file-image-o"></i><span class="group-show-post-attachments-file-name"><%= File.basename(gpf.file.path) %></span></a>
2015-04-14 07:18:58 +00:00
<% end %>
2015-03-31 07:51:04 +00:00
</span>
2015-04-14 07:18:58 +00:00
<% end %>
2015-03-31 07:51:04 +00:00
</div>
2015-04-14 07:18:58 +00:00
<% if !@read_by_names.blank? %>
<div class="group-show-post-seen-by tool-tip-parent">
<i class="fa fa-eye"></i>
<em class="group-show-post-seen-by-lead">Seen by: <span class="group-show-post-seen-by-count"><%= @read_by_names.count %></span></em>
<div class="gorup-post-seen-by-names tool-tip right">
<% @read_by_names.each do |name| %>
<span class="group-show-post-seen-by-name"><%= name %></span>
<% end %>
</div>
2015-04-14 07:18:58 +00:00
</div>
<% end %>
2015-03-31 07:51:04 +00:00
<section class="comments">
2015-04-14 07:18:58 +00:00
<% if user_can_write? %>
<div class="group-show-post-respond">
2015-04-14 07:18:58 +00:00
<form action="/admin/posts/comment" method="post" id="comment-form" >
<h3 class="group-show-post-respond-title">
2015-03-31 07:51:04 +00:00
Leave a comment
</h3>
<div class="group-show-post-respond-wrap">
2015-03-31 07:51:04 +00:00
<label for="comment" class="screen-reader">Comment</label>
<input type="text" name="group_post_comment[comment]" id="group_post_comment" class="group-show-post-respond-comment" placeholder="Your comment here.">
2015-04-14 07:18:58 +00:00
<input type="hidden" name="group_post_comment[group_post_id]" value="<%= @post.id.to_s %>" />
<input type="hidden" name="group_post_comment[user_id]" value="<%= current_user.id.to_s %>" />
2015-03-31 07:51:04 +00:00
</div>
<div class="group-show-post-submit-wrap">
<input type="submit" name="submit" class="group-show-post-respond-submit button button-primary" id="submit" value="Submit Comment">
2015-03-31 07:51:04 +00:00
</div>
</form>
</div>
2015-04-14 07:18:58 +00:00
<% else %>
<div class="group-show-post-respond wow bounceInLeft">
<h4 class="group-no-permission"><i class="fa fa-exclamation-triangle"></i>Join the group to comment on this post.</h4>
2015-04-14 07:18:58 +00:00
</div>
<% end %>
<h3 class="group-show-post-comment-title bounceIn">
2015-03-31 07:51:04 +00:00
Comments
</h3>
<ol class="group-show-post-comment-list" id="group-show-post-comment-list" >
2015-04-14 07:18:58 +00:00
<%= render :partial => "post_comment", :collection => @post.group_post_comments.desc(:created_at) %>
<% if @post.group_post_comments.length == 0 %>
<li id="no-comments-li" class="group-show-post-no-comment"> No comments yet. <%= (user_can_write? ? "Be the first one!" : "") %> </li>
2015-04-14 07:18:58 +00:00
<% end %>
</ol>
2015-03-31 07:51:04 +00:00
</section>
</article>
2015-04-14 07:18:58 +00:00
</div>
<script type="text/javascript">
$("#comment-form").ajaxForm({
beforeSubmit : function(formData){
if(formData[0].value == ""){
return false;
}
},
success : function(comments){
$("li#no-comments-li").remove();
$("ol#group-show-post-comment-list").prepend(comments);
2015-04-14 07:18:58 +00:00
$("#comment-form").resetForm();
}
})
2015-04-14 07:31:41 +00:00
</script>