bones73k/lib/bones73k_web/live/property_live/show.html.leex
2021-03-03 10:16:11 -05:00

34 lines
1 KiB
Text

<h2>Show Property</h2>
<%= if @live_action in [:edit] do %>
<%= live_modal @socket, Bones73kWeb.PropertyLive.FormComponent,
id: @property.id,
title: @page_title,
action: @live_action,
property: @property,
return_to: Routes.property_show_path(@socket, :show, @property) %>
<% end %>
<table class="table table-nonfluid">
<tbody>
<tr>
<th scope="row" class="text-end">Name</th>
<td><%= @property.name %></td>
</tr>
<tr>
<th scope="row" class="text-end">Price</th>
<td><%= @property.price %></td>
</tr>
<tr>
<th scope="row" class="text-end">Description</th>
<td><%= @property.description %></td>
</tr>
</tbody>
</table>
<%= if Roles.can?(@current_user, @property, :index) do %>
<%= live_redirect "Back", to: Routes.property_index_path(@socket, :index), class: "btn btn-secondary" %>
<% end %>
<%= if Roles.can?(@current_user, @property, :edit) do %>
<%= live_patch "Edit", to: Routes.property_show_path(@socket, :edit, @property), class: "btn btn-primary" %>
<% end %>