diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb
index 18eb25675..9f80503d8 100644
--- a/app/controllers/organizations_controller.rb
+++ b/app/controllers/organizations_controller.rb
@@ -312,7 +312,7 @@ class OrganizationsController < ApplicationController
def agree_apply_subdomain
@organization = Organization.find(params[:organization_id])
@organization.update_attribute(:domain, params[:org_domain])
- if OrgMessage.where("message_type='AgreeApplySubdomain' and organization_id=#{@organization.id} and content=#{params[:org_domain]}").count == 0
+ if OrgMessage.where("message_type='AgreeApplySubdomain' and organization_id=#{@organization.id} and content=?",params[:org_domain]).count == 0
OrgMessage.create(:user_id => params[:user_id], :organization_id => @organization.id, :message_type => 'AgreeApplySubdomain', :message_id => @organization.id, :sender_id => User.current.id, :viewed => 0, :content => params[:org_domain])
end
end
diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb
index 58dee20b8..2007aec5a 100644
--- a/app/views/layouts/base_org.html.erb
+++ b/app/views/layouts/base_org.html.erb
@@ -163,7 +163,7 @@
- - Copyright © 2007-2015, All Rights Reserved
+ - Copyright © 2007-2016, All Rights Reserved
- ICP备09019772
diff --git a/app/views/organizations/agree_apply_subdomain.js.erb b/app/views/organizations/agree_apply_subdomain.js.erb
index df25d018c..314d48e15 100644
--- a/app/views/organizations/agree_apply_subdomain.js.erb
+++ b/app/views/organizations/agree_apply_subdomain.js.erb
@@ -1 +1 @@
-$("#agree_apply_subdomain").text("已同意申请");
\ No newline at end of file
+$("#agree_apply_subdomain_<%= params[:act_id] %>").text("已同意申请");
\ No newline at end of file
diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb
index bcc0a0c4b..2e9058c40 100644
--- a/app/views/organizations/setting.html.erb
+++ b/app/views/organizations/setting.html.erb
@@ -140,7 +140,7 @@
$("#add_subfield_form").submit();
}
function apply_subdomain(id, domain){
- var reg = new RegExp("[a-zA-Z0-9_]{1,}");
+ var reg = new RegExp("^[a-zA-Z0-9_]{1,}$");
if (reg.exec(domain)){
$.ajax({
url:"<%= apply_subdomain_organization_path %>",
diff --git a/app/views/users/_user_message_org.html.erb b/app/views/users/_user_message_org.html.erb
index b2801a618..5bf1c8950 100644
--- a/app/views/users/_user_message_org.html.erb
+++ b/app/views/users/_user_message_org.html.erb
@@ -12,24 +12,13 @@
<%= ma.content %>
- <% if ma.status == 0 %>
- <%=link_to "同意", agree_apply_subdomain_organizations_path( :organization_id => ma.organization_id, :org_domain => ma.content, :user_id => ma.sender_id, :message_id => ma.id ),
- :id => 'agree_apply_subdomain',
- :method => 'post',
- :remote => true,
- :class => "green_btn_cir ml10",
- :style => "color:#fff" %>
- <%=link_to "拒绝", agree_apply_subdomain_organizations_path( :organization_id => ma.organization_id, :org_domain => ma.content, :user_id => ma.sender_id,:message_id => ma.id ),
- :id => 'agree_apply_subdomain',
- :method => 'post',
- :remote => true,
- :class => "green_btn_cir ml10",
- :style => "color:#fff" %>
- <% elsif ma.status == 1 %>
- 已同意
- <% elsif ma.status == 2 %>
- 已拒绝
- <% end %>
+ <%=link_to (ma.organization.domain.nil? || (ma.organization.domain && ma.organization.domain != ma.content)) ? "同意申请":"已同意申请",
+ agree_apply_subdomain_organizations_path( :organization_id => ma.organization_id, :org_domain => ma.content, :user_id => ma.sender_id, :act_id => ma.id ),
+ :id => "agree_apply_subdomain_#{ma.id}",
+ :method => 'post',
+ :remote => true,
+ :class => "green_btn_cir ml10",
+ :style => "color:#fff" %>
<%= time_tag(ma.created_at).html_safe %>
@@ -40,7 +29,7 @@
<%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
- '>管理员<%= ma.status == 1 ? '同意':'拒绝' %>了您的子域名申请:
+ '>管理员同意了您的子域名申请:
<%= ma.content %>