From e8d7e64f80aa6d974456fef025c1acf9d2eb3f04 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 20 Oct 2016 16:18:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E9=A1=B5=E5=AD=90=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/article_homepages_controller.rb | 1 + .../article_homepages/_article_show.html.erb | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/controllers/article_homepages_controller.rb b/app/controllers/article_homepages_controller.rb index 732ef0f5d..50567dcfe 100644 --- a/app/controllers/article_homepages_controller.rb +++ b/app/controllers/article_homepages_controller.rb @@ -27,6 +27,7 @@ class ArticleHomepagesController < ApplicationController end def show + @user = User.find params[:user_id] respond_to do |format| format.html {render :layout => 'clear_base'} end diff --git a/app/views/article_homepages/_article_show.html.erb b/app/views/article_homepages/_article_show.html.erb index 145d24eea..861ea438f 100644 --- a/app/views/article_homepages/_article_show.html.erb +++ b/app/views/article_homepages/_article_show.html.erb @@ -1,7 +1,7 @@
- <% if User.current == @user %> + <% if User.current == @user && @article == @user.base_homepage %>
  • @@ -13,6 +13,19 @@
+ <% elsif !@article.nil? && @article != @user.base_homepage %> +

+ <%= link_to(@user.show_name, user_path(@user), :class => 'sy_cgrey') %> +  >  + <% if @user.base_homepage %> + <%=link_to @user.base_homepage.title, homepage_user_path(@user.login), :class => 'sy_cgrey' %> +  >  + <% else %> + <%=link_to '编辑主页', user_homepages_path(:user_id => @user.id), :class => 'sy_cgrey' %> +  >  + <% end %> + <%=link_to @article.title, user_homepage_show_path(:user_id=> @article.user_id,:id=> @article), :class => 'sy_cgrey' %> +

<% end %> <% if @article.nil? %> <% if User.current == @user && @user.homepage.article_homepages.empty? %> @@ -30,7 +43,7 @@