拉代码更新

This commit is contained in:
Tim 2016-04-26 10:16:23 +08:00
parent 23a6604e47
commit 9ba0d50f26
3 changed files with 382 additions and 102 deletions

View File

@ -1,100 +1,121 @@
# encoding: utf-8 # encoding: utf-8
module OrganizationsHelper module OrganizationsHelper
include ApplicationHelper include ApplicationHelper
include FilesHelper include FilesHelper
def find_user_not_in_current_org_by_name org def find_user_not_in_current_org_by_name org
if params[:q] && params[:q].lstrip.rstrip != "" if params[:q] && params[:q].lstrip.rstrip != ""
scope = Principal.active.sorted.not_member_of_org(org).like(params[:q]) scope = Principal.active.sorted.not_member_of_org(org).like(params[:q])
else else
scope = [] scope = []
end end
principals = paginateHelper scope,10 principals = paginateHelper scope,10
s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :id => 'principals') s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :id => 'principals')
links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options| links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options|
link_to text, org_member_autocomplete_org_member_index_path( parameters.merge(:q => params[:q],:flag => true,:org=>org, :format => 'js')), :remote => true link_to text, org_member_autocomplete_org_member_index_path( parameters.merge(:q => params[:q],:flag => true,:org=>org, :format => 'js')), :remote => true
} }
s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "org_member_pagination_links" ) s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "org_member_pagination_links" )
end end
def get_default_name field def get_default_name field
case field.name case field.name
when 'activity' then when 'activity' then
return '动态' return '动态'
when 'course' then when 'course' then
return '课程' return '课程'
when 'project' then when 'project' then
return '项目' return '项目'
end end
end end
def get_message_org(org_id, field_id) def get_message_org(org_id, field_id)
OrgDocumentComment.find_by_sql("SELECT * FROM org_document_comments where organization_id = #{org_id} and org_subfield_id = #{field_id} and parent_id is null order by updated_at desc limit 8;") OrgDocumentComment.find_by_sql("SELECT * FROM org_document_comments where organization_id = #{org_id} and org_subfield_id = #{field_id} and parent_id is null order by updated_at desc limit 8;")
end end
def get_message_reply_org(org_id, ids) def get_message_reply_org(org_id, ids)
# OrgDocumentComment.find_by_sql("SELECT * FROM org_document_comments where organization_id = #{org_id} and parent_id is not null order by updated_at desc limit 1;") # OrgDocumentComment.find_by_sql("SELECT * FROM org_document_comments where organization_id = #{org_id} and parent_id is not null order by updated_at desc limit 1;")
OrgDocumentComment.find_by_sql("SELECT * FROM org_document_comments where organization_id = #{org_id} and parent_id in (#{ids}) order by updated_at desc limit 1;") OrgDocumentComment.find_by_sql("SELECT * FROM org_document_comments where organization_id = #{org_id} and parent_id in (#{ids}) order by updated_at desc limit 1;")
end end
def get_attach_org(field_id) def get_attach_org(field_id)
Attachment.find_by_sql("SELECT * FROM `attachments` where container_id =#{field_id} and container_type = 'OrgSubfield' and is_public =1 order by created_on limit 6;") Attachment.find_by_sql("SELECT * FROM `attachments` where container_id =#{field_id} and container_type = 'OrgSubfield' and is_public =1 order by created_on limit 6;")
end end
def get_attach_org2(field) def get_attach_org2(field)
org_attachments = field.attachments org_attachments = field.attachments
attachments = User.current.admin? ? org_attachments : visable_attachemnts(org_attachments) attachments = User.current.admin? ? org_attachments : visable_attachemnts(org_attachments)
return attachments.sort_by{|x| x.created_on}.reverse.first(6) return attachments.sort_by{|x| x.created_on}.reverse.first(6)
# Attachment.find_by_sql("SELECT * FROM `attachments` where container_id =#{field_id} and container_type = 'OrgSubfield' and is_public =1 order by created_on limit 6;") # Attachment.find_by_sql("SELECT * FROM `attachments` where container_id =#{field_id} and container_type = 'OrgSubfield' and is_public =1 order by created_on limit 6;")
end end
# 从内容中获取路径 # 从内容中获取路径
def get_image_path_from_content content def get_image_path_from_content content
r = Regexp.new(/src="\/files\/uploads\/image(.+?)"/) r = Regexp.new(/src="\/files\/uploads\/image(.+?)"/)
if r.match(content).nil? if r.match(content).nil?
image_path = nil image_path = nil
else else
image_path = r.match(content)[1] image_path = r.match(content)[1]
end end
end end
#排列下拉框 #排列下拉框
def subfield_status_option def subfield_status_option
type = [] type = []
option1 = [] option1 = []
option1 << "左上" option1 << "左上"
option1 << "1" option1 << "1"
type << option1 type << option1
option2 = [] option2 = []
option2 << "左中一" option2 << "中一"
option2 << "2" option2 << "2"
type << option2 type << option2
option3 = [] option3 = []
option3 << "左中二" option3 << "中二"
option3 << "3" option3 << "3"
type << option3 type << option3
option4 = [] option4 = []
option4 << "左中下" option4 << "中下"
option4 << "4" option4 << "4"
type << option4 type << option4
option5 = [] option5 = []
option5 << "左下" option5 << "左下"
option5 << "5" option5 << "5"
type << option5 type << option5
option6 = [] option6 = []
option6 << "右上" option6 << "右上"
option6 << "6" option6 << "6"
type << option6 type << option6
option7 = [] option7 = []
option7 << "右中" option7 << "右中"
option7 << "7" option7 << "7"
type << option7 type << option7
option8 = [] option8 = []
option8 << "右下" option8 << "右下"
option8 << "8" option8 << "8"
type << option8 type << option8
type type
end end
end def subfield_list_type subfield
case subfield.to_i
when 1
resulet = "左上"
when 2
resulet = "中一"
when 3
resulet = "中二"
when 4
resulet = "中下"
when 5
resulet = "左下"
when 6
resulet = "右上"
when 7
resulet = "右中"
when 8
resulet = "右下"
end
end
end

