37 lines
1.8 KiB
Plaintext
37 lines
1.8 KiB
Plaintext
<div class= "w-full">
|
|
<% if notice.present? %>
|
|
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-md inline-block" id="notice"><%= notice %></p>
|
|
<% end %>
|
|
|
|
<div>
|
|
<%= link_to "Products", products_path, class: "rounded-lg px-5 py-3 bg-gray-100 hover:bg-gray-50 inline-block font-medium mb-6" %>
|
|
</div>
|
|
|
|
<h1 class="font-bold text-4xl">Showing product</h1>
|
|
<div class="grid grid-cols-2">
|
|
<div class= "max-w-md w-full mx-auto">
|
|
<%= image_tag @product.images.first, class:"w-full h-96 object-cover" %>
|
|
<div class= "grid grid-cols-3 gap-4 mt-4">
|
|
<% @product.images[1..].each do |image| %>
|
|
<%= image_tag image, class: "w-full h-32 object-cover mt-2 mr-2" %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<h1 class= "text-5xl font-broken mt-4 text-indigo-900"><%= @product.name %></h1>
|
|
<p class="mt-6 text-lg text-indigo-700"><%= @product.description %></p>
|
|
<br>
|
|
<span class="bg-green-500 p-2 rounded-lg text-green-50">$<%= @product.price %></span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% if current_admin %>
|
|
<div class="w-full flex justify-center items-center mt-16">
|
|
<%= link_to "Edit this product", edit_product_path(@product), class: "rounded-lg px-5 py-3 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
|
|
<%= link_to "Back to products", products_path, class: "w-full sm:w-auto text-center sm:mt-0 sm:ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
|
|
<%= button_to "Delete this product", @product, method: :delete, form_class: "sm:inline-block mt-2 sm:mt-0 sm:ml-2", class: "w-full rounded-md px-3.5 py-2.5 text-white bg-red-600 hover:bg-red-500 font-medium cursor-pointer", data: { turbo_confirm: "Are you sure?" } %>
|
|
<% end %>
|
|
</div>
|