hack in only allowing bulk uploads of max 10
This commit is contained in:
parent
9e68871ef6
commit
daceb1d21c
1 changed files with 12 additions and 4 deletions
|
@ -8,11 +8,19 @@ class Admin::EvidencesController < Admin::BaseController
|
|||
end
|
||||
|
||||
def create
|
||||
params[:evidence][:screenshot].each do |screenshot|
|
||||
Evidence.new(screenshot: screenshot).save
|
||||
end
|
||||
evidence = params[:evidence][:screenshot]
|
||||
|
||||
redirect_to admin_evidences_path, notice: 'Evidence was created'
|
||||
if evidence.size > 10
|
||||
@evidence = Evidence.new
|
||||
flash.now[:notice] = 'Only 10 evidence can be submitted at once'
|
||||
render :new
|
||||
else
|
||||
evidence.each do |screenshot|
|
||||
Evidence.new(screenshot: screenshot).save
|
||||
end
|
||||
|
||||
redirect_to admin_evidences_path, notice: 'Evidence was created'
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
Loading…
Reference in a new issue