Added possibilty to delete pricelist from admin #2380

This commit is contained in:
Priit Tark 2015-07-13 11:18:16 +03:00
parent b0296bd33e
commit f5b5c1fb25
3 changed files with 10 additions and 2 deletions

View file

@ -32,6 +32,11 @@ class Admin::PricelistsController < AdminController
end end
end end
def destroy
@pricelist.destroy
redirect_to admin_pricelists_url
end
private private
def set_pricelist def set_pricelist

View file

@ -29,5 +29,7 @@
%hr %hr
.row .row
.col-md-12.text-right .col-md-12.text-right
= button_tag(t(:save), class: 'btn btn-primary') = button_tag(t(:save), class: 'btn btn-warning')
- if !f.object.new_record? && can?(:delete, f.object)
= link_to t(:delete), admin_pricelist_path(f.object),
method: :delete, data: { confirm: t(:are_you_sure_destroy) }, class: 'btn btn-danger'

View file

@ -291,6 +291,7 @@ en:
description: 'Description' description: 'Description'
delete: 'Delete' delete: 'Delete'
are_you_sure: 'Are you sure?' are_you_sure: 'Are you sure?'
are_you_sure_destroy: 'You are going to delete, are you sure?'
back: 'Back' back: 'Back'
new_domain: 'New domain' new_domain: 'New domain'
registrar_name: 'Registrar name' registrar_name: 'Registrar name'