新建班级继承了原有班级的资源,而发布者不能修改资源了
This commit is contained in:
parent
f46da97b6d
commit
374827d3a4
|
@ -303,7 +303,7 @@ class AttachmentsController < ApplicationController
|
|||
@attachment = Attachment.find(params[:attachments ].first[1][:attachment_id])
|
||||
#将需要修改的记录保存到历史记录
|
||||
@history = AttachmentHistory.new
|
||||
@history.attributes = @old_attachment.attributes.dup.except("id")
|
||||
@history.attributes = @old_attachment.attributes.dup.except("id", "resource_bank_id")
|
||||
@history.attachment_id = params[:old_attachment_id]
|
||||
#需要更新版本号,需要拿到原来该文件最大的历史版本号
|
||||
@old_history = @old_attachment.attachment_histories.reorder('version desc').first
|
||||
|
@ -338,6 +338,9 @@ class AttachmentsController < ApplicationController
|
|||
|
||||
# prams[:type] => history 历史版本
|
||||
def destroy
|
||||
if params[:course]
|
||||
@course = Course.find params[:course]
|
||||
end
|
||||
page = params[:page] ? params[:page].to_i : 1
|
||||
@curr_page = page
|
||||
if params[:type] == "history"
|
||||
|
@ -678,6 +681,9 @@ class AttachmentsController < ApplicationController
|
|||
|
||||
def attachment_versions_delete
|
||||
@attachment = Attachment.find(params[:id])
|
||||
if params[:course]
|
||||
@course = Course.find params[:course]
|
||||
end
|
||||
@attachment_histories = @attachment.attachment_histories
|
||||
@attachment_histories_count = @attachment_histories.count
|
||||
@curr_page = params[:page]
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<td class="text_c"><%= history.try(:quotes).to_i %></td>
|
||||
<td class="text_c"><%= format_time(history.created_on) %></td>
|
||||
<td class="text_c">
|
||||
<%= link_to( '删除资源', attachment_path(history.attachment, :page => @curr_page, :history_id => history, :type => "history_delete"),
|
||||
<%= link_to( '删除资源', attachment_path(history.attachment, :page => @curr_page, :history_id => history, :type => "history_delete", :course => @course.id),
|
||||
:remote => true,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:method => :delete,
|
||||
|
@ -39,11 +39,11 @@
|
|||
</table>
|
||||
<div>
|
||||
<% if @attachment.container_type == "Project" %>
|
||||
<%= link_to( '删除所有资源', attachment_path(@attachment, :history_delete => true), :data => {:confirm => @attachment_histories_count.to_i > 0 ? l(:text_history_are_you_sure) : l(:text_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (is_project_manager?(User.current.id, @attachment.container_id) || User.current.id == @attachment.author_id || User.current.admin?) %>
|
||||
<%= link_to( '删除所有资源', attachment_path(@attachment, :history_delete => true, :course => @course.id), :data => {:confirm => @attachment_histories_count.to_i > 0 ? l(:text_history_are_you_sure) : l(:text_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (is_project_manager?(User.current.id, @attachment.container_id) || User.current.id == @attachment.author_id || User.current.admin?) %>
|
||||
<% elsif @attachment.container_type == "Course" %>
|
||||
<%= link_to( '删除所有资源', attachment_path(@attachment, :history_delete => true, :page => @curr_page), :data => {:confirm => @attachment_histories_count.to_i > 0 ? l(:text_history_are_you_sure) : l(:text_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (User.current.allowed_to?(:as_teacher, @attachment.container) || User.current.id == @attachment.author_id || User.current.admin?) %>
|
||||
<%= link_to( '删除所有资源', attachment_path(@attachment, :history_delete => true, :course => @course.id, :page => @curr_page), :data => {:confirm => @attachment_histories_count.to_i > 0 ? l(:text_history_are_you_sure) : l(:text_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (User.current.allowed_to?(:as_teacher, @attachment.container) || User.current.id == @attachment.author_id || User.current.admin?) %>
|
||||
<% elsif @attachment.container_type == "OrgSubfield" %>
|
||||
<%= link_to( '删除所有资源', attachment_path(@attachment, :history => true), :data => {:confirm => @attachment_histories_count.to_i > 0 ? l(:text_history_are_you_sure) : l(:text_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (User.current.id == @attachment.author_id || User.current.admin_of_org?(@attachment) || User.current.admin?) %>
|
||||
<%= link_to( '删除所有资源', attachment_path(@attachment, :history => true, :course => @course.id), :data => {:confirm => @attachment_histories_count.to_i > 0 ? l(:text_history_are_you_sure) : l(:text_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (User.current.id == @attachment.author_id || User.current.admin_of_org?(@attachment) || User.current.admin?) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<div class="mb10">
|
||||
<label class="fl c_dark f14" style="margin-top: 4px;">延期发布:</label>
|
||||
<div class="calendar_div fl">
|
||||
<input type="text" name="publish_time" id="datetimepicker_mask" readonly="readonly" placeholder="发布时间" style="width: 130px;" class="InputBox fl calendar_input" value="<%=format_time(@file.publish_time) %>">
|
||||
<input type="text" name="publish_time" id="datetimepicker_mask" readonly="readonly" placeholder="请选择时间" style="width: 130px;" class="InputBox fl calendar_input" value="<%=@file.is_publish == 1 ? "" : format_time(@file.publish_time) %>">
|
||||
<%#= calendar_for('attachment_publish_time')%>
|
||||
</div>
|
||||
<a href="javascript:void(0)" id="reset_time" class="fl sy_btn_grey ml10" style="display: none;" onclick="reset_publish_time();">清空</a>
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
</div>
|
||||
<%# unless file.description.blank? %>
|
||||
<div class="cl"></div>
|
||||
<% if User.current.admin? || ( User.current.logged? && ((is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file)) && ((delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course")) %>
|
||||
<% if User.current.admin? || ( User.current.logged? && ((is_course_teacher(User.current,@course) || file.author_id == User.current.id) && file.container_type == "Course")) %>
|
||||
<div>
|
||||
<div id="file_description_show_<%= file.id %>" class="fontGrey2 mb4 break_word">
|
||||
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
|
||||
|
@ -63,8 +63,8 @@
|
|||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<% if User.current.logged? || User.current.admin? %>
|
||||
<% if User.current.admin? || ((is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file)) %>
|
||||
<% if User.current.admin? || ((delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course") %>
|
||||
<% if User.current.admin? || ((is_course_teacher(User.current,@course) || file.author_id == User.current.id)) %>
|
||||
<% if User.current.admin? || ((delete_allowed || User.current.id == file.author_id) && file.container_type == "Course") %>
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
|
||||
<li><%= link_to '延期发布',file_hidden_course_file_path(@course,file),:class => "postOptionLink",:remote=>true %></li>
|
||||
|
@ -82,9 +82,9 @@
|
|||
<%end%>
|
||||
<li>
|
||||
<% if file.destroyable %>
|
||||
<%= link_to( '删除资源', attachment_path(file, :page => @curr_page),:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
|
||||
<%= link_to( '删除资源', attachment_path(file, :page => @curr_page, :course => @course.id),:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_type == "Course" %>
|
||||
<% else %>
|
||||
<%= link_to '删除资源',attachment_versions_delete_path(file, :page => @curr_page), :class => "postOptionLink", :remote => true %>
|
||||
<%= link_to '删除资源',attachment_versions_delete_path(file, :page => @curr_page, :course => @course.id), :class => "postOptionLink", :remote => true %>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -747,7 +747,7 @@
|
|||
<p>您增加了新的班级成员,详情如下:</p>
|
||||
<p>成员:<%= User.find(ma.course_message_id).login+"("+(User.find(ma.course_message_id).realname ? User.find(ma.course_message_id).realname : User.find(ma.course_message_id).login) +")" %></p>
|
||||
<p>班级名称:<%= ma.course.name %></p>
|
||||
<p>开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %></p>
|
||||
<p>开课学期:<%#= ma.course.time.to_s + '年'+ ma.course.term %></p>
|
||||
<p>班级ID:<%= ma.course.id %></p>
|
||||
<p>课时总数:<%= ma.course.class_period %></p>
|
||||
<% else %>
|
||||
|
|
Loading…
Reference in New Issue