add option to delete auction record

This commit is contained in:
Thiago Youssef 2022-10-02 09:58:33 -03:00
parent 487cbb1774
commit 75df2212da
5 changed files with 30 additions and 3 deletions

View file

@ -44,7 +44,7 @@ module Admin
if auction.save
reserved_domain = auction.domain if remove_from_reserved(auction)
flash[:notice] = "Auction #{params[:domain]} created.
flash[:notice] = "Auction #{params[:domain]} created.
#{reserved_domain.present? ? 'These domain will be removed from reserved list: ' + reserved_domain : ' '}"
else
flash[:alert] = 'Something goes wrong'
@ -53,6 +53,18 @@ module Admin
redirect_to admin_auctions_path
end
def destroy
auction = Auction.find(params[:id])
if auction.destroy
flash[:notice] = I18n.t('record_deleted')
else
flash.now[:alert] = I18n.t('failed_to_delete_record')
end
redirect_to admin_auctions_path
end
def upload_spreadsheet
if params[:q].nil?
flash[:alert] = 'No file upload! Look at the left of upload button!'