二级域名局部刷新
This commit is contained in:
parent
6098e47ffe
commit
2996daef71
|
@ -11,17 +11,9 @@ class SubDomainsController < ApplicationController
|
|||
def create
|
||||
if SubDomain.where("org_subfield_id=#{params[:org_subfield_id]} and name=?",params[:name]).count == 0
|
||||
@res = true
|
||||
# @organization = Organization.find(params[:organization_id])
|
||||
@subfield = OrgSubfield.find(params[:org_subfield_id])
|
||||
# @subfield = OrgSubfield.create(:name => params[:name], :organization_id => params[:organization_id],:priority => @organization.org_subfields.order("priority").last.priority + 1)
|
||||
@organization = @subfield.organization
|
||||
@subdomain = SubDomain.create(:name => params[:name], :org_subfield_id => params[:org_subfield_id],:priority => @subfield.sub_domains.blank? ? 1.1 : @subfield.sub_domains.order("priority").last.priority + 0.1)
|
||||
# if !params[:sub_dir].blank?
|
||||
# sql = "select subfield_subdomain_dirs.* from subfield_subdomain_dirs, org_subfields where subfield_subdomain_dirs.org_subfield_id = org_subfields.id "+
|
||||
# "and org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir]}'"
|
||||
# if SubfieldSubdomainDir.find_by_sql(sql).count == 0
|
||||
# SubfieldSubdomainDir.create(:org_subfield_id => @subfield.id, :name => params[:sub_dir].downcase)
|
||||
# end
|
||||
# end
|
||||
@subdomain.update_column(:field_type, params[:field_type])
|
||||
else
|
||||
@res = false
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<% if @res %>
|
||||
$("#org_subfield_list").html("");
|
||||
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => @organization.org_subfields.order("priority") }) %>");
|
||||
$("#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("");
|
Loading…
Reference in New Issue