rosa-build/app/controllers/platforms/contents_controller.rb

29 lines
699 B
Ruby
Raw Normal View History

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']
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-05-16 22:53:04 +01:00
@contents = PlatformContent.find_by_platform(@platform, @path, @term)
@total_items = @contents.count
@contents = @contents.paginate(paginate_params)
2014-05-16 22:53:04 +01:00
end
end
end
2014-05-20 22:15:06 +01:00
def remove_file
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
end