mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-20 04:59:16 +00:00
Add upload of Terms of Service files
Admins can upload files and view the most recent (current) one.
This commit is contained in:
@@ -3,6 +3,25 @@
|
||||
module Admin
|
||||
class TermsOfServiceFilesController < Spree::Admin::BaseController
|
||||
def show
|
||||
@current_file = TermsOfServiceFile.current
|
||||
@new_file = TermsOfServiceFile.new
|
||||
end
|
||||
|
||||
def create
|
||||
TermsOfServiceFile.create!(file_params)
|
||||
redirect_to main_app.admin_terms_of_service_files_path
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Needed by Spree::Admin::BaseController#authorize_admin or it
|
||||
# tries to find a Spree model.
|
||||
def model_class
|
||||
TermsOfServiceFile
|
||||
end
|
||||
|
||||
def file_params
|
||||
params.require(:terms_of_service_file).permit(:attachment)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user