Initial commit
This commit is contained in:
28
app/controllers/video_analyses/music_releases_controller.rb
Normal file
28
app/controllers/video_analyses/music_releases_controller.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
class VideoAnalyses::MusicReleasesController < ApplicationController
|
||||
before_action :set_video
|
||||
|
||||
def index
|
||||
@music_release_file_infos = filtered_file_infos
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_video
|
||||
@video = Video.find(params[:video_id])
|
||||
end
|
||||
|
||||
def query_param
|
||||
params[:query]
|
||||
end
|
||||
|
||||
def filtered_file_infos
|
||||
releasables = policy_scope(@video.project.music_releases)
|
||||
results = FileInfo.where(releasable: releasables)
|
||||
|
||||
if query_param.present?
|
||||
results = results.search_filename(query_param)
|
||||
end
|
||||
|
||||
results
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user