reenable heex_formatter

This commit is contained in:
2022-02-01 01:08:18 -05:00
parent 3e73f33a6d
commit c75816a582
12 changed files with 127 additions and 65 deletions

View File

@ -73,15 +73,13 @@ defmodule CanneryWeb.Component.Topbar do
<%= link to: Routes.user_session_path(CanneryWeb.Endpoint, :delete),
method: :delete,
data: [confirm: "Are you sure you want to log out?"] do %>
<i class="fas fa-sign-out-alt">
</i>
<i class="fas fa-sign-out-alt"></i>
<% end %>
</li>
<%= if @current_user.role == :admin and function_exported?(Routes, :live_dashboard_path, 2) do %>
<li>
<%= link to: Routes.live_dashboard_path(CanneryWeb.Endpoint, :home) do %>
<i class="fas fa-tachometer-alt">
</i>
<i class="fas fa-tachometer-alt"></i>
<% end %>
</li>
<% end %>

View File

@ -8,21 +8,29 @@
No Ammo 😔
</h2>
<%= live_patch "Add your first box!",
<%= live_patch("Add your first box!",
to: Routes.ammo_group_index_path(@socket, :new),
class: "btn btn-primary" %>
class: "btn btn-primary"
) %>
<% else %>
<%= live_patch "New Ammo group",
<%= live_patch("New Ammo group",
to: Routes.ammo_group_index_path(@socket, :new),
class: "btn btn-primary" %>
class: "btn btn-primary"
) %>
<div class="w-full overflow-x-auto border border-gray-600 rounded-lg shadow-lg bg-black">
<table class="min-w-full table-auto text-center bg-white">
<thead class="border-b border-primary-600">
<tr>
<th class="p-2">Count</th>
<th class="p-2">Price paid</th>
<th class="p-2">Notes</th>
<th class="p-2">
Count
</th>
<th class="p-2">
Price paid
</th>
<th class="p-2">
Notes
</th>
<th class="p-2"></th>
</tr>
@ -30,14 +38,31 @@
<tbody id="ammo_groups">
<%= for ammo_group <- @ammo_groups do %>
<tr id={ammo_group-"#{ammo_group.id}"}>
<td class="p-2"><%= ammo_group.count %></td>
<td class="p-2"><%= ammo_group.price_paid %></td>
<td class="p-2"><%= ammo_group.notes %></td>
<td class="p-2">
<%= ammo_group.count %>
</td>
<td class="p-2">
<%= ammo_group.price_paid %>
</td>
<td class="p-2">
<%= ammo_group.notes %>
</td>
<td class="p-2 w-full h-full space-y-2 flex flex-col justify-center items-center">
<span><%= live_redirect "Show", to: Routes.ammo_group_show_path(@socket, :show, ammo_group) %></span>
<span><%= live_patch "Edit", to: Routes.ammo_group_index_path(@socket, :edit, ammo_group) %></span>
<span><%= link "Delete", to: "#", phx_click: "delete", phx_value_id: ammo_group.id, data: [confirm: "Are you sure?"] %></span>
<span>
<%= live_redirect("Show", to: Routes.ammo_group_show_path(@socket, :show, ammo_group)) %>
</span>
<span>
<%= live_patch("Edit", to: Routes.ammo_group_index_path(@socket, :edit, ammo_group)) %>
</span>
<span>
<%= link("Delete",
to: "#",
phx_click: "delete",
phx_value_id: ammo_group.id,
data: [confirm: "Are you sure?"]
) %>
</span>
</td>
</tr>
<% end %>
@ -48,10 +73,11 @@
</div>
<%= if @live_action in [:new, :edit] do %>
<%= live_modal CanneryWeb.AmmoGroupLive.FormComponent,
<%= live_modal(CanneryWeb.AmmoGroupLive.FormComponent,
id: @ammo_group.id || :new,
title: @page_title,
action: @live_action,
ammo_group: @ammo_group,
return_to: Routes.ammo_group_index_path(@socket, :index) %>
return_to: Routes.ammo_group_index_path(@socket, :index)
) %>
<% end %>

View File

