From 893fad2b4856614b05ed34515ee8bebc69bb3fa2 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 31 Mar 2016 15:21:40 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E7=BB=87=E9=85=8D=E7=BD=AE=E9=87=8C?= =?UTF-8?q?=E7=9A=84=E6=A0=8F=E7=9B=AE=20=E2=80=9C=E6=8E=92=E5=88=97?= =?UTF-8?q?=E5=81=9A=E6=88=90=E5=8F=AF=E7=BC=96=E8=BE=91=E7=9A=84=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/org_subfields_controller.rb | 6 +++ app/helpers/organizations_helper.rb | 14 ++++++ app/views/org_subfields/update_status.js.erb | 3 ++ .../organizations/_subfield_list.html.erb | 47 +++++++++++++++++-- config/routes.rb | 1 + ...20160331060004_add_type_to_organization.rb | 5 -- ...60331063938_add_status_to_org_subfields.rb | 5 ++ db/schema.rb | 3 +- 8 files changed, 75 insertions(+), 9 deletions(-) create mode 100644 app/views/org_subfields/update_status.js.erb delete mode 100644 db/migrate/20160331060004_add_type_to_organization.rb create mode 100644 db/migrate/20160331063938_add_status_to_org_subfields.rb diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index bc339319b..661073cdc 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -130,6 +130,12 @@ class OrgSubfieldsController < ApplicationController @organization = @org_subfield.organization end + def update_status + @subfield = OrgSubfield.find(params[:id]) + @organization = Organization.find(@subfield.organization_id) + @subfield.update_attributes(:status => params[:status]) + end + def show_attachments obj @attachments = [] obj.each do |container| diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index c2ba5b03b..bc9a2fc87 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -59,4 +59,18 @@ module OrganizationsHelper end end + #排列下拉框 + def subfield_status_option + type = [] + option1 = [] + option1 << 0 + option1 << 0 + type << option1 + option2 = [] + option2 << 1 + option2 << 1 + type << option2 + type + end + end diff --git a/app/views/org_subfields/update_status.js.erb b/app/views/org_subfields/update_status.js.erb new file mode 100644 index 000000000..06982ccfc --- /dev/null +++ b/app/views/org_subfields/update_status.js.erb @@ -0,0 +1,3 @@ +$("#subfield_show_<%= @subfield.id %>").html("<%= @subfield.name %>"); +$("#sub_field_left_lists").html(""); +$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); \ No newline at end of file diff --git a/app/views/organizations/_subfield_list.html.erb b/app/views/organizations/_subfield_list.html.erb index e86ef5dae..6a405e73a 100644 --- a/app/views/organizations/_subfield_list.html.erb +++ b/app/views/organizations/_subfield_list.html.erb @@ -23,7 +23,14 @@
  • <%= name %>
  • 默认
  • - 相关 + <%= form_tag({:controller => 'org_subfields', :action => 'update_status', :id => field.id,},:remote=>'true', :method => 'post', :id=>"update_status_form_#{field.id}", :class => 'query_form') do %> +
    + +
    + <%= select( :name,:group_id, subfield_status_option, + { :include_blank => false,:selected => field.status}, + {:onchange=>"update_status('#update_status_form_#{field.id}');", :id =>"field_status_id", :name => "status",:class=>"undis class-edit fl", :style => "width:30px;"}) %> + <% end %>
  • 默认
  • <%= field.hide==0?"设为隐藏":"设为可见" %> @@ -47,8 +54,14 @@
  • 新增
  • - - 相关 + <%= form_tag({:controller => 'org_subfields', :action => 'update_status', :id => field.id,},:remote=>'true', :method => 'post', :id=>"update_status_form_#{field.id}", :class => 'query_form') do %> +
    + +
    + <%= select( :name,:group_id, subfield_status_option, + { :include_blank => false,:selected => field.status}, + {:onchange=>"update_status('#update_status_form_#{field.id}');", :id =>"field_status_id", :name => "status",:class=>"undis class-edit fl", :style => "width:30px;"}) %> + <% end %>
  • <%= field.field_type == "Post" ? "帖子" : "资源" %>