zy: user only comments and activity finished
This commit is contained in:
parent
face9b417f
commit
40f8bfc049
|
@ -3,6 +3,7 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
include ApplicationHelper
|
||||
include LoginHelper
|
||||
include UsersHelper
|
||||
|
||||
|
||||
# Confirms a logged-in user.
|
||||
|
|
|
@ -5,4 +5,5 @@ module ApplicationHelper
|
|||
return intime.utc.in_time_zone('Beijing').strftime(format='%F %T')
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -25,6 +25,8 @@ module MicroPostsHelper
|
|||
x["time"] = get_strftime(micro_post.post_time)
|
||||
x["pics"] = micro_post.pic.split(',') if micro_post.pic
|
||||
x["peo_num"] = micro_post.engage_people
|
||||
x["peo_names"] = micro_post.engaged_people_names
|
||||
x["comments"] = micro_post.comments
|
||||
micro_posts_array << x
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,2 +1,6 @@
|
|||
module UsersHelper
|
||||
def get_user_name_from_id user_id
|
||||
user = User.where(id: user_id)
|
||||
return user.name if !user.empty?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<!-- End Navigation -->
|
||||
|
||||
<div class="container-fluid main-content padded" id="user-page">
|
||||
<row id="new-post">
|
||||
<div class="row" id="new-post">
|
||||
<div class="widget-container fluid-height clearfix">
|
||||
<div class="heading">
|
||||
<i class="icon-reorder"></i>发布新信息
|
||||
|
@ -56,7 +56,7 @@
|
|||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</row>
|
||||
</div>
|
||||
|
||||
<div class="posts">
|
||||
<% @micro_posts.each do |micro_post| %>
|
||||
|
@ -77,13 +77,47 @@
|
|||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="btn btn-default btn-block show-details">
|
||||
查看详情
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="activity-details" hidden>
|
||||
<% if micro_post["type"] != "新鲜事" %>
|
||||
<div class="widget-container fluid-height">
|
||||
<div class="heading">
|
||||
<i class="icon-align-center"> 活动详情 </i>
|
||||
</div>
|
||||
<div class="widget-content padded">
|
||||
<h3 class="text-center">已有<%= micro_post["peo_num"] %>人参加活动</h3>
|
||||
<p><%= micro_post["peo_names"] %>参加了该活动</p>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if !micro_post["comments"].empty? %>
|
||||
<div class="widget-container fluid-height scrollable list user-comments">
|
||||
<div class="heading">
|
||||
<i class="icon-mail-forward"> 评论 </i>
|
||||
</div>
|
||||
<% micro_post["comments"].each do |comment| %>
|
||||
<div class="widget-content fluid-height">
|
||||
<ul>
|
||||
<li>
|
||||
<div>
|
||||
<a class="user-name"><%= get_user_name_from_id comment.user_id %></a><em></em>
|
||||
</div>
|
||||
<div>
|
||||
<p>comment.content</p>
|
||||
</div>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<p class="text-center alert-info">暂无评论</p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -209,4 +243,18 @@
|
|||
}
|
||||
});
|
||||
});
|
||||
$('.show-details').bind("click", function () {
|
||||
var current_button = $(this);
|
||||
var micropost = current_button.parent().parent().parent();
|
||||
var text = current_button.text().trim();
|
||||
if (text == "查看详情") {
|
||||
micropost.find(".activity-details").show();
|
||||
current_button.text("隐藏详情");
|
||||
}
|
||||
else {
|
||||
micropost.find(".activity-details").hide();
|
||||
current_button.text("查看详情");
|
||||
}
|
||||
|
||||
})
|
||||
</script>
|
Binary file not shown.
|
@ -134,12 +134,26 @@
|
|||
.widget-container .heading [class^="icon-"], .widget-container .heading [class*="icon-"] {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.pagination .previous_page {
|
||||
font-size: 2em;
|
||||
margin-right: 20px;
|
||||
|
||||
}
|
||||
|
||||
.pagination .next_page {
|
||||
font-size: 2em;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.posts .micro-post .widget-container.scrollable {
|
||||
height: 250px;
|
||||
}
|
||||
|
||||
.widget-container.fluid-height.scrollable.list.user-comments p {
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.activity-details p {
|
||||
font-size: 1.2em;
|
||||
}
|
Loading…
Reference in New Issue