View File

@ -0,0 +1,259 @@
<script type="text/javascript">
Qfast.add('widgets', { path: "/javascripts/terminator2.2.min.js", type: "js", requires: ['fx'] });
Qfast(false, 'widgets', function () {
K.tabs({
id: 'fsD1', //焦点图包裹id
conId: "D1pic1", //** 大图域包裹id
tabId:"D1fBt",
tabTn:"a",
conCn: '.fcon', //** 大图域配置class
auto: 1, //自动播放 1或0
effect: 'fade', //效果配置
eType: 'click', //** 鼠标事件
pageBt:true, //是否有按钮切换页码
bns: ['.prev', '.next'],//** 前后按钮配置class
interval: 3000 //** 停顿时间
})
})
</script>
<% if is_default_field?(field) %>
<% case field.name %>
<% when 'course' %>
<% if field.status.to_i == 1 %>
<% elsif field.status.to_i == 2 %>
<% elsif field.status.to_i == 3 %>
<% elsif field.status.to_i == 4 %>
<% elsif field.status.to_i == 5 %>
<% elsif field.status.to_i == 6 %>
<% end %>
<div class="box1 bg-grey" style="display:<%= field.hide == 0?'block':'none' %>;">
<% if field.status == 0 %>
<div class="content ">
<div class="box-top" id="course_<%= field.id %>"><h2 class="box-title">课程动态</h2></div>
<% if @course_acts.blank? %>
<p class="nocontent">暂无内容,敬请期待!</p>
<div class="cl"></div>
<%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
<% else %>
<div class="course-list">
<ul class="clearfix">
<% unless @course_acts.nil? %>
<%= render :partial => 'organizations/org_new_course_pic', :locals => {:activities => @course_acts.first(3)} %>
<% end %>
<div class="cl"></div>
<%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
</ul>
</div>
<% end %>
</div><!--content end-->
<% else %>
<div class="content">
<div class="box-top" id="course_<%= field.id %>"><h2 class="box-title">课程动态</h2></div>
<% if @course_acts.blank? %>
<p class="nocontent">暂无内容,敬请期待!</p>
<div class="cl"></div>
<%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
<% else %>
<div class="row">
<%= render :partial => 'organizations/org_new_course_act_list', :locals =>{:activities => @course_acts, :field => field, :organization => @organization} %>
<!--row-ziyuan end-->
</div>
<div class="cl"></div>
<%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
<% end %>
</div><!--row end-->
<% end %>
</div><!--box1 end-->
<% when 'project' %>
<div class="box1" style="display:<%= field.hide == 0?'block':'none' %>;">
<% if field.status == 0 %>
<div class="content ">
<div class="box-top" id="project_<%= field.id %>"><h2 class="box-title">项目动态</h2><p class="box-title-p"></p></div>
<% if @project_acts.blank? %>
<p class="nocontent">暂无内容,敬请期待!</p>
<div class="cl"></div>
<%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
<% else %>
<div class="course-list">
<ul class="clearfix">
<% unless @project_acts.nil? %>
<%= render :partial => 'organizations/org_new_project_pic', :locals => {:activities => @project_acts.first(3)} %>
<% end %>
<div class="cl"></div>
<%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
</ul>
</div>
<% end %>
</div><!--content end-->
<% else %>
<div class="content">
<div class="box-top" style="display:<%= field.hide == 0?'block':'none' %>;" id="project_<%= field.id %>"><h2 class="box-title">项目动态</h2><p class="box-title-p"></p></div>
<% if @project_acts.blank? %>
<p class="nocontent">暂无内容,敬请期待!</p>
<div class="cl"></div>
<%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
<% else %>
<div class="row">
<%= render :partial => 'organizations/org_new_project_act_list', :locals =>{:activities => @project_acts, :field => field, :organization => @organization} %>
<!--row-ziyuan end-->
</div>
<div class="cl"></div>
<%= link_to "More", organization_path(@organization, :list =>1), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
<% end %>
</div><!--row end-->
<% end %>
</div>
<% end %>
<% else %>
<% if field.field_type == "Post" %> <%# 讨论类型 %>
<% 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') %>
<%# message_ats = get_message_org(@organization.id, field.id) %>
<%# ids = field.org_document_comments.map{|o| o.id}.join(",") %>
<div class="box1 bg-grey" style="display:<%= field.hide == 0?'block':'none' %>;" id="org_subfield_<%= field.id %>">
<% if field.status == 0 %>
<div class="content">
<div class="box-top" id="message_<%= field.id %>"><h2 class="box-title"><%= field.name %></h2></div>
<% if org_acts.blank? %>
<p class="nocontent">暂无内容,敬请期待!</p>
<div class="cl"></div>
<% if !field.subfield_subdomain_dir.nil? %> <!--讨论帖子-->
<% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %>
<%= link_to "More", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank" %>
<% else %>
<%= link_to "More", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank" %>
<% end %>
<% else %>
<%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
<% end %>
<%#= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
<% else %>
<div class="course-list">
<ul class="clearfix">
<% org_acts.first(3).each do |act| %>
<%= render :partial => 'organizations/org_new_forum_pic', :locals => {:activity => act, :field => field, :organization => @organization} %>
<% end %>
<div class="cl"></div>
</ul>
<% if !field.subfield_subdomain_dir.nil? %> <!--讨论帖子-->
<% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %>
<%= link_to "More", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank" %>
<% else %>
<%= link_to "More", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank" %>
<% end %>
<% else %>
<%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
<% end %>
<%#= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
</div>
<% end %>
</div><!--content end-->
<% else %>
<div class="content">
<div class="box-top" id="message_<%= field.id %>"><h2 class="box-title"><%= field.name %></h2></div>
<% if org_acts.blank? %>
<p class="nocontent">暂无内容,敬请期待!</p>
<div class="cl"></div>
<% if !field.subfield_subdomain_dir.nil? %> <!--讨论帖子-->
<% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %>
<%= link_to "More", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank" %>
<% else %>
<%= link_to "More", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank" %>
<% end %>
<% else %>
<%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
<% end %>
<div class="cl"></div>
<% else %>
<div class="row">
<% org_acts.each do |act| %>
<%= render :partial => 'organizations/org_new_forum_list', :locals => {:activity => act, :field => field, :organization => @organization} %>
<% end %>
<!--row-ziyuan end-->
</div>
<div class="cl"></div>
<% if !field.subfield_subdomain_dir.nil? %> <!--讨论帖子-->
<% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %>
<%= link_to "More", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank" %>
<% else %>
<%= link_to "More", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30" , :target => "_blank" %>
<% end %>
<% else %>
<%= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
<% end %>
<div class="cl"></div>
<% end %>
</div><!--row end-->
<div class="cl"></div>
<% end %>
</div><!--box1 end-->
<% elsif field.field_type == "Resource" %>
<% org_attachs = get_attach_org2(field) %>
<div class="box1" style="display:<%= field.hide == 0?'block':'none' %>;" id="org_subfield_<%= field.id %>">
<div class="content">
<div class="box-top" id="resource_<%= field.id %>"><h2 class="box-title"><%= field.name %></h2></div>
<% if org_attachs.blank? %>
<p class="nocontent">暂无内容,敬请期待!</p>
<div class="cl"></div>
<% if !field.subfield_subdomain_dir.nil? %>
<% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %>
<%= link_to "More", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30", :target => "_blank" %>
<% else %>
<%= link_to "More", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30", :target => "_blank" %>
<% end %>
<% else %>
<%= link_to "More", org_subfield_files_path(field), :class => "more-btn-center mt30", :target => "_blank" %>
<% end %>
<%#= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
<% else %>
<div class="row">
<%= render :partial => 'organizations/org_new_resource', :locals => {:org_attachs => org_attachs} %>
<!--row-ziyuan end-->
</div>
<div class="cl"></div>
<% if !field.subfield_subdomain_dir.nil? %>
<% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %>
<%= link_to "More", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30", :target => "_blank" %>
<% else %>
<%= link_to "More", show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "more-btn-center mt30", :target => "_blank" %>
<% end %>
<% else %>
<%= link_to "More", org_subfield_files_path(field), :class => "more-btn-center mt30", :target => "_blank" %>
<% end %>
<%#= link_to "More", organization_path(@organization, :org_subfield_id => field.id), :class => "more-btn-center mt30" , :target => "_blank" %>
<div class="cl"></div>
<% end %>
</div><!--row end-->
<div class="cl"></div>
</div><!--box1 end-->
</div>
<% end %>
<% end %>

