博客设为首页后,显示在个人主页处

This commit is contained in:
ouyangxuhua 2016-01-11 16:56:57 +08:00
parent 25a24f72e5
commit 2f5ada2d7b
4 changed files with 22 additions and 12 deletions

View File

@ -26,12 +26,21 @@
) if User.current && User.current.id == activity.author.id %>
</li>
<li>
<%= link_to(
l(:button_set_homepage),
{:controller => 'blogs',:action => 'set_homepage',:user_id=>activity.author_id,:id=>activity.blog_id, :article_id => activity.id},
:method => :post,
:class => 'postOptionLink'
) if User.current && User.current.id == activity.blog.author_id %>
<% if activity.id == activity.blog.homepage_id %>
<%= link_to(
l(:button_cancel_homepage),
{:controller => 'blogs',:action => 'cancel_homepage',:user_id=>activity.author_id,:id=>activity.blog_id, :article_id => activity.id},
:method => :post,
:class => 'postOptionLink'
) if User.current && User.current.id == activity.blog.author_id %>
<% else %>
<%= link_to(
l(:button_set_homepage),
{:controller => 'blogs',:action => 'set_homepage',:user_id=>activity.author_id,:id=>activity.blog_id, :article_id => activity.id},
:method => :post,
:class => 'postOptionLink'
) if User.current && User.current.id == activity.blog.author_id %>
<% end %>
</li>
</ul>
</li>

View File

@ -43,11 +43,6 @@
</div>
</div>
<% if blog.homepage_id and BlogComment.where("id=?", blog.homepage_id).count > 0 %>
<% homepage = BlogComment.find(blog.homepage_id) %>
<%= render :partial => 'blogs/homepage', :locals => {:activity => homepage, :user_activity_id => homepage.id} %>
<% end %>
<% if User.current.logged? && User.current.id == @user.id %>
<%= labelled_form_for @article, :url =>{:controller=>'blog_comments',:action => 'create',:user_id=>user.id , :blog_id => blog.id},
:html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %>

View File

@ -36,7 +36,7 @@
</div>
<%end%>
<div class="cl"></div>
<div class="homepagePostTitle hidden m_w530 fl">
<div class="homepagePostTitle hidden m_w530">
<%= link_to activity.title.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author_id,
:blog_id=>activity.blog.id,:id=>activity), :class=> "postGrey", :style => 'text-align:center;' %>
</div>

View File

@ -40,4 +40,10 @@
</ul>
</div>
<!--显示个人主页-->
<% if @user.blog.homepage_id and BlogComment.where("id=?", @user.blog.homepage_id).count > 0 %>
<% homepage = BlogComment.find(@user.blog.homepage_id) %>
<%= render :partial => 'blogs/homepage', :locals => {:activity => homepage, :user_activity_id => homepage.id} %>
<% end %>
<%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities,:page => 0,:type => @type} %>