Merge branch 'dev_aliyun' into dev_chen

PCqiandao
cxt 5 years ago
commit 3170c71495

@ -43,7 +43,7 @@ class FilesController < ApplicationController
@attachments = @attachments.by_keywords(params[:search])
if params[:no_link]
@attachments = @attachments.where(link: nil)
@attachments = @attachments.no_link
end
@attachments = @attachments.page(@page).per(@page_size)
@ -142,7 +142,7 @@ class FilesController < ApplicationController
end
def public_with_course_and_project
@attachments = Attachment.publiced.simple_columns
@attachments = Attachment.publiced.no_link.simple_columns
.contains_course_and_project
.includes(:container, author: :user_extension)
.by_filename_or_user_name(params[:search])
@ -155,7 +155,7 @@ class FilesController < ApplicationController
def mine_with_course_and_project
@current_user = current_user
@attachments = Attachment.mine(current_user)
@attachments = Attachment.mine(current_user).no_link
.simple_columns
.contains_course_and_project
.by_keywords(params[:search])

@ -25,6 +25,7 @@ class Attachment < ApplicationRecord
scope :search_by_container, -> (ids) {where(container_id: ids)}
scope :unified_setting, -> {where("unified_setting = ? ", 1)}
scope :published, -> {where(is_publish: 1)}
scope :no_link, -> {where(link: nil)}
validates_length_of :description, maximum: 100, message: "不能超过100个字符"

Loading…
Cancel
Save