10 changed files with 53 additions and 7 deletions
@ -0,0 +1,29 @@
|
||||
class DoctrinesController < ApplicationController |
||||
load_and_authorize_resource :doctrine, class: "Doctrine" |
||||
|
||||
def index |
||||
@search = search_doctrines(search_params) |
||||
@doctrines = @search.results |
||||
|
||||
respond_to do |format| |
||||
format.html |
||||
end |
||||
end |
||||
|
||||
def show; end |
||||
|
||||
private |
||||
def search_doctrines(args) |
||||
Doctrine.search do |
||||
if args[:subject_ids].present? |
||||
with(:subject_ids).any_of(args[:subject_ids].map(&:to_i)) |
||||
end |
||||
|
||||
paginate page: args[:page] || 1, per_page: args[:per_page] || 100 |
||||
end |
||||
end |
||||
|
||||
def search_params |
||||
params.permit(subject_ids: []) |
||||
end |
||||
end |
||||
@ -0,0 +1,3 @@
|
||||
<div class="card container-sm mt-1"> |
||||
<%= render(DocumentDoctrineIndexComponent.with_collection(@doctrines, current_user: current_user, opts: { is_index: true })) %> |
||||
</div> |
||||
Loading…
Reference in new issue