组织管理员模式,二级目录局部刷新

This commit is contained in:
huang 2016-05-31 13:47:05 +08:00
parent c369b271a0
commit 8f897cbf89
5 changed files with 32 additions and 14 deletions

View File

@ -18,6 +18,9 @@ class SubDomainsController < ApplicationController
else
@res = false
end
respond_to do |format|
format.js
end
end
def update

View File

@ -91,7 +91,34 @@
<% end %>
<% else %>
<div style="display:<%= field.hide == 0?'block':'none' %>;" id="org_subfield_<%= field.id %>">
<% if field.field_type == "Post" || field.field_type == "Complex" || field.field_type == "Compstu" || field.field_type == "Comptec" %> <!--讨论帖子-->
<% if field.field_type == "Post" || field.field_type == "Complex" %> <!--讨论帖子-->
<div class="homepageLeftMenuBlock">
<!--<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuProjects').slideToggle();">项目</a>-->
<% 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 "#{field.name}", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
<% else %>
<%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
<% end %>
<% else %>
<%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
<% end %>
<% if User.current.logged? and User.current.admin_of_org?(organization) %>
<%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子" %>
<% end %>
</div>
<div class="<%= (field.sub_domains.count == 0) ? 'homepageLeftMenuCourses':'homepageLeftMenuCourses borderBottomNone' %>" id="PostDomain_<%= field.id %>" style="display:none;">
<ul>
<%= render :partial => 'organizations/org_subdomain',:locals=>{:subdomains => field.sub_domains.reorder('priority').uniq, :org_subfield_id => field.id} %>
</ul>
</div>
<% unless (field.sub_domains.count == 0 || !if_hidden_subdomain(field)) %>
<li class="homepageLeftMenuMore" id="sub_domain_jiantou_<%= field %>">
<a href="javascript:void(0);" class="homepageLeftMenuMoreIcon" onclick="$('#PostDomain_<%= field.id %>').slideToggle();" style="border-bottom: 1px solid #ddd;"></a>
</li>
<% end %>
<% elsif field.field_type == "Comptec" %>
<div class="homepageLeftMenuBlock">
<!--<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuProjects').slideToggle();">项目</a>-->
<% if !field.subfield_subdomain_dir.nil? %> <!--讨论帖子-->

View File

@ -184,7 +184,7 @@
function add_org_subfield_subdomain(){
if ($("#subfield_name_subdomain").val().trim() != "")
$("#add_subfield_form_subdomain").submit();
$("#org_subfield_list").html('<%= escape_javascript(render(:partial => 'organizations/subfield_list', :locals => {:subfields => @organization.org_subfields.order("priority")} )) %>');
$("#org_subfield_list").html('<%= escape_javascript(render(:partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)})) %>');
}
var $is_exist = false;
function apply_subdomain(id, domain){

View File

@ -9,10 +9,6 @@
<input type="radio" id="orgMng" value="Post" name="field_type" checked="checked"/>
<label for="orgMng">帖子</label>
</li>
<!--<li class="fl mr15">-->
<!--<input type="radio" id="orgMeb" value="Resource" name="field_type" />-->
<!--<label for="orgMeb">资源</label>-->
<!--</li>-->
<li class="cl"></li>
</ul>
<div class="courseSendSubmit mr15"><a href="javascript:void(0);" class="sendSourceText" onclick="add_org_subfield_subdomain();hideModal()">确定</a></div>
@ -20,8 +16,3 @@
<% end %>
<div class="cl"></div>
</div>
<script type="javascript">
</script>

View File

@ -1,8 +1,5 @@
<% if @res %>
$("#org_subfield_list").html("");
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>");
$("#sub_field_left_lists").html("");
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
<% end %>
$("#subfield_name").val("");
$("#sub_dir").val("");