From defba80427c1192dcb021207faae6226de899f67 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 31 Dec 2015 16:11:48 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E2=80=9C=E8=AE=BE=E4=B8=BA=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E2=80=9D=E6=94=B9=E6=88=90=E2=80=9C=E8=AE=BE=E4=B8=BA=E5=8F=AF?= =?UTF-8?q?=E8=A7=81"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_subfield_list.html.erb | 4 ++-- app/views/organizations/hide_org_subfield.js.erb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/organizations/_subfield_list.html.erb b/app/views/organizations/_subfield_list.html.erb index 8a092f7e2..de837c66f 100644 --- a/app/views/organizations/_subfield_list.html.erb +++ b/app/views/organizations/_subfield_list.html.erb @@ -11,7 +11,7 @@
  • <%= name %>
  • 默认
  • 默认
  • - <%= field.hide==0?"设为隐藏":"设为显示" %> + <%= field.hide==0?"设为隐藏":"设为可见" %>
    <% end %> @@ -27,7 +27,7 @@
  • 新增
  • <%= field.field_type == "Post" ? "帖子" : "资源" %>
  • <%#= link_to "隐藏", hide_org_subfield_organizations_path(field), :method => 'post', :remote => true, :id => "hide_#{field.id}", :class => "linkBlue fr mr5" %> - <%= field.hide==0?"设为隐藏":"设为显示" %> + <%= field.hide==0?"设为隐藏":"设为可见" %> <%= link_to "删除", org_subfield_path(field), :method => 'delete', :remote => true, :confirm => "您确定删除吗?", :class => "linkBlue fr mr10" %> 编辑 diff --git a/app/views/organizations/hide_org_subfield.js.erb b/app/views/organizations/hide_org_subfield.js.erb index 09ed3c280..18241c269 100644 --- a/app/views/organizations/hide_org_subfield.js.erb +++ b/app/views/organizations/hide_org_subfield.js.erb @@ -1,2 +1,2 @@ -$("#hide_<%= @org_subfield.id %>").text("设为显示"); +$("#hide_<%= @org_subfield.id %>").text("设为可见"); $("#org_subfield_<%= @org_subfield.id %>").css("display", "none"); \ No newline at end of file From 527897bff0c8a11bb646816fa170680da96f7acc Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 31 Dec 2015 16:23:10 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E5=A2=9E=E5=8A=A0=E9=BB=98=E8=AE=A4=E6=A0=8F?= =?UTF-8?q?=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/organization.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/models/organization.rb b/app/models/organization.rb index 350dc3080..fcb777fb6 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -9,9 +9,15 @@ class Organization < ActiveRecord::Base has_many :org_subfields, :dependent => :destroy has_many :users, :through => :org_members validates_uniqueness_of :name - after_create :save_as_org_activity + after_create :save_as_org_activity, :add_default_subfields def save_as_org_activity OrgActivity.create(:user_id => User.current.id, :org_act_id => self.id, :org_act_type => 'CreateOrganization', :container_id => self.id, :container_type => 'Organization') end + + def add_default_subfields + OrgSubfield.create(:organization_id => self.id, :name => 'activity', :field_type => 'default') + OrgSubfield.create(:organization_id => self.id, :name => 'course', :field_type => 'default') + OrgSubfield.create(:organization_id => self.id, :name => 'project', :field_type => 'default') + end end