@ -57,7 +57,8 @@ defmodule CanneryWeb.AmmoTypeLive.FormComponent do
<%= label(f, :desc, class: "mr-4 title text-lg text-primary-500") %>
<%= textarea(f, :desc,
class: "text-center col-span-2 input input-primary",
phx_hook: "MaintainAttrs") %>
phx_hook: "MaintainAttrs"
) %>
<div class="col-span-3 text-center">
<%= error_tag(f, :desc) %>
</div>
@ -78,7 +79,8 @@ defmodule CanneryWeb.AmmoTypeLive.FormComponent do
<%= number_input(f, :grain,
step: "any",
class: "text-center col-span-2 input input-primary",
min: 0) %>
min: 0
) %>
<div class="col-span-3 text-center">
<%= error_tag(f, :grain) %>
</div>
@ -91,7 +93,8 @@ defmodule CanneryWeb.AmmoTypeLive.FormComponent do
<%= submit("Save",
phx_disable_with: "Saving...",
class: "mx-auto col-span-3 btn btn-primary") %>
class: "mx-auto col-span-3 btn btn-primary"
) %>
</.form>
</div>
"""

View File

@ -8,23 +8,35 @@
No Ammo Types 😔
</h2>
<%= live_patch "Add your first type!",
<%= live_patch("Add your first type!",
to: Routes.ammo_type_index_path(@socket, :new),
class: "btn btn-primary" %>
class: "btn btn-primary"
) %>
<% else %>
<%= live_patch "New Ammo type",
<%= live_patch("New Ammo type",
to: Routes.ammo_type_index_path(@socket, :new),
class: "btn btn-primary" %>
class: "btn btn-primary"
) %>
<div class="w-full overflow-x-auto border border-gray-600 rounded-lg shadow-lg bg-black">
<table class="min-w-full table-auto text-center bg-white">
<thead class="border-b border-primary-600">
<tr>
<th class="p-2">Name</th>
<th class="p-2">Case material</th>
<th class="p-2">Bullet type</th>
<th class="p-2">Grain</th>
<th class="p-2">Manufacturer</th>
<th class="p-2">
Name
</th>
<th class="p-2">
Case material
</th>
<th class="p-2">
Bullet type
</th>
<th class="p-2">
Grain
</th>
<th class="p-2">
Manufacturer
</th>
<th class="p-2"></th>
</tr>
@ -32,16 +44,37 @@
<tbody>
<%= for ammo_type <- @ammo_types do %>
<tr id={"ammo_type-#{ammo_type.id}"}>
<td class="p-2"><%= ammo_type.name %></td>
<td class="p-2"><%= ammo_type.case_material %></td>
<td class="p-2"><%= ammo_type.bullet_type %></td>
<td class="p-2"><%= ammo_type.grain %></td>
<td class="p-2"><%= ammo_type.manufacturer %></td>
<td class="p-2">
<%= ammo_type.name %>
</td>
<td class="p-2">
<%= ammo_type.case_material %>
</td>
<td class="p-2">
<%= ammo_type.bullet_type %>
</td>
<td class="p-2">
<%= ammo_type.grain %>
</td>
<td class="p-2">
<%= ammo_type.manufacturer %>
</td>
<td class="p-2 w-full h-full space-y-2 flex flex-col justify-center items-center">
<span><%= live_redirect "Show", to: Routes.ammo_type_show_path(@socket, :show, ammo_type) %></span>
<span><%= live_patch "Edit", to: Routes.ammo_type_index_path(@socket, :edit, ammo_type) %></span>
<span><%= link "Delete", to: "#", phx_click: "delete", phx_value_id: ammo_type.id, data: [confirm: "Are you sure?"] %></span>
<span>
<%= live_redirect("Show", to: Routes.ammo_type_show_path(@socket, :show, ammo_type)) %>
</span>
<span>
<%= live_patch("Edit", to: Routes.ammo_type_index_path(@socket, :edit, ammo_type)) %>
</span>
<span>
<%= link("Delete",
to: "#",
phx_click: "delete",
phx_value_id: ammo_type.id,
data: [confirm: "Are you sure?"]
) %>
</span>
</td>
</tr>
<% end %>
@ -52,10 +85,11 @@
</div>
<%= if @live_action in [:new, :edit] do %>
<%= live_modal CanneryWeb.AmmoTypeLive.FormComponent,
<%= live_modal(CanneryWeb.AmmoTypeLive.FormComponent,
id: @ammo_type.id || :new,
title: @page_title,
action: @live_action,
ammo_type: @ammo_type,
return_to: Routes.ammo_type_index_path(@socket, :index) %>
return_to: Routes.ammo_type_index_path(@socket, :index)
) %>
<% end %>

View File

@ -4,8 +4,8 @@
</h1>
<div class="flex space-x-4 justify-center items-center text-primary-500">
<%= live_redirect "Back", to: Routes.ammo_type_index_path(@socket, :index), class: "link" %>
<%= live_patch "Edit", to: Routes.ammo_type_show_path(@socket, :edit, @ammo_type), class: "button" %>
<%= live_redirect("Back", to: Routes.ammo_type_index_path(@socket, :index), class: "link") %>
<%= live_patch("Edit", to: Routes.ammo_type_show_path(@socket, :edit, @ammo_type), class: "button") %>
<%= link("Delete",
to: "#",
class: "link",
@ -45,10 +45,11 @@
</div>
<%= if @live_action in [:edit] do %>
<%= live_modal CanneryWeb.AmmoTypeLive.FormComponent,
<%= live_modal(CanneryWeb.AmmoTypeLive.FormComponent,
id: @ammo_type.id,
title: @page_title,
action: @live_action,
ammo_type: @ammo_type,
return_to: Routes.ammo_type_show_path(@socket, :show, @ammo_type) %>
return_to: Routes.ammo_type_show_path(@socket, :show, @ammo_type)
) %>
<% end %>

View File

@ -8,21 +8,24 @@
No containers 😔
</h2>
<%= live_patch "Add your first container!",
<%= live_patch("Add your first container!",
to: Routes.container_index_path(@socket, :new),
class: "btn btn-primary" %>
class: "btn btn-primary"
) %>
<% else %>
<%= live_patch to: Routes.container_index_path(@socket, :new),
class: "btn btn-primary" do %>
class: "btn btn-primary" do %>
New Container
<% end %>
<% end %>
<div class="flex flex-row flex-wrap">
<%= for container <- @containers do %>
<div id={"container-#{container.id}"}
<div
id={"container-#{container.id}"}
class="px-8 py-4 flex flex-col justify-center items-center
border border-gray-400 rounded-lg shadow-lg hover:shadow-md">
border border-gray-400 rounded-lg shadow-lg hover:shadow-md"
>
<div class="mb-4 flex flex-col justify-center items-center">
<h1 class="px-4 py-2 rounded-lg title text-xl">
<%= container.name %>

View File

@ -26,8 +26,7 @@ defmodule CanneryWeb.ModalComponent do
<%= live_patch to: @return_to,
class:
"absolute top-8 right-10 text-gray-500 hover:text-gray-800 transition-all duration-500 ease-in-out" do %>
<i class="fa-fw fa-lg fas fa-times">
</i>
<i class="fa-fw fa-lg fas fa-times"></i>
<% end %>
<div class="w-full flex flex-col space-y-4 justify-center items-center">
<%= live_component(@component, @opts) %>

View File

@ -10,9 +10,10 @@
No tags 😔
</h2>
<%= live_patch "Make your first tag!",
<%= live_patch("Make your first tag!",
to: Routes.tag_index_path(@socket, :new),
class: "btn btn-primary" %>
class: "btn btn-primary"
) %>
<% else %>
<%= live_patch("New Tag",
to: Routes.tag_index_path(@socket, :new),
@ -34,16 +35,14 @@
</h1>
<%= live_patch to: Routes.tag_index_path(@socket, :edit, tag),
class: "text-primary-500 link" do %>
<i class="fa-fw fa-lg fas fa-edit">
</i>
<i class="fa-fw fa-lg fas fa-edit"></i>
<% end %>
<%= link to: "#",
class: "text-primary-500 link",
phx_click: "delete",
phx_value_id: tag.id,
data: [confirm: "Are you sure you want to delete #{tag.name}?"] do %>
<i class="fa-fw fa-lg fas fa-trash">
</i>
<i class="fa-fw fa-lg fas fa-trash"></i>
<% end %>
</div>
<% end %>

View File

@ -1,7 +1,6 @@
<main class="container min-w-full min-h-full">
<header>
<CanneryWeb.Component.Topbar.topbar current_user={assigns[:current_user]}>
</CanneryWeb.Component.Topbar.topbar>
<CanneryWeb.Component.Topbar.topbar current_user={assigns[:current_user]}></CanneryWeb.Component.Topbar.topbar>
<div class="mx-8 my-2 flex flex-col space-y-4 text-center">
<%= if @flash && @flash |> Map.has_key?(:info) do %>
<p class="alert alert-info" role="alert" phx-click="lv:clear-flash" phx-value-key="info">