新建贴吧之后转入这个贴吧界面,组织配置栏目默认选择第一项

yuanke
yuanke 9 years ago
parent 000d33bf0d
commit 1023b94f0d

@ -9,14 +9,15 @@ class OrgSubfieldsController < ApplicationController
@subfield = OrgSubfield.create(:name => params[:name], :organization_id => params[:organization_id], :priority => @organization.org_subfields.order("priority").last.priority + 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]}'"
"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
@subfield.update_attributes(:field_type => params[:field_type])
#默认类型为帖子
@subfield.update_attributes(:field_type => params[:field_type]||"Post")
# admin配置的类型
update_status_by_type(@subfield, params[:field_type])
update_status_by_type(@subfield, params[:field_type]||"Post")
else
@res = false
end

@ -1,6 +1,7 @@
<%if @save_flag%>
$('#new_forum_div').slideToggle();$('#create_btn').parent().slideToggle();
$('#reorder_time').click();
//$('#new_forum_div').slideToggle();$('#create_btn').parent().slideToggle();
//$('#reorder_time').click();
window.location.href= "http://"+"<%= Setting.host_name%>"+"/forums/" + "<%= @forum.id%>"
<%else%>
$("#error").html("<%= @forum.errors.full_messages[0]%>").show();
<%end %>

@ -4,6 +4,8 @@
$("#sub_field_left_lists").html("");
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
$("#org_custom_admin").html("<%= escape_javascript(render :partial => 'organizations/org_custom_admin') %>");
//默认选中第一个
$("input[name='field_type']").get(0).checked=true;
<% end %>
$("#subfield_name").val("");
$("#sub_dir").val("");
$("#subfield_name").val("");
$("#sub_dir").val("");
Loading…
Cancel
Save