组织栏目子目录功能实现
This commit is contained in:
parent
582880e54d
commit
324513fc94
|
@ -20,7 +20,12 @@ class OrgDocumentCommentsController < ApplicationController
|
|||
flash.keep[:notice] = l(:notice_successful_create)
|
||||
EditorOfDocument.create(:editor_id => User.current.id, :org_document_comment_id => @org_document_comment.id, :created_at => @org_document_comment.updated_at)
|
||||
if params[:field_id]
|
||||
redirect_to organization_path(@organization, :org_subfield_id => params[:field_id])
|
||||
@org_subfield = OrgSubfield.find(params[:field_id])
|
||||
if @org_subfield.subfield_subdomain_dir.nil?
|
||||
redirect_to organization_path(@organization, :org_subfield_id => params[:field_id])
|
||||
else
|
||||
redirect_to show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => @org_subfield.subfield_subdomain_dir.name)
|
||||
end
|
||||
else
|
||||
redirect_to organization_org_document_comments_path(@organization)
|
||||
end
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
class OrgSubfieldsController < ApplicationController
|
||||
helper :attachments
|
||||
layout 'base_org'
|
||||
def create
|
||||
if OrgSubfield.where("organization_id=#{params[:organization_id]} and name=?",params[:name]).count == 0
|
||||
|
@ -25,54 +26,56 @@ class OrgSubfieldsController < ApplicationController
|
|||
"subfield_subdomain_dirs where org_subfields.id = subfield_subdomain_dirs.org_subfield_id and "+
|
||||
" org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir_name]}'").first
|
||||
if @org_subfield.field_type == 'Post'
|
||||
redirect_to organization_path(@organization, :org_subfield_id => @org_subfield.id)
|
||||
end
|
||||
if params[:sort]
|
||||
params[:sort].split(",").each do |sort_type|
|
||||
order_by = sort_type.split(":")
|
||||
|
||||
case order_by[0]
|
||||
when "filename"
|
||||
attribute = "filename"
|
||||
when "size"
|
||||
attribute = "filesize"
|
||||
when "attach_type"
|
||||
attribute = "attachtype"
|
||||
when "content_type"
|
||||
attribute = "created_on"
|
||||
when "field_file_dense"
|
||||
attribute = "is_public"
|
||||
when "downloads"
|
||||
attribute = "downloads"
|
||||
when "created_on"
|
||||
attribute = "created_on"
|
||||
when "quotes"
|
||||
attribute = "quotes"
|
||||
else
|
||||
attribute = "created_on"
|
||||
end
|
||||
@sort = order_by[0]
|
||||
@order = order_by[1]
|
||||
if order_by.count == 1 && attribute
|
||||
sort += "#{Attachment.table_name}.#{attribute} asc "
|
||||
if sort_type != params[:sort].split(",").last
|
||||
sort += ","
|
||||
end
|
||||
elsif order_by.count == 2 && order_by[1]
|
||||
sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} "
|
||||
if sort_type != params[:sort].split(",").last
|
||||
sort += ","
|
||||
end
|
||||
end
|
||||
end
|
||||
@org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0
|
||||
@org_activities = 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').page(params[:page] || 1).per(10)
|
||||
#redirect_to organization_path(@organization, :org_subfield_id => @org_subfield.id)
|
||||
else
|
||||
sort = "#{Attachment.table_name}.created_on desc"
|
||||
if params[:sort]
|
||||
params[:sort].split(",").each do |sort_type|
|
||||
order_by = sort_type.split(":")
|
||||
case order_by[0]
|
||||
when "filename"
|
||||
attribute = "filename"
|
||||
when "size"
|
||||
attribute = "filesize"
|
||||
when "attach_type"
|
||||
attribute = "attachtype"
|
||||
when "content_type"
|
||||
attribute = "created_on"
|
||||
when "field_file_dense"
|
||||
attribute = "is_public"
|
||||
when "downloads"
|
||||
attribute = "downloads"
|
||||
when "created_on"
|
||||
attribute = "created_on"
|
||||
when "quotes"
|
||||
attribute = "quotes"
|
||||
else
|
||||
attribute = "created_on"
|
||||
end
|
||||
@sort = order_by[0]
|
||||
@order = order_by[1]
|
||||
if order_by.count == 1 && attribute
|
||||
sort += "#{Attachment.table_name}.#{attribute} asc "
|
||||
if sort_type != params[:sort].split(",").last
|
||||
sort += ","
|
||||
end
|
||||
elsif order_by.count == 2 && order_by[1]
|
||||
sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} "
|
||||
if sort_type != params[:sort].split(",").last
|
||||
sort += ","
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
sort = "#{Attachment.table_name}.created_on desc"
|
||||
end
|
||||
@container_type = 2
|
||||
@containers = [ OrgSubfield.includes(:attachments).reorder(sort).find(@org_subfield.id)]
|
||||
@organization = Organization.find(@containers.first.organization_id)
|
||||
show_attachments @containers
|
||||
@tag_list = attachment_tag_list @all_attachments
|
||||
end
|
||||
@container_type = 2
|
||||
@containers = [ OrgSubfield.includes(:attachments).reorder(sort).find(@org_subfield.id)]
|
||||
@organization = Organization.find(@containers.first.organization_id)
|
||||
show_attachments @containers
|
||||
@tag_list = attachment_tag_list @all_attachments
|
||||
@page = params[:page] || 1
|
||||
#render :layout => 'base_org'
|
||||
end
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
<%#= render :partial => "files/subfield_tags", :locals => {:tag_list => @tag_list,:org_subfield => @org_subfield,:tag_name => @tag_name}%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<p class="f_l fontBlue f_b f_14">共有 <span><%= @all_attachments.count %></span> 个资源</p>
|
||||
<p class="f_l fontBlue f_b f_14">共有 <span id="attachment_count"><%= @all_attachments.count %></span> 个资源</p>
|
||||
<p class="f_r" style="color: #808080">
|
||||
<% if @order == "asc" %>
|
||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /
|
||||
|
|
|
@ -4,4 +4,5 @@
|
|||
<% else %>
|
||||
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'org_subfield_list',
|
||||
:locals => {org_subfield: @org_subfield,all_attachments: @result,sort:@sort,order:@order,org_subfield_attachments:@searched_attach})%>");
|
||||
$("#attachment_count").html("<%= @result.count %>");
|
||||
<% end %>
|
|
@ -0,0 +1,80 @@
|
|||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#relateProject,.relatePInfo").mouseover(function(){
|
||||
$(".relatePInfo").css("display","block");
|
||||
})
|
||||
$("#relateProject,.relatePInfo").mouseout(function(){
|
||||
$(".relatePInfo").css("display","none");
|
||||
})
|
||||
$(".homepagePostPortrait").mouseover(function(){
|
||||
$(this).children(".userCard").css("display","block");
|
||||
})
|
||||
$(".homepagePostPortrait").mouseout(function(){
|
||||
$(this).children(".userCard").css("display","none");
|
||||
})
|
||||
$(".userCard").mouseover(function(){
|
||||
$(this).css("display","block");
|
||||
})
|
||||
$(".userCard").mouseout(function(){
|
||||
$(this).css("display","none");
|
||||
})
|
||||
$(".coursesLineGrey").mouseover(function(){
|
||||
$(this).css("color","#ffffff");
|
||||
})
|
||||
$(".coursesLineGrey").mouseout(function(){
|
||||
$(this).css("color","#808080");
|
||||
})
|
||||
$(".homepagePostSetting,.coursesLineGrey").mouseover(function(){
|
||||
$(this).prev().css("color","#ffffff");
|
||||
$(this).css("z-index", "9999");
|
||||
})
|
||||
$(".homepagePostSetting").mouseout(function(){
|
||||
$(this).prev().css("color","#808080");
|
||||
$(this).css("z-index", "1");
|
||||
})
|
||||
})
|
||||
</script>
|
||||
<% unless org_activities.nil? %>
|
||||
<% org_activities.each do |act| %>
|
||||
<script>
|
||||
$(function() {
|
||||
init_activity_KindEditor_data(<%= act.id%>, null, "87%", "<%=act.class.to_s%>");
|
||||
});
|
||||
</script>
|
||||
<% if act.container_type == 'Organization' %>
|
||||
<% if act.org_act_type == 'OrgDocumentComment' && act.org_act_id != @organization.home_id %>
|
||||
<%= render :partial => 'organizations/show_org_document', :locals => {:document => act.org_act, :act => act, :flag => 2, :org_subfield_id => params[:org_subfield_id]} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if act.container_type == 'Project' %>
|
||||
<% case act.org_act_type.to_s %>
|
||||
<% when 'Message' %>
|
||||
<%= render :partial => 'organizations/project_message', :locals => {:activity => Message.find(act.org_act_id),:user_activity_id =>act.id} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if act.container_type == 'Course' %>
|
||||
<% case act.org_act_type.to_s %>
|
||||
<% when 'Message'%>
|
||||
<%= render :partial => 'organizations/org_course_message', :locals => {:activity => Message.find(act.org_act_id),:user_activity_id =>act.id} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if act.container_type == 'OrgSubfield' %>
|
||||
<% if act.org_act_type == 'Message' and act.org_act_id and Message.where("id=#{act.org_act_id}").count > 0 %>
|
||||
<% message = Message.find(act.org_act_id) %>
|
||||
<% if !message.board.course_id.nil? %>
|
||||
<%= render :partial => 'organizations/org_course_message', :locals => {:activity => message,:user_activity_id =>act.id} %>
|
||||
<% elsif message.board.project_id != -1 %>
|
||||
<%= render :partial => 'organizations/project_message', :locals => {:activity => message,:user_activity_id =>act.id} %>
|
||||
<% elsif message.board.org_subfield_id %>
|
||||
<%= render :partial => 'organizations/org_subfield_message', :locals => {:activity => message, :user_activity_id => act.id} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
|
||||
<% if org_act_count == 10 %>
|
||||
<%= link_to "点击展开更多",show_org_subfield_organization_path(:id => @organization.id,:page => @page.to_i + 1,:sub_dir_name => params[:sub_dir_name]),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%>
|
||||
<% end%>
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<%= javascript_include_tag "jquery.infinitescroll.js" %>
|
||||
|
||||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
|
||||
<% end %>
|
||||
|
||||
<style type="text/css">
|
||||
/*回复框*/
|
||||
.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}
|
||||
.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}
|
||||
.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}
|
||||
.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}
|
||||
.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}
|
||||
.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}
|
||||
.homepagePostReplyInputContainer .ke-outline {border: none;}
|
||||
.homepagePostReplyInputContainer .ke-inline-block {display: none;}
|
||||
.homepagePostReplyInputContainer .ke-container {float: left;}
|
||||
</style>
|
||||
|
||||
<div class="homepageRightBanner">
|
||||
<div class="NewsBannerName"><%= @org_subfield.name %></div>
|
||||
</div>
|
||||
|
||||
<% if @org_activities %>
|
||||
<%= render :partial => 'org_subfields/show_details',
|
||||
:locals => {:org_activities => @org_activities,
|
||||
:page=> @page,
|
||||
:org => @organization,
|
||||
:org_act_count=> @org_activities.count} %>
|
||||
<% end %>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,7 +1,10 @@
|
|||
|
||||
<div id="resource_list">
|
||||
<%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %>
|
||||
</div>
|
||||
<% if @org_subfield.field_type == 'Resource' %>
|
||||
<div id="resource_list">
|
||||
<%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => 'org_subfields/show_post_type'%>
|
||||
<% end %>
|
||||
|
||||
<script type='text/javascript'>
|
||||
var slideHeight = 29;
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'org_subfields/show_details',
|
||||
:locals => {:org_activities =>@org_activities,
|
||||
:page=>@page,
|
||||
:org => @organization,
|
||||
:org_act_count=>@org_activities.count} )%>");
|
|
@ -70,13 +70,17 @@
|
|||
<% organization.org_subfields.where("field_type != 'default'").each do |field| %>
|
||||
<div class="homepageLeftMenuBlock" style="display:<%= field.hide == 0?'block':'none' %>;" id="org_subfield_<%= field.id %>">
|
||||
<% if field.field_type == "Post" %>
|
||||
<%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %>
|
||||
<% if !field.subfield_subdomain_dir.nil? %>
|
||||
<%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %>
|
||||
<% else %>
|
||||
<%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %>
|
||||
<% end %>
|
||||
<% if User.current.member_of_org?organization %>
|
||||
<%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子"%>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if !field.subfield_subdomain_dir.nil? %>
|
||||
<%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %>
|
||||
<%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %>
|
||||
<% else %>
|
||||
<%= link_to "#{field.name}", org_subfield_files_path(field), :class => "homepageMenuText" %>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue