reenable heex_formatter

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

View File

@ -1,6 +1,6 @@
[
import_deps: [:ecto, :phoenix],
inputs: ["*.{heex,ex,exs}", "priv/*/seeds.exs", "{config,lib,test}/**/*.{heex,ex,exs}"],
subdirectories: ["priv/*/migrations"]
# plugins: [HeexFormatter]
subdirectories: ["priv/*/migrations"],
plugins: [HeexFormatter]
]

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">

View File

@ -41,7 +41,7 @@ defmodule Cannery.MixProject do
{:postgrex, ">= 0.0.0"},
{:phoenix_html, "~> 3.0"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:phoenix_live_view, "~> 0.17.5"},
{:phoenix_live_view, "~> 0.17", override: true},
{:floki, ">= 0.30.0", only: :test},
{:phoenix_live_dashboard, "~> 0.6"},
# {:esbuild, "~> 0.3", runtime: Mix.env() == :dev},

View File

@ -20,7 +20,7 @@
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
"floki": {:hex, :floki, "0.32.0", "f915dc15258bc997d49be1f5ef7d3992f8834d6f5695270acad17b41f5bcc8e2", [:mix], [{:html_entities, "~> 0.5.0", [hex: :html_entities, repo: "hexpm", optional: false]}], "hexpm", "1c5a91cae1fd8931c26a4826b5e2372c284813904c8bacb468b5de39c7ececbd"},
"gettext": {:hex, :gettext, "0.19.0", "6909d61b38bb33339558f128f8af5913d5d5fe304a770217bf352b1620fb7ec4", [:mix], [], "hexpm", "3f7a274f52ebda9bb6655dfeda3d6b0dc4537ae51ce41dcccc7f73ca7379ad5e"},
"heex_formatter": {:git, "https://github.com/feliperenan/heex_formatter.git", "9a536c107904d7500546645fe3d77743d747148f", []},
"heex_formatter": {:git, "https://github.com/feliperenan/heex_formatter.git", "c11931eb8f7e71f2f90fc9c77345a070d757b51b", []},
"html_entities": {:hex, :html_entities, "0.5.2", "9e47e70598da7de2a9ff6af8758399251db6dbb7eebe2b013f2bbd2515895c3c", [:mix], [], "hexpm", "c53ba390403485615623b9531e97696f076ed415e8d8058b1dbaa28181f4fdcc"},
"jason": {:hex, :jason, "1.3.0", "fa6b82a934feb176263ad2df0dbd91bf633d4a46ebfdffea0c8ae82953714946", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "53fc1f51255390e0ec7e50f9cb41e751c260d065dcba2bf0d08dc51a4002c2ac"},
"mime": {:hex, :mime, "2.0.2", "0b9e1a4c840eafb68d820b0e2158ef5c49385d17fb36855ac6e7e087d4b1dcc5", [:mix], [], "hexpm", "e6a3f76b4c277739e36c2e21a2c640778ba4c3846189d5ab19f97f126df5f9b7"},
@ -31,7 +31,7 @@
"phoenix_live_reload": {:hex, :phoenix_live_reload, "1.3.3", "3a53772a6118d5679bf50fc1670505a290e32a1d195df9e069d8c53ab040c054", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "766796676e5f558dbae5d1bdb066849673e956005e3730dfd5affd7a6da4abac"},
"phoenix_live_view": {:hex, :phoenix_live_view, "0.17.6", "3665f3ec426ac8d681cd7753ad4c85d2d247094dc4dc6add80dd6e3026045389", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.5.9 or ~> 1.6.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.1", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "62f06d4bbfc4dc5595070bc338119ab08e8e67a011e2923f9366419622149b9c"},
"phoenix_pubsub": {:hex, :phoenix_pubsub, "2.0.0", "a1ae76717bb168cdeb10ec9d92d1480fec99e3080f011402c0a2d68d47395ffb", [:mix], [], "hexpm", "c52d948c4f261577b9c6fa804be91884b381a7f8f18450c5045975435350f771"},
"phoenix_view": {:hex, :phoenix_view, "1.1.0", "149f053830ec3c19a2a8a67c208885a26e4c2b92cc4a9d54e03b633d68ef9add", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "dd219f768b3d97a224ed11e8a83f4fd0f3bd490434d3950d7c51a2e597a762f1"},
"phoenix_view": {:hex, :phoenix_view, "1.1.1", "11a945509d1270ef42bb19ca8f609aab378fc02543c2d4bdb8d243f1ca88f9b5", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "1f8148a9163ca4b40065ef177c9c56c0df174cf3596a27995a1a1657f0c949e7"},
"plug": {:hex, :plug, "1.12.1", "645678c800601d8d9f27ad1aebba1fdb9ce5b2623ddb961a074da0b96c35187d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d57e799a777bc20494b784966dc5fbda91eb4a09f571f76545b72a634ce0d30b"},
"plug_cowboy": {:hex, :plug_cowboy, "2.5.2", "62894ccd601cf9597e2c23911ff12798a8a18d237e9739f58a6b04e4988899fe", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "ea6e87f774c8608d60c8d34022a7d073bd7680a0a013f049fc62bf35efea1044"},
"plug_crypto": {:hex, :plug_crypto, "1.2.2", "05654514ac717ff3a1843204b424477d9e60c143406aa94daf2274fdd280794d", [:mix], [], "hexpm", "87631c7ad914a5a445f0a3809f99b079113ae4ed4b867348dd9eec288cecb6db"},