Add error msg for null file while Adding Commercial for event

Null file error message added for uploading empty file in CommercialsController#mass_upload

Closes #1959
This commit is contained in:
AnkushMalik 2018-01-12 17:41:20 +05:30 committed by James Mason
parent 59f6d94366
commit 913210347f

View file

@ -57,7 +57,9 @@ module Admin
def mass_upload
errors = Commercial.read_file(params[:file]) if params[:file]
if errors.all? { |_k, v| v.blank? }
if !params[:file]
flash[:error] = 'Empty file detected while adding commercials to Event'
elsif errors.all? { |_k, v| v.blank? }
flash[:notice] = 'Successfully added commercials.'
else
errors_text = ''