Merge branch 'szzh' of https://git.trustie.net/jacknudt/trustieforge into szzh
This commit is contained in:
commit
6b5341805e
|
@ -9,9 +9,15 @@ class Organization < ActiveRecord::Base
|
||||||
has_many :org_subfields, :dependent => :destroy
|
has_many :org_subfields, :dependent => :destroy
|
||||||
has_many :users, :through => :org_members
|
has_many :users, :through => :org_members
|
||||||
validates_uniqueness_of :name
|
validates_uniqueness_of :name
|
||||||
after_create :save_as_org_activity
|
after_create :save_as_org_activity, :add_default_subfields
|
||||||
|
|
||||||
def save_as_org_activity
|
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')
|
OrgActivity.create(:user_id => User.current.id, :org_act_id => self.id, :org_act_type => 'CreateOrganization', :container_id => self.id, :container_type => 'Organization')
|
||||||
end
|
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
|
end
|
||||||
|
|
|
@ -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)),
|
$("#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) %>");
|
: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? %>
|
<%if @attachment.is_public? %>
|
||||||
$("#image_private_<%= @attachment.id%>").html('')
|
$("#image_private_<%= @attachment.id%>").html('')
|
||||||
<%else%>
|
<%else%>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<li class="orgListUser"><%= name %></li>
|
<li class="orgListUser"><%= name %></li>
|
||||||
<li class="orgListStatus">默认</li>
|
<li class="orgListStatus">默认</li>
|
||||||
<li class="orgListStatus">默认</li>
|
<li class="orgListStatus">默认</li>
|
||||||
<a href="javascript:void(0);" class="linkBlue fr mr10" onclick="hide($(this),'<%= field.id %>');" id="hide_<%= field.id %>"><%= field.hide==0?"设为隐藏":"设为显示" %></a>
|
<a href="javascript:void(0);" class="linkBlue fr mr10" onclick="hide($(this),'<%= field.id %>');" id="hide_<%= field.id %>"><%= field.hide==0?"设为隐藏":"设为可见" %></a>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
<li class="orgListStatus">新增</li>
|
<li class="orgListStatus">新增</li>
|
||||||
<li class="orgListStatus"><%= field.field_type == "Post" ? "帖子" : "资源" %></li>
|
<li class="orgListStatus"><%= field.field_type == "Post" ? "帖子" : "资源" %></li>
|
||||||
<%#= link_to "隐藏", hide_org_subfield_organizations_path(field), :method => 'post', :remote => true, :id => "hide_#{field.id}", :class => "linkBlue fr mr5" %>
|
<%#= link_to "隐藏", hide_org_subfield_organizations_path(field), :method => 'post', :remote => true, :id => "hide_#{field.id}", :class => "linkBlue fr mr5" %>
|
||||||
<a href="javascript:void(0);" class="linkBlue fr mr10" onclick="hide($(this),'<%= field.id %>');" id="hide_<%= field.id %>"><%= field.hide==0?"设为隐藏":"设为显示" %></a>
|
<a href="javascript:void(0);" class="linkBlue fr mr10" onclick="hide($(this),'<%= field.id %>');" id="hide_<%= field.id %>"><%= field.hide==0?"设为隐藏":"设为可见" %></a>
|
||||||
<%= link_to "删除", org_subfield_path(field), :method => 'delete', :remote => true, :confirm => "您确定删除吗?", :class => "linkBlue fr mr10" %>
|
<%= link_to "删除", org_subfield_path(field), :method => 'delete', :remote => true, :confirm => "您确定删除吗?", :class => "linkBlue fr mr10" %>
|
||||||
<a href="javascript:void(0);" class="linkBlue fr mr10" onclick="edit('#subfield_show_<%= field.id %>','#subfield_edit_<%= field.id %>');">编辑</a>
|
<a href="javascript:void(0);" class="linkBlue fr mr10" onclick="edit('#subfield_show_<%= field.id %>','#subfield_edit_<%= field.id %>');">编辑</a>
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
$("#hide_<%= @org_subfield.id %>").text("设为显示");
|
$("#hide_<%= @org_subfield.id %>").text("设为可见");
|
||||||
$("#org_subfield_<%= @org_subfield.id %>").css("display", "none");
|
$("#org_subfield_<%= @org_subfield.id %>").css("display", "none");
|
|
@ -7,7 +7,7 @@
|
||||||
<% attachments.each do |attach| %>
|
<% attachments.each do |attach| %>
|
||||||
<ul class="resourcesList" onmouseover="if($('#contextMenu').css('display') != 'block')$(this).children().css('background-color', '#e1e1e1')" onmouseout=" if($('#contextMenu').css('display') == 'none')$(this).children().css('background-color', 'white')">
|
<ul class="resourcesList" onmouseover="if($('#contextMenu').css('display') != 'block')$(this).children().css('background-color', '#e1e1e1')" onmouseout=" if($('#contextMenu').css('display') == 'none')$(this).children().css('background-color', 'white')">
|
||||||
<li class="resourcesListCheckbox fl">
|
<li class="resourcesListCheckbox fl">
|
||||||
<input name="checkbox1[]" type="checkbox" data-has-history="<%= attach.attachment_histories.count == 0 ? 'Y' : 'N' %>" data-deleteble="<%= User.current.id ==attach.author_id ? 'Y' : 'N' %>" onclick="checkAllBox($(this));" value="<%= attach.id%>" class="resourcesCheckbox" />
|
<input name="checkbox1[]" type="checkbox" data-has-history="<%= attach.attachment_histories.count == 0 ? 'N' : 'Y' %>" data-deleteble="<%= User.current.id ==attach.author_id ? 'Y' : 'N' %>" onclick="checkAllBox($(this));" value="<%= attach.id%>" class="resourcesCheckbox" />
|
||||||
</li>
|
</li>
|
||||||
<li class="resourcesListName fl">
|
<li class="resourcesListName fl">
|
||||||
<!--<a href="javascript:void(0);" class="resourcesBlack"><%#=truncate(attach.filename,:length=>18)%></a>-->
|
<!--<a href="javascript:void(0);" class="resourcesBlack"><%#=truncate(attach.filename,:length=>18)%></a>-->
|
||||||
|
|
Loading…
Reference in New Issue