View File

@ -27,7 +27,7 @@
默认 默认
<% else %> <% else %>
<%= form_tag({:controller => 'org_subfields', :action => 'update_status', :id => field.id,},:remote=>'true', :method => 'post', :id=>"update_status_form_#{field.id}", :class => 'query_form') do %> <%= form_tag({:controller => 'org_subfields', :action => 'update_status', :id => field.id,},:remote=>'true', :method => 'post', :id=>"update_status_form_#{field.id}", :class => 'query_form') do %>
<div class="update_status_class"><span class="hidden"><%=field.status== 1 ? "列表" : "图片" %></span> <div class="update_status_class"><span class="hidden"><%= subfield_list_type(field.status) %></span>
<a style="display: inline-block;" href="javascript:void(0)" class="pic_edit2"></a> <a style="display: inline-block;" href="javascript:void(0)" class="pic_edit2"></a>
</div> </div>
<%= select( :name,:group_id, subfield_status_option, <%= select( :name,:group_id, subfield_status_option,
@ -63,7 +63,7 @@
列表 列表
<% else %> <% else %>
<%= form_tag({:controller => 'org_subfields', :action => 'update_status', :id => field.id,},:remote=>'true', :method => 'post', :id=>"update_status_form_#{field.id}", :class => 'query_form') do %> <%= form_tag({:controller => 'org_subfields', :action => 'update_status', :id => field.id,},:remote=>'true', :method => 'post', :id=>"update_status_form_#{field.id}", :class => 'query_form') do %>
<div class="update_status_class"><span class="hidden"><%=field.status== 1 ? "列表" : "图片" %></span> <div class="update_status_class"><span class="hidden"><%= subfield_list_type(field.status) %></span>
<a style="display: inline-block;" href="javascript:void(0)" class="pic_edit2"></a> <a style="display: inline-block;" href="javascript:void(0)" class="pic_edit2"></a>
</div> </div>
<%= select( :name,:group_id, subfield_status_option, <%= select( :name,:group_id, subfield_status_option,