From 0e03798f6e8f2075fae224089f3f39bdade47b56 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 23 May 2016 16:24:32 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=A1=86=E6=9E=B6=E7=BB=93?= =?UTF-8?q?=E6=9E=84=EF=BC=88yeild=EF=BC=89=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 2 +- app/views/layouts/base_org2.html.erb | 38 +----- app/views/organizations/_show_type2.html.erb | 33 +++++ app/views/organizations/show.html.erb | 122 ++++++++++--------- 4 files changed, 102 insertions(+), 93 deletions(-) create mode 100644 app/views/organizations/_show_type2.html.erb diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 3ab62bbea..2ab724728 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -76,7 +76,7 @@ class OrganizationsController < ApplicationController def show # 组织新类型 show_mode:判断标准 1为新类型,0为旧 - if @organization.show_mode.to_i == 1 && params[:org_subfield_id].nil? && params[:list] .nil? + if @organization.switch_type && params[:org_subfield_id].nil? && params[:list] .nil? if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) # REDO:时间紧,暂时先这样 @org_logo_attchment = Attachment.find_by_sql("SELECT * from attachments WHERE container_id = #{@organization.id} and container_type = 'Organization' and attachtype = 0 and filename REGEXP '(.jpg|.png|.bmp|.gif|.jpeg)' ORDER BY created_on desc limit 1").first diff --git a/app/views/layouts/base_org2.html.erb b/app/views/layouts/base_org2.html.erb index 799aaa42b..e51a62e24 100644 --- a/app/views/layouts/base_org2.html.erb +++ b/app/views/layouts/base_org2.html.erb @@ -14,7 +14,7 @@ <%= javascript_include_tag 'attachments' %> <%#= call_hook :view_layouts_base_html_head %> - <%#= yield :header_tags -%> + <%= yield :header_tags -%> - <% act = OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?", @organization.home_id).first %> - <%= render :partial => 'show_home_page', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id, :act => act} %> -<% end %> -<% if @org_activities %> - <%= render :partial => 'organizations/org_activities', - :locals => {:org_activities => @org_activities, - :page=> @page, - :org => @organization, - :org_act_count=> @org_activities.count} %> + <% end %> + + <% end %> + <% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 and params[:org_subfield_id].nil? %> + + <% act = OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?", @organization.home_id).first %> + <%= render :partial => 'show_home_page', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id, :act => act} %> + <% end %> + <% if @org_activities %> + <%= render :partial => 'organizations/org_activities', + :locals => {:org_activities => @org_activities, + :page=> @page, + :org => @organization, + :org_act_count=> @org_activities.count} %> + <% end %> <% end %> @@ -70,3 +75,4 @@ +