帖子目录界面
This commit is contained in:
parent
1553eadc58
commit
59988f17da
|
@ -28,6 +28,7 @@ class OrganizationsController < ApplicationController
|
|||
helper :project_score
|
||||
helper :issues
|
||||
include UsersHelper
|
||||
include OrganizationsHelper
|
||||
before_filter :find_organization, :only => [:show, :members, :apply_subdomain, :select_org_layout, :teachers, :students, :projects, :courses]
|
||||
before_filter :allow_as_admin, :only => [:students, :teachers, :projects, :courses, :acts]
|
||||
layout 'base_org'
|
||||
|
@ -77,8 +78,12 @@ class OrganizationsController < ApplicationController
|
|||
|
||||
def show
|
||||
# 组织新类型 show_mode:判断标准 1为新类型,0为旧
|
||||
if @organization.switch_type && params[:org_subfield_id].nil? && params[:list] .nil?
|
||||
if @organization.switch_type && params[:list] .nil?
|
||||
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
|
||||
unless params[:org_subfield_id].nil?
|
||||
@org_subfield = OrgSubfield.where(:id => params[:org_subfield_id]).first
|
||||
@subfield_acts = get_subfield_acts(@org_subfield)
|
||||
end
|
||||
@subfield_content = @organization.org_subfields.order("priority")
|
||||
shield_project_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Project'").map(&:shield_id)
|
||||
shield_course_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Course'").map(&:shield_id)
|
||||
|
|
|
@ -115,6 +115,41 @@ module OrganizationsHelper
|
|||
end
|
||||
end
|
||||
|
||||
# 组织的栏目类型标题
|
||||
def subfield_title_type obj
|
||||
case obj.org_act_type
|
||||
when "OrgDocumentComment"
|
||||
obj.org_act.title
|
||||
when "Message"
|
||||
obj.org_act.parent_id.nil? ? obj.org_act.subject : obj.org_act.parent.subject
|
||||
when "News"
|
||||
obj.org_act.title
|
||||
end
|
||||
end
|
||||
|
||||
# 组织的栏目类型时间
|
||||
def subfield_time_type obj
|
||||
case obj.org_act_type
|
||||
when "OrgDocumentComment"
|
||||
obj.org_act.updated_at
|
||||
when "Message"
|
||||
obj.org_act.updated_on
|
||||
when "News"
|
||||
obj.org_act.created_on
|
||||
end
|
||||
end
|
||||
|
||||
def subfield_reply_count_type obj
|
||||
case obj.org_act_type
|
||||
when "OrgDocumentComment"
|
||||
obj.org_act.children.count
|
||||
when "Message"
|
||||
obj.org_act.children.count
|
||||
when "News"
|
||||
obj.org_act.comments_count
|
||||
end
|
||||
end
|
||||
|
||||
#排列下拉框
|
||||
def subfield_status_option
|
||||
type = []
|
||||
|
@ -186,9 +221,11 @@ module OrganizationsHelper
|
|||
end
|
||||
|
||||
def get_subfield_acts field
|
||||
org_subfield = OrgSubfield.find(field.id)
|
||||
org_subfield_ids = org_subfield.org_document_comments.map(&:id) << 0
|
||||
org_acts = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{org_subfield.id})").order('updated_at desc')
|
||||
unless field.nil?
|
||||
org_subfield = OrgSubfield.find(field.id)
|
||||
org_subfield_ids = org_subfield.org_document_comments.map(&:id) << 0
|
||||
org_acts = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{org_subfield.id})").order('updated_at desc')
|
||||
end
|
||||
end
|
||||
|
||||
def allow_to_create?(org, type)
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
<% if @subfield_acts.blank? %>
|
||||
<% else %>
|
||||
<div class="sn-inner-body">
|
||||
<div class="sn-innner-content">
|
||||
<div class="sn-row sn-bg-white">
|
||||
<div class="sn-content-position">
|
||||
您的位置:<%= link_to "首页", organization_path(@organization), :class => "sn-link-grey2" %> >
|
||||
<%=link_to @org_subfield.name, organization_path(@organization, :org_subfield_id => @org_subfield.id), :class => "sn-link-grey2" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sn-inner-newslist">
|
||||
<h2 class="sn-inner-newsh2"><%= @organization.name %></h2>
|
||||
<ul>
|
||||
<% @subfield_acts.each do |act| %>
|
||||
<% title = subfield_title_type(act) %>
|
||||
<% time = subfield_time_type(act) %>
|
||||
<% reply_count = subfield_reply_count_type(act) %>
|
||||
<% document = act.org_act %>
|
||||
<li>
|
||||
<div class="sn-circle fl"></div>
|
||||
<% if act.org_act_type == "OrgDocumentComment" %>
|
||||
<%=link_to title, org_document_comment_path(act.org_act, :organization_id => @organization.id), :class => "sn-newslist-titile fl", :target => "_blank" %>
|
||||
<% elsif act.org_act_type == "News" %>
|
||||
<%=link_to title, news_path(act.org_act), :class => "sn-newslist-titile fl", :target => "_blank" %>
|
||||
<% elsif act.org_act_type == "Message" %>
|
||||
<%=link_to title, board_message_path(act.org_act.board.id, act.org_act.id), :class => "sn-newslist-titile fl", :target => "_blank" %>
|
||||
<% end %>
|
||||
<span class=" txt-grey fr"><%= format_date(time) %></span>
|
||||
<span class="sn-newslist-reply fr mr10 txt-grey">回复(<%= reply_count %>)</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<!--<div>-->
|
||||
<!--<ul class="sn-inner-pages" id="pages" style="margin-top: 5px;">-->
|
||||
<!--<%#= pagination_links_full @atta_pages, @atta_count, :per_page_links => true, :remote => @is_remote, :flag => true %>-->
|
||||
<!--<div class="cl"></div>-->
|
||||
<!--</ul>-->
|
||||
<!--</div>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
|
@ -1,6 +1,11 @@
|
|||
<%# 区分两种模式 params[:org_subfield_id] 不为空的时候则跳到栏目%>
|
||||
<% if @organization.switch_type && params[:org_subfield_id].nil? %>
|
||||
<%= render :partial => 'show_custom' %>
|
||||
<% if @organization.switch_type %>
|
||||
<% if params[:org_subfield_id].nil? %>
|
||||
<%= render :partial => 'show_custom' %>
|
||||
<% else %>
|
||||
<%#= 单个栏目模式二中显示 %>
|
||||
<%= render :partial => 'show_custom_org_subfield' %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= javascript_include_tag "jquery.infinitescroll.js" %>
|
||||
|
||||
|
|
Loading…
Reference in New Issue