资源的更新

newyslclassrooms
cxt 5 years ago
parent 88c3dbb284
commit a91d610d65

@ -289,6 +289,11 @@ class FilesController < ApplicationController
@old_attachment.save!
@new_attachment.delete
end
if params[:name].present? && params[:link].present?
tip_exception("资源名称不能超过60个字符") if params[:name].strip.length > 60
@old_attachment.filename = params[:name].strip
@old_attachment.link = params[:link].strip
end
@old_attachment.is_public = is_public == true && @course.is_public == 1 ? 1 : 0
@old_attachment.is_publish = @atta_is_publish
@old_attachment.delay_publish = @atta_delay_publish

@ -1,5 +1,6 @@
json.id attachment.id
json.title attachment.title
json.link attachment.link
json.is_public attachment.publiced?
# json.is_lock attachment.locked?(@is_member)
json.is_lock !attachment.publiced?
@ -15,4 +16,4 @@ json.created_on attachment.created_on
json.content_type attachment.content_type
json.is_pdf attachment.is_pdf?
json.url attachment.is_pdf? ? download_url(attachment,disposition:"inline") : download_url(attachment)
json.play_url attachment_show_users_path(file_name: local_path(attachment))
json.play_url attachment.link.present? ? nil : attachment_show_users_path(file_name: local_path(attachment))

Loading…
Cancel
Save