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'