From e86419c28bfa4bbff08a6f9cc1769ea95026aa43 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Mon, 13 Jun 2016 13:35:01 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E7=BB=87=E9=85=8D=E7=BD=AE=E9=87=8C?= =?UTF-8?q?=E9=9D=A2=E6=A0=8F=E7=9B=AE=E7=B1=BB=E5=9E=8B=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E4=B8=BA=E5=B8=96=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/org_subfields_controller.rb | 5 +++-- app/views/org_subfields/create.js.erb | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index 159648f34..38f5879e5 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -14,9 +14,10 @@ class OrgSubfieldsController < ApplicationController 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 diff --git a/app/views/org_subfields/create.js.erb b/app/views/org_subfields/create.js.erb index 952ed7b2c..a65f53719 100644 --- a/app/views/org_subfields/create.js.erb +++ b/app/views/org_subfields/create.js.erb @@ -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(""); \ No newline at end of file