模式4没有内容的显示情况

This commit is contained in:
huang 2016-05-04 19:12:53 +08:00
parent 04b2aee166
commit 33bf4fafa6
3 changed files with 262 additions and 229 deletions

View File

@ -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.show_mode.t == 1 && 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.where("container_id =? and container_type =? and attachtype =?", @organization, "Organization", 0).order("created_on desc").first
@ -165,7 +165,7 @@ class OrganizationsController < ApplicationController
def get_project_activities_org org, project_ids
unless project_ids.blank?
project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{project_ids.join(',')}) and container_type = 'project'
and org_act_type in ('Message', 'Issue') order by updated_at desc limit 8;")
and org_act_type in ('Message', 'Issue') order by updated_at desc limit 5;")
else
project_acts = nil
end
@ -176,7 +176,7 @@ class OrganizationsController < ApplicationController
def get_course_activities_org org, course_ids
unless course_ids.blank?
project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids.join(',')}) and container_type = 'course'
and org_act_type in ('HomeworkCommon', 'Poll', 'Message', 'News', 'Course') order by updated_at desc limit 8;")
and org_act_type in ('HomeworkCommon', 'Poll', 'Message', 'News', 'Course') order by updated_at desc limit 5;")
else
project_acts = nil
end

View File

@ -1,19 +1,26 @@
<div class="sn-index-leftbox" style="display:<%= field.hide == 0?'block':'none' %>;">
<h2 class="h2-title"><%= field.name %><a href="javascript:void(0);" target="_blank" class="more">更多</a></h2>
<div class="sn-index-resourcescon">
<% if is_default_field?(field) %>
<% case field.name %>
<% when 'course' %>
<% if @course_acts.blank? %>
<div class="sn-index-leftbox" style="display:<%= field.hide == 0?'block':'none' %>;">
<h2 class="h2-title"><%= field.name %></h2>
<div class="sn-index-resourcescon">
<%= render :partial => 'organizations/org_subfield_leftMD_default', :locals => {:field => field} %>
<div class="cl"></div>
</div>
</div>
<% else %>
<div class="sn-index-leftbox" style="display:<%= field.hide == 0?'block':'none' %>;">
<h2 class="h2-title"><%= field.name %><a href="javascript:void(0);" target="_blank" class="more">更多</a></h2>
<div class="sn-index-resourcescon">
<% @course_acts.first(4).each do |act| %>
<% if act.org_act_type == "HomeworkCommon" %>
<% activity = HomeworkCommon.find(act.org_act_id) %>
<% iamge_path = get_image_path_from_content(activity.description) %>
<div class="sn-index-resourcesbox">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<%= link_to image_tag("/images/default_blank/left-04.jpg", :width => "185", :height => "125"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), student_work_index_url_in_org(activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% end %>
@ -30,7 +37,7 @@
<% iamge_path = get_image_path_from_content(activity.content) %>
<div class="sn-index-resourcesbox">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<%= link_to image_tag("/images/default_blank/left-04.jpg", :width => "185", :height => "125"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% end %>
@ -51,7 +58,7 @@
<% iamge_path = get_image_path_from_content(activity.description) %>
<div class="sn-index-resourcesbox">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), news_url_in_org(activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<%= link_to image_tag("/images/default_blank/left-04.jpg", :width => "185", :height => "125"), news_url_in_org(activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), news_url_in_org(activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% end %>
@ -71,7 +78,7 @@
<% if ( activity.polls_status==2) %>
<div class="sn-index-resourcesbox">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"sn-resourcesimg" %>
<%= link_to image_tag("/images/default_blank/left-04.jpg", :width => "185", :height => "125"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"sn-resourcesimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class =>"sn-resourcesimg" %>
<% end %>
@ -90,18 +97,30 @@
<% end %>
<% end %>
<% end %>
<div class="cl"></div>
</div>
</div>
<% end %>
<% when 'project' %>
<% if @project_acts.blank? %>
<div class="sn-index-leftbox" style="display:<%= field.hide == 0?'block':'none' %>;">
<h2 class="h2-title"><%= field.name %></h2>
<div class="sn-index-resourcescon">
<%= render :partial => 'organizations/org_subfield_leftMD_default', :locals => {:field => field} %>
<div class="cl"></div>
</div>
</div>
<% else %>
<div class="sn-index-leftbox" style="display:<%= field.hide == 0?'block':'none' %>;">
<h2 class="h2-title"><%= field.name %><a href="javascript:void(0);" target="_blank" class="more">更多</a></h2>
<div class="sn-index-resourcescon">
<% @project_acts.first(4).each do |act| %>
<% if act.org_act_type == "Issue" %>
<% activity = Issue.find(act.org_act_id) %>
<% iamge_path = get_image_path_from_content(activity.description) %>
<div class="sn-index-resourcesbox">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), issue_url_in_org(activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<%= link_to image_tag("/images/default_blank/left-04.jpg", :width => "185", :height => "125"), issue_url_in_org(activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), issue_url_in_org(activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% end %>
@ -118,7 +137,7 @@
<% iamge_path = get_image_path_from_content(activity.content) %>
<div class="sn-index-resourcesbox">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<%= link_to image_tag("/images/default_blank/left-04.jpg", :width => "185", :height => "125"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% end %>
@ -139,7 +158,7 @@
<% iamge_path = get_image_path_from_content(activity.description) %>
<div class="sn-index-resourcesbox">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<%= link_to image_tag("/images/default_blank/left-04.jpg", :width => "185", :height => "125"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% end %>
@ -153,14 +172,27 @@
</div>
<% end %>
<% end %>
<div class="cl"></div>
</div>
</div>
<% end %>
<% end %>
<% else %>
<% if field.field_type == "Post" %>
<% org_acts = get_subfield_acts field %>
<% if org_acts.blank? %>
<div class="sn-index-leftbox" style="display:<%= field.hide == 0?'block':'none' %>;">
<h2 class="h2-title"><%= field.name %></h2>
<div class="sn-index-resourcescon">
<%= render :partial => 'organizations/org_subfield_leftMD_default', :locals => {:field => field} %>
<div class="cl"></div>
</div>
</div>
<% else %>
<div class="sn-index-leftbox" style="display:<%= field.hide == 0?'block':'none' %>;">
<h2 class="h2-title"><%= field.name %><a href="javascript:void(0);" target="_blank" class="more">更多</a></h2>
<div class="sn-index-resourcescon">
<% org_acts.first(4).each do |activity| %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %>
<% document = activity.org_act %>
@ -169,7 +201,7 @@
<% iamge_path = get_image_path_from_content(document.content) %>
<div class="sn-index-resourcesbox">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<%= link_to image_tag("/images/default_blank/left-04.jpg", :width => "185", :height => "125"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% end %>
@ -193,7 +225,7 @@
<% if message.board.org_subfield_id %>
<div class="sn-index-resourcesbox">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<%= link_to image_tag("/images/default_blank/left-04.jpg", :width => "185", :height => "125"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class =>"sn-resourcesimg" %>
<% end %>
@ -212,7 +244,7 @@
<% else %>
<div class="sn-index-resourcesbox">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), board_message_path(message.board,activity), :target => "_blank", :class =>"sn-resourcesimg" %>
<%= link_to image_tag("/images/default_blank/left-04.jpg", :width => "185", :height => "125"), board_message_path(message.board,activity), :target => "_blank", :class =>"sn-resourcesimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), board_message_path(message.board,activity), :target => "_blank", :class =>"sn-resourcesimg" %>
<% end %>
@ -235,7 +267,7 @@
<% iamge_path = get_image_path_from_content(news.description) %>
<div class="sn-index-resourcesbox">
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/files-default.jpg", :width => "185", :height => "125"), news_path(news), :target => "_blank", :class =>"sn-resourcesimg" %>
<%= link_to image_tag("/images/default_blank/left-04.jpg", :width => "185", :height => "125"), news_path(news), :target => "_blank", :class =>"sn-resourcesimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "185", :height => "125"), news_path(news), :target => "_blank", :class =>"sn-resourcesimg" %>
<% end %>
@ -250,9 +282,10 @@
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
<div class="cl"></div>
</div>
</div>
</div>
<% end %>
<% end %>
<% end %>

View File

@ -1,11 +1,11 @@
<div class="sn-index-resourcesbox">
<a href="javascript:void(0);" target="_blank" class="sn-resourcesimg"><img src="/images/default_blank/files-default.jpg" width="185" height="125" alt=""/></a>
<h3><a href="javascript:void(0);" target="_blank" class="resources-title sn-hidden">仪器资源</a></h3>
<div class="resources-tagbox">
<a href="javascript:void(0);" target="_blank" class="resources-tag">测试服务</a>
<a href="javascript:void(0);" target="_blank" class="resources-tag">开放日</a>
<a href="javascript:void(0);" target="_blank" class="resources-tag">仪器共享</a>
<a href="javascript:void(0);" target="_blank" class="resources-tag">定制测试</a>
</div>
<a href="javascript:void(0);" target="_blank" class="more-btn">更多</a>
<a href="javascript:void(0);" target="_blank" class="sn-resourcesimg"><img src="/images/default_blank/left-04.jpg" width="185" height="125" alt=""/></a>
<!--<h3><a href="javascript:void(0);" target="_blank" class="resources-title sn-hidden">仪器资源</a></h3>-->
<!--<div class="resources-tagbox">-->
<!--<a href="javascript:void(0);" target="_blank" class="resources-tag">测试服务</a>-->
<!--<a href="javascript:void(0);" target="_blank" class="resources-tag">开放日</a>-->
<!--<a href="javascript:void(0);" target="_blank" class="resources-tag">仪器共享</a>-->
<!--<a href="javascript:void(0);" target="_blank" class="resources-tag">定制测试</a>-->
<!--</div>-->
<!--<a href="javascript:void(0);" target="_blank" class="more-btn">更多</a>-->
</div>