app/controllers/georgia/api/media_controller.rb in georgia-0.7.8 vs app/controllers/georgia/api/media_controller.rb in georgia-0.8.0
- old
+ new
@@ -1,11 +1,13 @@
module Georgia
module Api
class MediaController < Georgia::ApplicationController
def pictures
- @search = Georgia::Indexer.search(Ckeditor::Picture, params.merge(per: 12))
- @pictures = Ckeditor::PictureDecorator.decorate_collection(@search.results)
+ authorize Ckeditor::Asset
+ search_conditions = Georgia::MediaSearch.new(params.merge(only: [:pictures])).definition
+ @search = Ckeditor::Asset.search(search_conditions).page(params[:page]).per(params.fetch(:per, 12))
+ @pictures = Ckeditor::PictureDecorator.decorate_collection(@search.records)
render layout: false
end
end
end
\ No newline at end of file