Added vehicle scaffold
Some checks are pending
CI / scan_ruby (push) Waiting to run
CI / scan_js (push) Waiting to run
CI / lint (push) Waiting to run
CI / test (push) Waiting to run

This commit is contained in:
2024-08-20 19:50:29 +02:00
parent 1bd24e08d0
commit 132ea2c51d
20 changed files with 379 additions and 1 deletions

View File

@@ -0,0 +1,39 @@
<%= form_with(model: vehicle, class: "contents") do |form| %>
<% if vehicle.errors.any? %>
<div id="error_explanation" class="px-3 py-2 mt-3 font-medium text-red-500 rounded-lg bg-red-50">
<h2><%= pluralize(vehicle.errors.count, "error") %> prohibited this vehicle from being saved:</h2>
<ul>
<% vehicle.errors.each do |error| %>
<li><%= error.full_message %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="my-5">
<%= form.label :license_plate %>
<%= form.text_field :license_plate, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
</div>
<div class="my-5">
<%= form.label :vehicle_type %>
<%= form.text_field :vehicle_type, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
</div>
<div class="my-5">
<%= form.label :model_year %>
<%= form.text_field :model_year, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
</div>
<div class="my-5">
<%= form.label :car_brand %>
<%= form.text_field :car_brand, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
</div>
<div class="my-5">
<%= form.label :model %>
<%= form.text_field :model, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
</div>
<div class="my-5">
<%= form.label :fuel_type %>
<%= form.text_field :fuel_type, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
</div>
<div class="inline">
<%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
</div>
<% end %>

View File

@@ -0,0 +1,46 @@
<div id="<%= dom_id vehicle %>">
<p class="my-5">
<strong class="block mb-1 font-medium">Angemeldet:</strong>
<%= vehicle.registered %>
</p>
<p class="my-5">
<strong class="block mb-1 font-medium">License plate:</strong>
<%= vehicle.license_plate %>
</p>
<p class="my-5">
<strong class="block mb-1 font-medium">Type:</strong>
<%= vehicle.vehicle_type %>
</p>
<p class="my-5">
<strong class="block mb-1 font-medium">Baujahr:</strong>
<%= vehicle.model_year %>
</p>
<p class="my-5">
<strong class="block mb-1 font-medium">Marke:</strong>
<%= vehicle.car_brand %>
</p>
<p class="my-5">
<strong class="block mb-1 font-medium">Modell:</strong>
<%= vehicle.model %>
</p>
<p class="my-5">
<strong class="block mb-1 font-medium">Treibstoffart:</strong>
<%= vehicle.fuel_type %>
</p>
<p class="my-5">
<strong class="block mb-1 font-medium">PS:</strong>
<%= vehicle.power_ps %>
</p>
<p class="my-5">
<strong class="block mb-1 font-medium">KW:</strong>
<%= vehicle.power_kw %>
</p>
<p class="my-5">
<strong class="block mb-1 font-medium">Farbe:</strong>
<%= vehicle.color %>
</p>
<p class="my-5">
<strong class="block mb-1 font-medium">Notizen:</strong>
<%= vehicle.note %>
</p>
</div>

View File

@@ -0,0 +1,2 @@
json.extract! vehicle, :id, :license_plate, :type, :model_year, :car_brand, :model, :fuel_type, :created_at, :updated_at
json.url vehicle_url(vehicle, format: :json)

View File

@@ -0,0 +1,8 @@
<div class="mx-auto md:w-2/3 w-full">
<h1 class="font-bold text-4xl">Editing vehicle</h1>
<%= render "form", vehicle: @vehicle %>
<%= link_to "Show this vehicle", @vehicle, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
<%= link_to "Back to vehicles", vehicles_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
</div>

View File

@@ -0,0 +1,21 @@
<div class="w-full">
<% if notice.present? %>
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%= notice %></p>
<% end %>
<% content_for :title, "Vehicles" %>
<div class="flex justify-between items-center">
<h1 class="font-bold text-4xl">Vehicles</h1>
<%= link_to "New vehicle", new_vehicle_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %>
</div>
<div id="vehicles" class="min-w-full">
<% @vehicles.each do |vehicle| %>
<%= render vehicle %>
<p>
<%= link_to "Show this vehicle", vehicle, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
</p>
<% end %>
</div>
</div>

View File

@@ -0,0 +1 @@
json.array! @vehicles, partial: "vehicles/vehicle", as: :vehicle

View File

@@ -0,0 +1,7 @@
<div class="mx-auto md:w-2/3 w-full">
<h1 class="font-bold text-4xl">New vehicle</h1>
<%= render "form", vehicle: @vehicle %>
<%= link_to "Back to vehicles", vehicles_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
</div>

View File

@@ -0,0 +1,15 @@
<div class="mx-auto md:w-2/3 w-full flex">
<div class="mx-auto">
<% if notice.present? %>
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%= notice %></p>
<% end %>
<%= render @vehicle %>
<%= link_to "Edit this vehicle", edit_vehicle_path(@vehicle), class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
<%= link_to "Back to vehicles", vehicles_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
<div class="inline-block ml-2">
<%= button_to "Destroy this vehicle", @vehicle, method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium" %>
</div>
</div>
</div>

View File

@@ -0,0 +1 @@
json.partial! "vehicles/vehicle", vehicle: @vehicle