parent
78fb8b6254
commit
2f7260cba2
|
@ -3,7 +3,7 @@ class OrgSubfieldsController < ApplicationController
|
|||
@subfield = OrgSubfield.create(:name => params[:name])
|
||||
@organization = Organization.find(params[:organization_id])
|
||||
@organization.org_subfields << @subfield
|
||||
@subfield.update_attributes(:priority => @subfield.id)
|
||||
@subfield.update_attributes(:priority => @subfield.id, :field_type => params[:field_type])
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
$("#org_subfield_list").html("");
|
||||
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',:locals => {:subfields => @organization.org_subfields }) %>");
|
||||
$("#sub_field_left_lists").html("");
|
||||
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
|
||||
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
|
||||
$("#subfield_name").val("");
|
|
@ -114,7 +114,18 @@
|
|||
<p class="fontBlue fb mb5">新增栏目</p>
|
||||
<%= form_tag url_for(:controller => 'org_subfields', :action => 'create', :organization_id => @organization.id), :id=> 'add_subfield_form',:remote => true do %>
|
||||
<input type="text" id="subfield_name" name="name" placeholder="栏目名称" class="orgAddSearch mb20" />
|
||||
<div class="cl"></div>
|
||||
<ul class="orgAddRole">
|
||||
<li class="fontGrey3 fb mb10">栏目类型</li>
|
||||
<li>
|
||||
<input type="radio" id="orgMng" value="Post" name="field_type" checked="checked"/>
|
||||
<label for="orgMng">帖子</label>
|
||||
</li>
|
||||
<li>
|
||||
<input type="radio" id="orgMeb" value="Resource" name="field_type" />
|
||||
<label for="orgMeb">资源</label>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<a href="javascript:void(0);" class="saveBtn db fl mt10" onclick="add_org_subfield();">确定</a>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddTypeToOrgSubfields < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :org_subfields, :field_type, :string
|
||||
end
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
class SetTypeForOrgSubfields < ActiveRecord::Migration
|
||||
def up
|
||||
OrgSubfield.all.each do |field|
|
||||
field.update_attribute(:field_type, "Post")
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue