diff --git a/assets/css/app.scss b/assets/css/app.scss index 2ae020b..e508a62 100644 --- a/assets/css/app.scss +++ b/assets/css/app.scss @@ -25,3 +25,6 @@ .no-valid-style .form-check-input.is-valid ~ .form-check-label { color: inherit !important; } +.table-nonfluid { + width: auto !important; +} diff --git a/lib/bones73k_web/live/property_live/index.html.leex b/lib/bones73k_web/live/property_live/index.html.leex index c0d32d7..3594806 100644 --- a/lib/bones73k_web/live/property_live/index.html.leex +++ b/lib/bones73k_web/live/property_live/index.html.leex @@ -1,4 +1,7 @@ -<h2>Listing Properties</h2> +<div class="d-flex justify-content-between d-flex align-items-end"> + <h2>Listing Properties</h2> + <span><%= live_patch "New Property", to: Routes.property_index_path(@socket, :new), class: "btn btn-primary" %></span> +</div> <%= if @live_action in [:new, :edit] do %> <%= live_modal @socket, Bones73kWeb.PropertyLive.FormComponent, @@ -29,18 +32,16 @@ <td> <%= if Roles.can?(@current_user, property, :show) do %> - <span><%= live_redirect "Show", to: Routes.property_show_path(@socket, :show, property) %></span> + <%= live_redirect "Show", to: Routes.property_show_path(@socket, :show, property), class: "link-secondary mx-1" %> <% end %> <%= if Roles.can?(@current_user, property, :edit) do %> - <span><%= live_patch "Edit", to: Routes.property_index_path(@socket, :edit, property) %></span> + <%= live_patch "Edit", to: Routes.property_index_path(@socket, :edit, property), class: "mx-1" %> <% end %> <%= if Roles.can?(@current_user, property, :delete) do %> - <span><%= link "Delete", to: "#", phx_click: "delete", phx_value_id: property.id, data: [confirm: "Are you sure?"] %></span> + <%= link "Delete", to: "#", phx_click: "delete", phx_value_id: property.id, data: [confirm: "Are you sure?"], class: "link-danger mx-1" %> <% end %> </td> </tr> <% end %> </tbody> </table> - -<span><%= live_patch "New Property", to: Routes.property_index_path(@socket, :new) %></span> diff --git a/lib/bones73k_web/live/property_live/show.html.leex b/lib/bones73k_web/live/property_live/show.html.leex index cba90a6..e178fcc 100644 --- a/lib/bones73k_web/live/property_live/show.html.leex +++ b/lib/bones73k_web/live/property_live/show.html.leex @@ -1,4 +1,4 @@ -<h1>Show Property</h1> +<h2>Show Property</h2> <%= if @live_action in [:edit] do %> <%= live_modal @socket, Bones73kWeb.PropertyLive.FormComponent, @@ -9,28 +9,26 @@ return_to: Routes.property_show_path(@socket, :show, @property) %> <% end %> -<ul> +<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> - <li> - <strong>Name:</strong> - <%= @property.name %> - </li> - - <li> - <strong>Price:</strong> - <%= @property.price %> - </li> - - <li> - <strong>Description:</strong> - <%= @property.description %> - </li> - -</ul> - -<%= if Roles.can?(@current_user, @property, :edit) do %> - <span><%= live_patch "Edit", to: Routes.property_show_path(@socket, :edit, @property), class: "button" %></span> -<% end %> <%= if Roles.can?(@current_user, @property, :index) do %> - <span><%= live_redirect "Back", to: Routes.property_index_path(@socket, :index) %></span> + <%= 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 %>