mirror of
https://github.com/ash-project/ash_phoenix.git
synced 2024-09-08 09:30:49 +12:00
chore: update templates
This commit is contained in:
parent
4118388623
commit
bca5a2dcf8
7 changed files with 14 additions and 16 deletions
|
@ -270,7 +270,7 @@ defmodule AshPhoenix.Gen.Live do
|
|||
nil ->
|
||||
"""
|
||||
#{short_name} = #{get_by_pkey}
|
||||
#{inspect(domain)}.destroy!(#{short_name}#{actor_opt(opts)})
|
||||
Ash.destroy!(#{short_name}#{actor_opt(opts)})
|
||||
"""
|
||||
|
||||
interface ->
|
||||
|
@ -290,7 +290,7 @@ defmodule AshPhoenix.Gen.Live do
|
|||
end)
|
||||
|> case do
|
||||
nil ->
|
||||
"#{inspect(domain)}.get!(#{inspect(resource)}, #{pkey}#{actor_opt(opts)})"
|
||||
"Ash.get!(#{inspect(resource)}, #{pkey}#{actor_opt(opts)})"
|
||||
|
||||
interface ->
|
||||
"#{inspect(resource)}.#{interface.name}!(#{pkey}#{actor_opt(opts)})"
|
||||
|
|
|
@ -93,7 +93,7 @@ defmodule AshPhoenix.LiveView do
|
|||
To support this, accept a second parameter to your callback function, which will be the options to use in `page_opts`
|
||||
|
||||
## Options:
|
||||
#{NimbleOptions.docs(@opts)}
|
||||
#{Spark.Options.docs(@opts)}
|
||||
|
||||
A great way to get readable millisecond values is to use the functions in erlang's `:timer` module,
|
||||
like `:timer.hours/1`, `:timer.minutes/1`, and `:timer.seconds/1`
|
||||
|
@ -137,7 +137,7 @@ defmodule AshPhoenix.LiveView do
|
|||
|
||||
@spec keep_live(socket, assign, callback, liveness_options) :: socket
|
||||
def keep_live(socket, assign, callback, opts \\ []) do
|
||||
opts = NimbleOptions.validate!(opts, @opts)
|
||||
opts = S.validate!(opts, @opts)
|
||||
|
||||
if opts[:load_until_connected?] && match?(%Phoenix.LiveView.Socket{}, socket) &&
|
||||
!Phoenix.LiveView.connected?(socket) do
|
||||
|
|
1
mix.exs
1
mix.exs
|
@ -129,7 +129,6 @@ defmodule AshPhoenix.MixProject do
|
|||
{:phoenix, "~> 1.5.6 or ~> 1.6"},
|
||||
{:phoenix_html, "~> 4.0"},
|
||||
{:phoenix_live_view, "~> 0.20.3"},
|
||||
{:nimble_options, "~> 1.1"},
|
||||
{:simple_sat, "~> 0.1", only: [:dev, :test]},
|
||||
{:git_ops, "~> 2.5", only: [:dev, :test]},
|
||||
{:ex_doc, "~> 0.23", only: [:dev, :test], runtime: false},
|
||||
|
|
3
mix.lock
3
mix.lock
|
@ -1,5 +1,5 @@
|
|||
%{
|
||||
"ash": {:hex, :ash, "3.0.0-rc.1", "ab922a15d85f4c2ee2250908239cf8dda3ffdbdcac4664b7814afdd024428046", [:mix], [{:comparable, "~> 1.0", [hex: :comparable, repo: "hexpm", optional: false]}, {:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:ecto, "~> 3.7", [hex: :ecto, repo: "hexpm", optional: false]}, {:ets, "~> 0.8", [hex: :ets, repo: "hexpm", optional: false]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: false]}, {:picosat_elixir, "~> 0.2", [hex: :picosat_elixir, repo: "hexpm", optional: true]}, {:plug, ">= 0.0.0", [hex: :plug, repo: "hexpm", optional: true]}, {:reactor, "~> 0.8", [hex: :reactor, repo: "hexpm", optional: false]}, {:simple_sat, ">= 0.1.1 and < 1.0.0-0", [hex: :simple_sat, repo: "hexpm", optional: true]}, {:spark, ">= 2.1.7 and < 3.0.0-0", [hex: :spark, repo: "hexpm", optional: false]}, {:splode, "~> 0.2", [hex: :splode, repo: "hexpm", optional: false]}, {:stream_data, "~> 0.6", [hex: :stream_data, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.1", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "bf3e579867f3ed15e219789fe47965473b1639aae68c383579fbc4a982e11f85"},
|
||||
"ash": {:hex, :ash, "3.0.0-rc.3", "9d2af1a4baef19ef0ef8a7f4bbdbbd640d54d62b484cdfd42e583d88c566115f", [:mix], [{:comparable, "~> 1.0", [hex: :comparable, repo: "hexpm", optional: false]}, {:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:ecto, "~> 3.7", [hex: :ecto, repo: "hexpm", optional: false]}, {:ets, "~> 0.8", [hex: :ets, repo: "hexpm", optional: false]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: false]}, {:picosat_elixir, "~> 0.2", [hex: :picosat_elixir, repo: "hexpm", optional: true]}, {:plug, ">= 0.0.0", [hex: :plug, repo: "hexpm", optional: true]}, {:reactor, "~> 0.8", [hex: :reactor, repo: "hexpm", optional: false]}, {:simple_sat, ">= 0.1.1 and < 1.0.0-0", [hex: :simple_sat, repo: "hexpm", optional: true]}, {:spark, ">= 2.1.7 and < 3.0.0-0", [hex: :spark, repo: "hexpm", optional: false]}, {:splode, "~> 0.2", [hex: :splode, repo: "hexpm", optional: false]}, {:stream_data, "~> 0.6", [hex: :stream_data, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.1", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "83a16dace30aabb1f623e6f1b405cfe1af14f87a1411b1af9bbc745cd968a373"},
|
||||
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
|
||||
"castore": {:hex, :castore, "1.0.6", "ffc42f110ebfdafab0ea159cd43d31365fa0af0ce4a02ecebf1707ae619ee727", [:mix], [], "hexpm", "374c6e7ca752296be3d6780a6d5b922854ffcc74123da90f2f328996b962d33a"},
|
||||
"comparable": {:hex, :comparable, "1.0.0", "bb669e91cedd14ae9937053e5bcbc3c52bb2f22422611f43b6e38367d94a495f", [:mix], [{:typable, "~> 0.1", [hex: :typable, repo: "hexpm", optional: false]}], "hexpm", "277c11eeb1cd726e7cd41c6c199e7e52fa16ee6830b45ad4cdc62e51f62eb60c"},
|
||||
|
@ -22,7 +22,6 @@
|
|||
"makeup_elixir": {:hex, :makeup_elixir, "0.16.2", "627e84b8e8bf22e60a2579dad15067c755531fea049ae26ef1020cad58fe9578", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "41193978704763f6bbe6cc2758b84909e62984c7752b3784bd3c218bb341706b"},
|
||||
"makeup_erlang": {:hex, :makeup_erlang, "0.1.5", "e0ff5a7c708dda34311f7522a8758e23bfcd7d8d8068dc312b5eb41c6fd76eba", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "94d2e986428585a21516d7d7149781480013c56e30c6a233534bedf38867a59a"},
|
||||
"mime": {:hex, :mime, "2.0.5", "dc34c8efd439abe6ae0343edbb8556f4d63f178594894720607772a041b04b02", [:mix], [], "hexpm", "da0d64a365c45bc9935cc5c8a7fc5e49a0e0f9932a761c55d6c52b142780a05c"},
|
||||
"nimble_options": {:hex, :nimble_options, "1.1.0", "3b31a57ede9cb1502071fade751ab0c7b8dbe75a9a4c2b5bbb0943a690b63172", [:mix], [], "hexpm", "8bbbb3941af3ca9acc7835f5655ea062111c9c27bcac53e004460dfd19008a99"},
|
||||
"nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"},
|
||||
"phoenix": {:hex, :phoenix, "1.7.11", "1d88fc6b05ab0c735b250932c4e6e33bfa1c186f76dcf623d8dd52f07d6379c7", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.7", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:websock_adapter, "~> 0.5.3", [hex: :websock_adapter, repo: "hexpm", optional: false]}], "hexpm", "b1ec57f2e40316b306708fe59b92a16b9f6f4bf50ccfa41aa8c7feb79e0ec02a"},
|
||||
"phoenix_html": {:hex, :phoenix_html, "4.1.1", "4c064fd3873d12ebb1388425a8f2a19348cef56e7289e1998e2d2fa758aa982e", [:mix], [], "hexpm", "f2f2df5a72bc9a2f510b21497fd7d2b86d932ec0598f0210fed4114adc546c6f"},
|
||||
|
|
|
@ -69,10 +69,10 @@ defmodule <%= @app_name %>Web.<%= @resource %>Controller do
|
|||
end
|
||||
|
||||
defp create_form(params \\ nil) do
|
||||
AshPhoenix.Form.for_create(<%= @resource %>, :create, as: "<%= @singular %>", domain: <%= @full_domain %>, params: params)
|
||||
AshPhoenix.Form.for_create(<%= @resource %>, :create, as: "<%= @singular %>", params: params)
|
||||
end
|
||||
|
||||
defp update_form(<%= @singular %>, params \\ nil) do
|
||||
AshPhoenix.Form.for_update(<%= @singular %>, :update, as: "<%= @singular %>", domain: <%= @full_domain %>, params: params)
|
||||
AshPhoenix.Form.for_update(<%= @singular %>, :update, as: "<%= @singular %>", params: params)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -87,14 +87,14 @@ defmodule <%= inspect Module.concat(@web_module, @resource_alias) %>Live.FormCom
|
|||
<%= cond do %>
|
||||
<% @update_action && @create_action -> %>
|
||||
if <%= @resource_singular %> do
|
||||
AshPhoenix.Form.for_update(<%= @resource_singular %>, <%= inspect @update_action.name %>, domain: <%= @domain %>, as: <%= inspect @resource_singular %><%= @actor_opt %>)
|
||||
AshPhoenix.Form.for_update(<%= @resource_singular %>, <%= inspect @update_action.name %>, as: <%= inspect @resource_singular %><%= @actor_opt %>)
|
||||
else
|
||||
AshPhoenix.Form.for_create(<%= @resource %>, <%= inspect @create_action.name %>, domain: <%= @domain %>, as: <%= inspect @resource_singular %><%= @actor_opt %>)
|
||||
AshPhoenix.Form.for_create(<%= @resource %>, <%= inspect @create_action.name %>, as: <%= inspect @resource_singular %><%= @actor_opt %>)
|
||||
end
|
||||
<% @update_action -> %>
|
||||
AshPhoenix.Form.for_update(<%= @resource_singular %>, <%= inspect @update_action.name %>, domain: <%= @domain %>, as: <%= inspect @resource_singular %><%= @actor_opt %>)
|
||||
AshPhoenix.Form.for_update(<%= @resource_singular %>, <%= inspect @update_action.name %>, as: <%= inspect @resource_singular %><%= @actor_opt %>)
|
||||
<% @create_action -> %>
|
||||
AshPhoenix.Form.for_create(<%= @resource_singular %>, <%= inspect @create_action.name %>, domain: <%= @domain %>, as: <%= inspect @resource_singular %><%= @actor_opt %>)
|
||||
AshPhoenix.Form.for_create(<%= @resource_singular %>, <%= inspect @create_action.name %>, as: <%= inspect @resource_singular %><%= @actor_opt %>)
|
||||
<% end %>
|
||||
|
||||
assign(socket, form: to_form(form))
|
||||
|
|
|
@ -96,13 +96,13 @@ defmodule <%= inspect Module.concat(@web_module, @resource_alias) %>Live.Index d
|
|||
{:ok,
|
||||
socket
|
||||
<%= if @actor do %>
|
||||
|> stream(:<%= @resource_plural %>, <%= @domain %>.read!(<%= @resource %>, actor: socket.assigns[:<%= @actor %>]))
|
||||
|> stream(:<%= @resource_plural %>, Ash.read!(<%= @resource %>, actor: socket.assigns[:<%= @actor %>]))
|
||||
<% else %>
|
||||
|> stream(:<%= @resource_plural %>, <%= @domain %>.read!(<%= @resource %>))
|
||||
|> stream(:<%= @resource_plural %>, Ash.read!(<%= @resource %>))
|
||||
<% end %>
|
||||
|> assign_new(:<%= @actor %>, fn -> nil end)}
|
||||
<% else %>
|
||||
{:ok, stream(socket, :<%= @resource_plural %>, <%= @domain %>.read!(<%= @resource %>))}
|
||||
{:ok, stream(socket, :<%= @resource_plural %>, Ash.read!(<%= @resource %>))}
|
||||
<% end %>
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue