组织历史版本删除功能

This commit is contained in:
huang 2016-10-14 14:46:48 +08:00
parent 4646f20bba
commit b408b6ef97
4 changed files with 6 additions and 15 deletions

View File

@ -1387,11 +1387,11 @@ module ApplicationHelper
attachment = history.attachment
case attachment.try(:container_type)
when "Project"
result = is_project_manager?(User.current.id, attachment.container_id) || User.current.id == history.author_id
result = is_project_manager?(User.current.id, attachment.container_id) || User.current.id == history.author_id || User.current.admin?
when "Course"
result = User.current.allowed_to?(:as_teacher, attachment.container) || User.current.id == history.author_id
when "Organization"
# result = || User.current.id == history.author_id
result = User.current.allowed_to?(:as_teacher, attachment.container) || User.current.id == history.author_id || User.current.admin?
when "OrgSubfield"
result = User.current.id == history.author_id || User.current.admin_of_org?(@organization) || User.current.admin?
end
end

View File

@ -1,11 +1,2 @@
//$("#ajax-modal").html('<%#= escape_javascript( render :partial => 'attachments/show_attachment_history' )%>');
//showModal('ajax-modal', '452px');
//$('#ajax-modal').siblings().remove();
//$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 435px;' class='resourceClose'></a>");
//$('#ajax-modal').parent().css("top","40%").css("left","50%").css("position","fixed");
//$('#ajax-modal').parent().addClass("resourceUploadPopup");
//$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
var htmlvalue = "<%= escape_javascript(render :partial => 'attachments/show_attachment_history') %>";
pop_box_new(htmlvalue,820,360);

View File

@ -12,7 +12,7 @@
<tr>
<th ><p class="popup_ziyuan_title"><%= @attachment.filename %><span class="muban_icons_blue ml5">当前版本</span></p></th>
<th><%= @attachment.downloads %></th>
<th><%= @attachment.quotes %></th>
<th><%= @attachment.try(:quotes).to_i %></th>
<th><%= format_time(@attachment.created_on) %></th>
<th></th>
</tr>

View File

@ -12,7 +12,7 @@
<%= favicon %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= stylesheet_link_tag 'prettify','jquery/jquery-ui-1.9.2','css/common','css/structure','css/public','repository','css/courses','css/org','css/project', 'css/popup' %>
<%= stylesheet_link_tag 'prettify','jquery/jquery-ui-1.9.2','css/common','css/structure','css/public','repository','css/courses','css/org','css/project', 'css/popup', 'css/moduel' %>
<%= javascript_include_tag 'cookie','project',"avatars", 'organization','header','prettify','select_list_move','org'%>
<%= javascript_include_tag 'attachments' %>
<%= call_hook :view_layouts_base_html_head %>