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 diff --git a/app/views/attachments/update_file_dense.js.erb b/app/views/attachments/update_file_dense.js.erb index 110d3fc7c..747024dec 100644 --- a/app/views/attachments/update_file_dense.js.erb +++ b/app/views/attachments/update_file_dense.js.erb @@ -1,5 +1,10 @@ +<% if @attachment.container_type == 'Course' %> $("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)), :remote=>true,:class=>"postOptionLink",:method => :post) %>"); +<%else%> +$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)), + :remote=>true,:class=>"f_l re_open",:method => :post) %>"); +<%end %> <%if @attachment.is_public? %> $("#image_private_<%= @attachment.id%>").html('') <%else%> 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 @@