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 @@
  • <%= 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 diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index 621efc902..a0a1377f1 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -7,7 +7,7 @@ <% attachments.each do |attach| %>