二级域名的删除功能

This commit is contained in:
huang 2016-05-05 12:27:35 +08:00
parent 2920f21c95
commit 6d28d0becd
4 changed files with 12 additions and 2 deletions

View File

@ -27,6 +27,12 @@ class SubDomainsController < ApplicationController
@subdomain.update_column(:name, params[:name])
end
def destroy
@subdomain = SubDomain.find(params[:id])
@subfield = OrgSubfield.find(params[:org_subfield_id])
@organization = @subfield.organization
@subdomain.destroy
end
def show
render_404

View File

@ -27,7 +27,7 @@
<li class="orgSubOperation">
<a href="javascript:void(0);" class="linkGrey fr ml5 mr10" onclick="hide($(this),'<%= subdomain.id %>');" id="hide_<%= subdomain.id %>"><%= subdomain.hide==0?"隐藏":"可见" %></a>
<span class="fr">|</span>
<%= link_to "删除", setting_organization_path(@organization), :method => 'delete', :remote => true, :confirm => "您确定删除吗?", :class => "linkGrey fr ml5 mr5" %>
<%= link_to "删除", org_subfield_sub_domain_path(subdomain, :org_subfield_id => subdomain.org_subfield.id), :method => 'delete', :remote => true, :confirm => "您确定删除吗?", :class => "linkGrey fr ml5 mr5" %>
<span class="fr">|</span>
<a href="javascript:void(0);" class="linkGrey fr ml5 mr5" onclick="edit('#subsubdomain_show_<%= subdomain.id %>','#subsubdomain_edit_<%= subdomain.id %>');">编辑</a>
</li>

View File

@ -0,0 +1,4 @@
$("#org_subfield_list").html("");
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => @organization.org_subfields.order("priority") }) %>");
$("#sub_field_left_lists").html("");
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");

View File

@ -118,7 +118,7 @@ RedmineApp::Application.routes.draw do
end
end
resources :sub_domains, :only => [:index, :new, :create, :show, :update] do
resources :sub_domains, :only => [:index, :new, :create, :show, :update, :destroy] do
resources :sub_document_comments, :only => [:index, :new, :create, :show] do
member do
post 'add_reply'