From 2920f21c956c00d52be8adb465a978165b284f90 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 5 May 2016 11:28:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8C=E7=BA=A7=E5=9F=9F=E5=90=8D=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=8A=9F=E8=83=BD=E8=87=AA=E5=8A=A8=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/sub_domains_controller.rb | 8 ++++++++ .../_subfield_sub_domains_list.html.erb | 20 ++++++++++++++++++- app/views/sub_domains/update.js.erb | 3 +++ config/routes.rb | 2 +- 4 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 app/views/sub_domains/update.js.erb diff --git a/app/controllers/sub_domains_controller.rb b/app/controllers/sub_domains_controller.rb index d289c7e39..abf32e305 100644 --- a/app/controllers/sub_domains_controller.rb +++ b/app/controllers/sub_domains_controller.rb @@ -20,6 +20,14 @@ class SubDomainsController < ApplicationController end end + def update + @subdomain = SubDomain.find(params[:id]) + @subfield = OrgSubfield.find(params[:org_subfield_id]) + @organization = @subfield.organization + @subdomain.update_column(:name, params[:name]) + end + + def show render_404 # @subfield_content = @organization.org_subfields.order("priority") diff --git a/app/views/organizations/_subfield_sub_domains_list.html.erb b/app/views/organizations/_subfield_sub_domains_list.html.erb index 827e1464c..177e5ec0b 100644 --- a/app/views/organizations/_subfield_sub_domains_list.html.erb +++ b/app/views/organizations/_subfield_sub_domains_list.html.erb @@ -14,7 +14,7 @@
  • <%= subdomain.name %>
  • 新增
  • @@ -35,3 +35,21 @@ <% end %> <% end %> + + diff --git a/app/views/sub_domains/update.js.erb b/app/views/sub_domains/update.js.erb new file mode 100644 index 000000000..02810eee7 --- /dev/null +++ b/app/views/sub_domains/update.js.erb @@ -0,0 +1,3 @@ +$("#subsubdomain_show_<%= @subdomain.id %>").html("<%= @subdomain.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/config/routes.rb b/config/routes.rb index 70e684966..4ab7140d5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -118,7 +118,7 @@ RedmineApp::Application.routes.draw do end end - resources :sub_domains, :only => [:index, :new, :create, :show] do + resources :sub_domains, :only => [:index, :new, :create, :show, :update] do resources :sub_document_comments, :only => [:index, :new, :create, :show] do member do post 'add_reply'