tap/app/views/products/_links.html.haml
2016-03-02 18:51:04 +01:00

11 lines
702 B
Text

- if controller_name == 'products' && can?(:manage, Product)
= link_to "Edit", edit_product_path(product), class: "btn btn-default"
= link_to "Delete", product_path(product), method: :delete, class: "btn btn-danger", data: {confirm: 'Are you sure?'}
- if controller_name == 'users'
.product_dagschotel
- if current_user.dagschotel != product
= button_to "Make dagschotel", { controller: 'users', action: 'update', "user[dagschotel_id]" => product.id }, method: :put, class: "btn btn-default"
- else
#remove_dagschotel
= button_to "Current dagschotel", { controller: 'users', action: 'update', "user[dagschotel_id]" => "nil" }, method: :put, class: "btn btn-success"