2013-07-05 17:08:09 +01:00
|
|
|
class Platforms::ContentsController < Platforms::BaseController
|
|
|
|
include PaginateHelper
|
|
|
|
|
2015-03-04 23:19:19 +00:00
|
|
|
before_action :authenticate_user!
|
|
|
|
skip_before_action :authenticate_user!, only: :index if APP_CONFIG['anonymous_access']
|
2013-07-05 17:08:09 +01:00
|
|
|
|
2014-10-30 17:30:39 +00:00
|
|
|
def index
|
2014-05-16 22:53:04 +01:00
|
|
|
respond_to do |format|
|
|
|
|
format.html
|
|
|
|
format.json do
|
2014-05-20 22:15:06 +01:00
|
|
|
@path = params[:path].to_s
|
|
|
|
@term = params[:term]
|
2014-10-30 17:30:39 +00:00
|
|
|
|
2014-05-16 22:53:04 +01:00
|
|
|
@contents = PlatformContent.find_by_platform(@platform, @path, @term)
|
2014-10-30 17:30:39 +00:00
|
|
|
@total_items = @contents.count
|
|
|
|
@contents = @contents.paginate(paginate_params)
|
2014-05-16 22:53:04 +01:00
|
|
|
end
|
|
|
|
end
|
2014-10-30 17:30:39 +00:00
|
|
|
|
2013-07-05 17:08:09 +01:00
|
|
|
end
|
|
|
|
|
2014-05-20 22:15:06 +01:00
|
|
|
def remove_file
|
2015-04-02 22:35:15 +01:00
|
|
|
authorize @platform
|
2014-05-20 22:15:06 +01:00
|
|
|
PlatformContent.remove_file(@platform, params[:path])
|
|
|
|
render nothing: true
|
2014-05-16 22:53:04 +01:00
|
|
|
end
|
|
|
|
|
2013-07-05 17:08:09 +01:00
|
|
|
end
|