Skip to content

Commit

Permalink
Add delete button for cars
Browse files Browse the repository at this point in the history
  • Loading branch information
nickskyline committed Aug 9, 2024
1 parent ef00ce2 commit 025e2a1
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/controllers/cars_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,11 @@ def import

# DELETE /cars/1 or /cars/1.json
def destroy
category_path = car_category_path(@car.category)
@car.destroy

respond_to do |format|
format.html { redirect_to cars_url, :notice => t("rva.cars.controller.destroy") }
format.html { redirect_to category_path , :notice => t("rva.cars.controller.destroy") }
format.json { head :no_content }
end
end
Expand Down
1 change: 1 addition & 0 deletions app/views/cars/show.haml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@
%img.thumbnail.center-block.img-responsive{src: @car.thumbnail_url}
- if user_is_admin?
= link_to t("rva.cars.edit.button"), edit_car_path(@car), :class => "btn mt-2"
= link_to t("rva.cars.edit.delete"), @car, data: { turbo: true, turbo_method: :delete, turbo_confirm: t("results.admin.delete.confirmation.body") }, :class => "btn mt-2"
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ en:
folder-name: "Folder name"
update: "Update"
error: "Car could not be saved"
delete: "Delete Car"
import:
title: "Import Cars"
controller:
Expand Down
1 change: 1 addition & 0 deletions config/locales/en_gb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ en-GB:
folder-name: "Folder name"
update: "Update"
error: "Car could not be saved"
delete: "Delete Car"
import:
title: "Import Cars"
controller:
Expand Down
1 change: 1 addition & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ es:
folder-name: "Nombre de carpeta"
update: "Actualizar"
error: "Car could not be saved"
delete: "Borrar auto"
import:
title: "Import Cars"
controller:
Expand Down
1 change: 1 addition & 0 deletions config/locales/es_ar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ es-AR:
folder-name: "Nombre de carpeta"
update: "Actualizar"
error: "Car could not be saved"
delete: "Eliminar auto"
import:
title: "Import Cars"
controller:
Expand Down
1 change: 1 addition & 0 deletions config/locales/es_cl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ es-CL:
folder-name: "Nombre de carpeta"
update: "Actualizar"
error: "No se pudo guardar el auto"
delete: "Eliminar auto"
import:
title: "Importar autos"
controller:
Expand Down
1 change: 1 addition & 0 deletions config/locales/it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ it:
folder-name: "Nome di cartella"
update: "Aggiorna"
error: "Car could not be saved"
delete: "Cancella auto"
import:
title: "Import Cars"
controller:
Expand Down
1 change: 1 addition & 0 deletions config/locales/ko.yml
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ ko:
folder-name: "Folder name"
update: "Update"
error: "Car could not be saved"
delete: "Delete car"
import:
title: "Import Cars"
controller:
Expand Down
1 change: 1 addition & 0 deletions config/locales/lol.yml
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ lol:
folder-name: "Fuldr naem"
update: "Updaet"
error: "Ka kuld nut b savd"
delete: "dheleet kaa"
import:
title: "Gif Kaz"
controller:
Expand Down
1 change: 1 addition & 0 deletions config/locales/pt_br.yml
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ pt:
folder-name: "Nome da pasta"
update: "Atualizar"
error: "Carro não pode ser salvo"
delete: "Excluir carro"
import:
title: "Importar carros"
controller:
Expand Down

0 comments on commit 025e2a1

Please sign in to comment.