diff --git a/apps/admin/lib/admin/router.ex b/apps/admin/lib/admin/router.ex index 88255c38..6040e1cd 100644 --- a/apps/admin/lib/admin/router.ex +++ b/apps/admin/lib/admin/router.ex @@ -7,6 +7,7 @@ defmodule Admin.Router do plug :fetch_flash plug :protect_from_forgery plug :put_secure_browser_headers + plug :put_layout, {CoreWeb.LayoutView, :app} end pipeline :require_admin do diff --git a/apps/admin/lib/admin/templates/layout/app.html.eex b/apps/admin/lib/admin/templates/layout/app.html.eex deleted file mode 100644 index 0cd26560..00000000 --- a/apps/admin/lib/admin/templates/layout/app.html.eex +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - <%= I18n.t! "en", "site.title" %> - "/> - - - -
-
- - -
-
-
- - - <%= @inner_content %> -
- - diff --git a/apps/app/lib/app/application.ex b/apps/app/lib/app/application.ex index 2da053e0..8263563a 100644 --- a/apps/app/lib/app/application.ex +++ b/apps/app/lib/app/application.ex @@ -9,23 +9,23 @@ defmodule App.Application do children = [ App.Repo, # Start the Telemetry supervisor - App.Telemetry, + AppWeb.Telemetry, # Start the Endpoint (http/https) - App.Endpoint - # Start a worker by calling: App.Worker.start_link(arg) - # {App.Worker, arg} + AppWeb.Endpoint + # Start a worker by calling: AppWeb.Worker.start_link(arg) + # {AppWeb.Worker, arg} ] # See https://hexdocs.pm/elixir/Supervisor.html # for other strategies and supported options - opts = [strategy: :one_for_one, name: App.Supervisor] + opts = [strategy: :one_for_one, name: AppWeb.Supervisor] Supervisor.start_link(children, opts) end # Tell Phoenix to update the endpoint configuration # whenever the application is updated. def config_change(changed, _new, removed) do - App.Endpoint.config_change(changed, removed) + AppWeb.Endpoint.config_change(changed, removed) :ok end end diff --git a/apps/app/lib/app/controllers/page_controller.ex b/apps/app/lib/app/controllers/page_controller.ex deleted file mode 100644 index aa1a16b0..00000000 --- a/apps/app/lib/app/controllers/page_controller.ex +++ /dev/null @@ -1,7 +0,0 @@ -defmodule App.PageController do - use App, :controller - - def index(conn, _params) do - render(conn, "index.html") - end -end diff --git a/apps/app/lib/app/templates/layout/app.html.eex b/apps/app/lib/app/templates/layout/app.html.eex deleted file mode 100644 index 324e96fd..00000000 --- a/apps/app/lib/app/templates/layout/app.html.eex +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - App ยท Phoenix Framework - "/> - - - -
-
- - -
-
-
- - - <%= @inner_content %> -
- - diff --git a/apps/app/lib/app/views/layout_view.ex b/apps/app/lib/app/views/layout_view.ex deleted file mode 100644 index 0e714273..00000000 --- a/apps/app/lib/app/views/layout_view.ex +++ /dev/null @@ -1,3 +0,0 @@ -defmodule App.LayoutView do - use App, :view -end diff --git a/apps/app/lib/app/views/page_view.ex b/apps/app/lib/app/views/page_view.ex deleted file mode 100644 index 1eab08c0..00000000 --- a/apps/app/lib/app/views/page_view.ex +++ /dev/null @@ -1,3 +0,0 @@ -defmodule App.PageView do - use App, :view -end diff --git a/apps/app/lib/app.ex b/apps/app/lib/app_web.ex similarity index 77% rename from apps/app/lib/app.ex rename to apps/app/lib/app_web.ex index a9eeb150..6814d321 100644 --- a/apps/app/lib/app.ex +++ b/apps/app/lib/app_web.ex @@ -1,12 +1,12 @@ -defmodule App do +defmodule AppWeb do @moduledoc """ The entrypoint for defining your web interface, such as controllers, views, channels and so on. This can be used in your application as: - use App, :controller - use App, :view + use AppWeb, :controller + use AppWeb, :view The definitions below will be executed for every view, controller, etc, so keep them short and clean, focused @@ -19,19 +19,19 @@ defmodule App do def controller do quote do - use Phoenix.Controller, namespace: App + use Phoenix.Controller, namespace: AppWeb import Plug.Conn - import App.Gettext - alias App.Router.Helpers, as: Routes + import AppWeb.Gettext + alias AppWeb.Router.Helpers, as: Routes end end def view do quote do use Phoenix.View, - root: "lib/app/templates", - namespace: App + root: "lib/app_web/templates", + namespace: AppWeb # Import convenience functions from controllers import Phoenix.Controller, @@ -54,7 +54,7 @@ defmodule App do def channel do quote do use Phoenix.Channel - import App.Gettext + import AppWeb.Gettext end end @@ -66,9 +66,10 @@ defmodule App do # Import basic rendering functionality (render, render_layout, etc) import Phoenix.View - import App.ErrorHelpers - import App.Gettext - alias App.Router.Helpers, as: Routes + import CoreWeb.Helpers + import AppWeb.ErrorHelpers + import AppWeb.Gettext + alias AppWeb.Router.Helpers, as: Routes end end diff --git a/apps/app/lib/app/channels/user_socket.ex b/apps/app/lib/app_web/channels/user_socket.ex similarity index 86% rename from apps/app/lib/app/channels/user_socket.ex rename to apps/app/lib/app_web/channels/user_socket.ex index 0671409e..e2bef5dd 100644 --- a/apps/app/lib/app/channels/user_socket.ex +++ b/apps/app/lib/app_web/channels/user_socket.ex @@ -1,8 +1,8 @@ -defmodule App.UserSocket do +defmodule AppWeb.UserSocket do use Phoenix.Socket ## Channels - # channel "room:*", App.RoomChannel + # channel "room:*", AppWeb.RoomChannel # Socket params are passed from the client and can # be used to verify and authenticate a user. After @@ -27,7 +27,7 @@ defmodule App.UserSocket do # Would allow you to broadcast a "disconnect" event and terminate # all active sockets and channels for a given user: # - # App.Endpoint.broadcast("user_socket:#{user.id}", "disconnect", %{}) + # AppWeb.Endpoint.broadcast("user_socket:#{user.id}", "disconnect", %{}) # # Returning `nil` makes this socket anonymous. @impl true diff --git a/apps/app/lib/app_web/controllers/.keep b/apps/app/lib/app_web/controllers/.keep new file mode 100644 index 00000000..e69de29b diff --git a/apps/app/lib/app/endpoint.ex b/apps/app/lib/app_web/endpoint.ex similarity index 94% rename from apps/app/lib/app/endpoint.ex rename to apps/app/lib/app_web/endpoint.ex index 235cce5d..8d9afb90 100644 --- a/apps/app/lib/app/endpoint.ex +++ b/apps/app/lib/app_web/endpoint.ex @@ -1,4 +1,4 @@ -defmodule App.Endpoint do +defmodule AppWeb.Endpoint do use Phoenix.Endpoint, otp_app: :app # The session will be stored in the cookie and signed, @@ -10,7 +10,7 @@ defmodule App.Endpoint do signing_salt: "VQMRz57g" ] - socket "/socket", App.UserSocket, + socket "/socket", AppWeb.UserSocket, websocket: true, longpoll: false @@ -50,5 +50,5 @@ defmodule App.Endpoint do plug Plug.MethodOverride plug Plug.Head plug Plug.Session, @session_options - plug App.Router + plug AppWeb.Router end diff --git a/apps/app/lib/app/gettext.ex b/apps/app/lib/app_web/gettext.ex similarity index 91% rename from apps/app/lib/app/gettext.ex rename to apps/app/lib/app_web/gettext.ex index 3a56cab2..19bc04ee 100644 --- a/apps/app/lib/app/gettext.ex +++ b/apps/app/lib/app_web/gettext.ex @@ -1,11 +1,11 @@ -defmodule App.Gettext do +defmodule AppWeb.Gettext do @moduledoc """ A module providing Internationalization with a gettext-based API. By using [Gettext](https://hexdocs.pm/gettext), your module gains a set of macros for translations, for example: - import App.Gettext + import AppWeb.Gettext # Simple translation gettext("Here is the string to translate") diff --git a/apps/app/lib/app/router.ex b/apps/app/lib/app_web/router.ex similarity index 80% rename from apps/app/lib/app/router.ex rename to apps/app/lib/app_web/router.ex index ab50c8be..cff22100 100644 --- a/apps/app/lib/app/router.ex +++ b/apps/app/lib/app_web/router.ex @@ -1,5 +1,5 @@ -defmodule App.Router do - use App, :router +defmodule AppWeb.Router do + use AppWeb, :router pipeline :browser do plug :accepts, ["html"] @@ -7,20 +7,21 @@ defmodule App.Router do plug :fetch_flash plug :protect_from_forgery plug :put_secure_browser_headers + plug :put_layout, {CoreWeb.LayoutView, :app} end pipeline :api do plug :accepts, ["json"] end - scope "/", App do + scope "/", AppWeb do pipe_through :browser get "/", PageController, :index end # Other scopes may use custom stacks. - # scope "/api", App do + # scope "/api", AppWeb do # pipe_through :api # end @@ -36,7 +37,7 @@ defmodule App.Router do scope "/" do pipe_through :browser - live_dashboard "/dashboard", metrics: App.Telemetry + live_dashboard "/dashboard", metrics: AppWeb.Telemetry end end end diff --git a/apps/app/lib/app/telemetry.ex b/apps/app/lib/app_web/telemetry.ex similarity index 96% rename from apps/app/lib/app/telemetry.ex rename to apps/app/lib/app_web/telemetry.ex index f3f06bfa..84cd681f 100644 --- a/apps/app/lib/app/telemetry.ex +++ b/apps/app/lib/app_web/telemetry.ex @@ -1,4 +1,4 @@ -defmodule App.Telemetry do +defmodule AppWeb.Telemetry do use Supervisor import Telemetry.Metrics @@ -49,7 +49,7 @@ defmodule App.Telemetry do [ # A module, function and arguments to be invoked periodically. # This function must call :telemetry.execute/3 and a metric must be added above. - # {App, :count_users, []} + # {AppWeb, :count_users, []} ] end end diff --git a/apps/app/lib/app/templates/page/index.html.eex b/apps/app/lib/app_web/templates/page/index.html.eex similarity index 100% rename from apps/app/lib/app/templates/page/index.html.eex rename to apps/app/lib/app_web/templates/page/index.html.eex diff --git a/apps/app/lib/app/views/error_helpers.ex b/apps/app/lib/app_web/views/error_helpers.ex similarity index 89% rename from apps/app/lib/app/views/error_helpers.ex rename to apps/app/lib/app_web/views/error_helpers.ex index 09a4f5a8..2e891a28 100644 --- a/apps/app/lib/app/views/error_helpers.ex +++ b/apps/app/lib/app_web/views/error_helpers.ex @@ -1,4 +1,4 @@ -defmodule App.ErrorHelpers do +defmodule AppWeb.ErrorHelpers do @moduledoc """ Conveniences for translating and building error messages. """ @@ -39,9 +39,9 @@ defmodule App.ErrorHelpers do # should be written to the errors.po file. The :count option is # set by Ecto and indicates we should also apply plural rules. if count = opts[:count] do - Gettext.dngettext(App.Gettext, "errors", msg, msg, count, opts) + Gettext.dngettext(AppWeb.Gettext, "errors", msg, msg, count, opts) else - Gettext.dgettext(App.Gettext, "errors", msg, opts) + Gettext.dgettext(AppWeb.Gettext, "errors", msg, opts) end end end diff --git a/apps/app/lib/app/views/error_view.ex b/apps/app/lib/app_web/views/error_view.ex similarity index 89% rename from apps/app/lib/app/views/error_view.ex rename to apps/app/lib/app_web/views/error_view.ex index d4c50665..a6651a5c 100644 --- a/apps/app/lib/app/views/error_view.ex +++ b/apps/app/lib/app_web/views/error_view.ex @@ -1,5 +1,5 @@ -defmodule App.ErrorView do - use App, :view +defmodule AppWeb.ErrorView do + use AppWeb, :view # If you want to customize a particular status code # for a certain format, you may uncomment below. diff --git a/apps/app/lib/app_web/views/layout_view.ex b/apps/app/lib/app_web/views/layout_view.ex new file mode 100644 index 00000000..80c818d5 --- /dev/null +++ b/apps/app/lib/app_web/views/layout_view.ex @@ -0,0 +1,3 @@ +defmodule AppWeb.LayoutView do + use AppWeb, :view +end diff --git a/apps/app/lib/app_web/views/page_view.ex b/apps/app/lib/app_web/views/page_view.ex new file mode 100644 index 00000000..8ba34d2e --- /dev/null +++ b/apps/app/lib/app_web/views/page_view.ex @@ -0,0 +1,3 @@ +defmodule AppWeb.PageView do + use AppWeb, :view +end diff --git a/apps/app/mix.exs b/apps/app/mix.exs index f8a07973..95ea7028 100644 --- a/apps/app/mix.exs +++ b/apps/app/mix.exs @@ -37,6 +37,7 @@ defmodule App.MixProject do # Type `mix help deps` for examples and options. defp deps do [ + {:core, in_umbrella: true}, {:ecto_sql, "~> 3.4"}, {:phoenix, "~> 1.5.3"}, {:phoenix_ecto, "~> 4.0"}, diff --git a/apps/app/priv/templates/phx.gen.html/edit.html.eex b/apps/app/priv/templates/phx.gen.html/edit.html.eex index a846d727..31523ad4 100644 --- a/apps/app/priv/templates/phx.gen.html/edit.html.eex +++ b/apps/app/priv/templates/phx.gen.html/edit.html.eex @@ -1,5 +1,19 @@ -

Edit <%= schema.human_singular %>

+
+
+
+
+

Edit <%= schema.human_singular %>

+
+
+ <%%= link "Back", to: Routes.<%= schema.route_helper %>_path(@conn, :index), class: "ui button" %> +
+
-<%%= render "form.html", Map.put(assigns, :action, Routes.<%= schema.route_helper %>_path(@conn, :update, @<%= schema.singular %>)) %> - -<%%= link "Back", to: Routes.<%= schema.route_helper %>_path(@conn, :index) %> +
+
+ <%%= changeset_error_block(@changeset) %> + <%%= render "form.html", Map.put(assigns, :action, Routes.<%= schema.route_helper %>_path(@conn, :update, @<%= schema.singular %>)) %> +
+
+
+
diff --git a/apps/app/priv/templates/phx.gen.html/form.html.eex b/apps/app/priv/templates/phx.gen.html/form.html.eex index ed872808..2bfda549 100644 --- a/apps/app/priv/templates/phx.gen.html/form.html.eex +++ b/apps/app/priv/templates/phx.gen.html/form.html.eex @@ -1,15 +1,10 @@ -<%%= form_for @changeset, @action, fn f -> %> - <%%= if @changeset.action do %> -
-

Oops, something went wrong! Please check the errors below.

-
- <%% end %> -<%= for {label, input, error} <- inputs, input do %> - <%= label %> - <%= input %> - <%= error %> +<%%= form_for @changeset, @action, [class: "ui large form"], fn f -> %> +
+<%= for input <- Mix.Legendary.inputs(schema) do %> + <%= input %> <% end %> -
- <%%= submit "Save" %> +
+ <%%= submit "Save", class: "ui primary fluid large submit button" %> +
<%% end %> diff --git a/apps/app/priv/templates/phx.gen.html/index.html.eex b/apps/app/priv/templates/phx.gen.html/index.html.eex index b3d271ab..99ca3f19 100644 --- a/apps/app/priv/templates/phx.gen.html/index.html.eex +++ b/apps/app/priv/templates/phx.gen.html/index.html.eex @@ -1,26 +1,46 @@ -

Listing <%= schema.human_plural %>

+
+
+
+
+

<%= schema.human_plural %>

+
+
+ <%%= link "New <%= schema.human_singular %>", to: Routes.<%= schema.route_helper %>_path(@conn, :new), class: "ui primary button" %> +
+
+
- - - -<%= for {k, _} <- schema.attrs do %> -<% end %> - - - - -<%%= for <%= schema.singular %> <- @<%= schema.plural %> do %> - -<%= for {k, _} <- schema.attrs do %> -<% end %> - - -<%% end %> - -
<%= Phoenix.Naming.humanize(Atom.to_string(k)) %>
<%%= <%= schema.singular %>.<%= k %> %> - <%%= link "Show", to: Routes.<%= schema.route_helper %>_path(@conn, :show, <%= schema.singular %>) %> - <%%= link "Edit", to: Routes.<%= schema.route_helper %>_path(@conn, :edit, <%= schema.singular %>) %> - <%%= link "Delete", to: Routes.<%= schema.route_helper %>_path(@conn, :delete, <%= schema.singular %>), method: :delete, data: [confirm: "Are you sure?"] %> -
- -<%%= link "New <%= schema.human_singular %>", to: Routes.<%= schema.route_helper %>_path(@conn, :new) %> + + + + <%= for {k, _} <- schema.attrs do %> + <% end %> + + + + + <%%= case @<%= schema.plural %> do %> + <%%= [] -> %> + + + + <%%= _ -> %> + <%%= for <%= schema.singular %> <- @<%= schema.plural %> do %> + + <%= for {k, _} <- schema.attrs do %> + <% end %> + + + <%% end %> + <%% end %> + +
<%= Phoenix.Naming.humanize(Atom.to_string(k)) %>
+ No results. +
<%%= <%= schema.singular %>.<%= k %> %> +
+ <%%= link "Show", to: Routes.<%= schema.route_helper %>_path(@conn, :show, <%= schema.singular %>) %> + <%%= link "Edit", to: Routes.<%= schema.route_helper %>_path(@conn, :edit, <%= schema.singular %>) %> + <%%= link "Delete", to: Routes.<%= schema.route_helper %>_path(@conn, :delete, <%= schema.singular %>), method: :delete, data: [confirm: "Are you sure?"] %> +
+
+
diff --git a/apps/app/priv/templates/phx.gen.html/new.html.eex b/apps/app/priv/templates/phx.gen.html/new.html.eex index 135bafae..4c477f09 100644 --- a/apps/app/priv/templates/phx.gen.html/new.html.eex +++ b/apps/app/priv/templates/phx.gen.html/new.html.eex @@ -1,5 +1,19 @@ -

New <%= schema.human_singular %>

+
+
+
+
+

New <%= schema.human_singular %>

+
+
+ <%%= link "Back", to: Routes.<%= schema.route_helper %>_path(@conn, :index), class: "ui button" %> +
+
-<%%= render "form.html", Map.put(assigns, :action, Routes.<%= schema.route_helper %>_path(@conn, :create)) %> - -<%%= link "Back", to: Routes.<%= schema.route_helper %>_path(@conn, :index) %> +
+
+ <%%= changeset_error_block(@changeset) %> + <%%= render "form.html", Map.put(assigns, :action, Routes.<%= schema.route_helper %>_path(@conn, :create)) %> +
+
+
+
diff --git a/apps/app/priv/templates/phx.gen.html/show.html.eex b/apps/app/priv/templates/phx.gen.html/show.html.eex index c19a2c95..6c61f7ef 100644 --- a/apps/app/priv/templates/phx.gen.html/show.html.eex +++ b/apps/app/priv/templates/phx.gen.html/show.html.eex @@ -1,13 +1,26 @@ -

Show <%= schema.human_singular %>

+
+
+
+
+

<%= schema.human_singular %>

+
+
+ <%%= link "Edit", to: Routes.<%= schema.route_helper %>_path(@conn, :edit, @<%= schema.singular %>), class: "ui button primary" %> + <%%= link "Back", to: Routes.<%= schema.route_helper %>_path(@conn, :index), class: "ui button" %> +
+
+
- - -<%%= link "Edit", to: Routes.<%= schema.route_helper %>_path(@conn, :edit, @<%= schema.singular %>) %> -<%%= link "Back", to: Routes.<%= schema.route_helper %>_path(@conn, :index) %> +
+
+ <%= for {k, _} <- schema.attrs do %> +
+
+ <%= Phoenix.Naming.humanize(Atom.to_string(k)) %>: + <%%= @<%= schema.singular %>.<%= k %> %> +
+
+ <% end %> +
+
+
diff --git a/apps/app/test/app/controllers/.keep b/apps/app/test/app/controllers/.keep new file mode 100644 index 00000000..e69de29b diff --git a/apps/app/test/app/controllers/page_controller_test.exs b/apps/app/test/app/controllers/page_controller_test.exs deleted file mode 100644 index 49d138db..00000000 --- a/apps/app/test/app/controllers/page_controller_test.exs +++ /dev/null @@ -1,8 +0,0 @@ -defmodule App.PageControllerTest do - use App.ConnCase - - test "GET /", %{conn: conn} do - conn = get(conn, "/") - assert html_response(conn, 200) =~ "Welcome to Phoenix!" - end -end diff --git a/apps/app/test/app/views/error_view_test.exs b/apps/app/test/app/views/error_view_test.exs index 6c9b7279..75c5b503 100644 --- a/apps/app/test/app/views/error_view_test.exs +++ b/apps/app/test/app/views/error_view_test.exs @@ -1,14 +1,14 @@ -defmodule App.ErrorViewTest do +defmodule AppWeb.ErrorViewTest do use App.ConnCase, async: true # Bring render/3 and render_to_string/3 for testing custom views import Phoenix.View test "renders 404.html" do - assert render_to_string(App.ErrorView, "404.html", []) == "Not Found" + assert render_to_string(AppWeb.ErrorView, "404.html", []) == "Not Found" end test "renders 500.html" do - assert render_to_string(App.ErrorView, "500.html", []) == "Internal Server Error" + assert render_to_string(AppWeb.ErrorView, "500.html", []) == "Internal Server Error" end end diff --git a/apps/app/test/support/channel_case.ex b/apps/app/test/support/channel_case.ex index 2c398c00..3294f0ab 100644 --- a/apps/app/test/support/channel_case.ex +++ b/apps/app/test/support/channel_case.ex @@ -24,7 +24,7 @@ defmodule App.ChannelCase do import App.ChannelCase # The default endpoint for testing - @endpoint App.Endpoint + @endpoint AppWeb.Endpoint end end diff --git a/apps/app/test/support/conn_case.ex b/apps/app/test/support/conn_case.ex index 9140712f..88cb2e36 100644 --- a/apps/app/test/support/conn_case.ex +++ b/apps/app/test/support/conn_case.ex @@ -27,7 +27,7 @@ defmodule App.ConnCase do alias App.Router.Helpers, as: Routes # The default endpoint for testing - @endpoint App.Endpoint + @endpoint AppWeb.Endpoint end end diff --git a/apps/auth_web/lib/auth_web/router.ex b/apps/auth_web/lib/auth_web/router.ex index f298d1d0..90960ed4 100644 --- a/apps/auth_web/lib/auth_web/router.ex +++ b/apps/auth_web/lib/auth_web/router.ex @@ -10,6 +10,7 @@ defmodule AuthWeb.Router do plug :fetch_flash plug :protect_from_forgery plug :put_secure_browser_headers + plug :put_layout, {CoreWeb.LayoutView, :app} end pipeline :api do diff --git a/apps/auth_web/lib/auth_web/templates/layout/app.html.eex b/apps/auth_web/lib/auth_web/templates/layout/app.html.eex deleted file mode 100644 index 9d3d6801..00000000 --- a/apps/auth_web/lib/auth_web/templates/layout/app.html.eex +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - <%= I18n.t! "en", "site.title" %> - "/> - - - - -
- <%= @inner_content %> -
- - diff --git a/apps/content/lib/content_web/router.ex b/apps/content/lib/content_web/router.ex index 3a5ea259..5087fb0a 100644 --- a/apps/content/lib/content_web/router.ex +++ b/apps/content/lib/content_web/router.ex @@ -8,6 +8,7 @@ defmodule Content.Router do plug :fetch_flash plug :protect_from_forgery plug :put_secure_browser_headers + plug :put_layout, {CoreWeb.LayoutView, :app} end pipeline :api do @@ -38,8 +39,6 @@ defmodule Content.Router do put "/posts/preview", PostsController, :preview post "/posts/preview", PostsController, :preview - get "/menus/:id/edit", MenusController, :edit - put "/menus/:id", MenusController, :update end scope "/", Content do diff --git a/apps/content/lib/content_web/templates/layout/app.html.eex b/apps/content/lib/content_web/templates/layout/app.html.eex deleted file mode 100644 index 6f5e3edc..00000000 --- a/apps/content/lib/content_web/templates/layout/app.html.eex +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - <%= I18n.t! "en", "site.title" %> - "/> - - - -
- <%= render "_side_menu.html", assigns %> - - -
-
- <%= render "_menu.html", assigns %> -
- - <%= flash_block(@conn) %> - - <%= @inner_content %> -
-
- - diff --git a/apps/core/assets/css/app.scss b/apps/core/assets/css/app.scss index e69de29b..7f9d8bb5 100644 --- a/apps/core/assets/css/app.scss +++ b/apps/core/assets/css/app.scss @@ -0,0 +1,8 @@ +// Menu buttons get a little spacing +.masthead .ui.menu .ui.button { + margin-left: 0.5em; +} + +[class*="top padded"] { + padding-top: 4em; +} diff --git a/apps/core/lib/core_web.ex b/apps/core/lib/core_web.ex index 86d3b098..60c2804f 100644 --- a/apps/core/lib/core_web.ex +++ b/apps/core/lib/core_web.ex @@ -68,6 +68,7 @@ defmodule CoreWeb do import Phoenix.View import CoreWeb.ErrorHelpers + import CoreWeb.Helpers import CoreWeb.Gettext alias CoreWeb.Router.Helpers, as: Routes end diff --git a/apps/core/lib/core_web/router.ex b/apps/core/lib/core_web/router.ex index 295aaa4c..3c2b3caa 100644 --- a/apps/core/lib/core_web/router.ex +++ b/apps/core/lib/core_web/router.ex @@ -7,6 +7,7 @@ defmodule CoreWeb.Router do plug :fetch_flash plug :protect_from_forgery plug :put_secure_browser_headers + plug :put_layout, {CoreWeb.LayoutView, :app} end pipeline :api do diff --git a/apps/content/lib/content_web/templates/layout/_menu.html.eex b/apps/core/lib/core_web/templates/layout/_menu.html.eex similarity index 70% rename from apps/content/lib/content_web/templates/layout/_menu.html.eex rename to apps/core/lib/core_web/templates/layout/_menu.html.eex index cb549d04..a025c4f1 100644 --- a/apps/content/lib/content_web/templates/layout/_menu.html.eex +++ b/apps/core/lib/core_web/templates/layout/_menu.html.eex @@ -9,12 +9,12 @@ <% end %>
<%= if Pow.Plug.current_user(@conn) do %> - <%= link "Sign out", to: AuthWeb.Router.Helpers.pow_session_path(@conn, :delete), method: :delete, class: "ui inverted button" %> + <%= link "Sign out", to: AuthWeb.Router.Helpers.pow_session_path(%URI{path: "/auth"}, :delete), method: :delete, class: "ui inverted button" %> <% else %> - <%= link to: AuthWeb.Router.Helpers.pow_session_path(@conn, :new), class: "ui inverted button" do %> + <%= link to: AuthWeb.Router.Helpers.pow_session_path(%URI{path: "/auth"}, :new), class: "ui inverted button" do %> Log in <% end %> - <%= link to: AuthWeb.Router.Helpers.pow_registration_path(@conn, :new), class: "ui inverted button" do %> + <%= link to: AuthWeb.Router.Helpers.pow_registration_path(%URI{path: "/auth"}, :new), class: "ui inverted button" do %> Sign Up <% end %> <% end %> diff --git a/apps/content/lib/content_web/templates/layout/_side_menu.html.eex b/apps/core/lib/core_web/templates/layout/_side_menu.html.eex similarity index 57% rename from apps/content/lib/content_web/templates/layout/_side_menu.html.eex rename to apps/core/lib/core_web/templates/layout/_side_menu.html.eex index 81d20a6f..82029885 100644 --- a/apps/content/lib/content_web/templates/layout/_side_menu.html.eex +++ b/apps/core/lib/core_web/templates/layout/_side_menu.html.eex @@ -4,12 +4,12 @@ Admin <% end %> <%= if Pow.Plug.current_user(@conn) do %> - <%= link "Sign out", to: AuthWeb.Router.Helpers.pow_session_path(@conn, :delete), method: :delete, class: "item" %> + <%= link "Sign out", to: AuthWeb.Router.Helpers.pow_session_path(%URI{path: "/auth"}, :delete), method: :delete, class: "item" %> <% else %> - <%= link to: AuthWeb.Router.Helpers.pow_session_path(@conn, :new), class: "item" do %> + <%= link to: AuthWeb.Router.Helpers.pow_session_path(%URI{path: "/auth"}, :new), class: "item" do %> Log in <% end %> - <%= link to: AuthWeb.Router.Helpers.pow_registration_path(@conn, :new), class: "item" do %> + <%= link to: AuthWeb.Router.Helpers.pow_registration_path(%URI{path: "/auth"}, :new), class: "item" do %> Sign Up <% end %> <% end %> diff --git a/apps/core/lib/core_web/templates/layout/app.html.eex b/apps/core/lib/core_web/templates/layout/app.html.eex index 41d1f970..6f5e3edc 100644 --- a/apps/core/lib/core_web/templates/layout/app.html.eex +++ b/apps/core/lib/core_web/templates/layout/app.html.eex @@ -10,9 +10,18 @@
- - - <%= @inner_content %> + <%= render "_side_menu.html", assigns %> + + +
+
+ <%= render "_menu.html", assigns %> +
+ + <%= flash_block(@conn) %> + + <%= @inner_content %> +
diff --git a/apps/core/lib/core_web/views/helpers.ex b/apps/core/lib/core_web/views/helpers.ex index c4166892..2a343c78 100644 --- a/apps/core/lib/core_web/views/helpers.ex +++ b/apps/core/lib/core_web/views/helpers.ex @@ -27,16 +27,17 @@ defmodule CoreWeb.Helpers do """ end - def styled_input(f, field, opts \\ []) do - styled_input(f, field, opts) do + def styled_input(f, field, opts \\ [], options \\ nil) do + styled_input(f, field, opts, options) do "" end end - def styled_input(f, field, opts, do: content) do + def styled_input(f, field, opts, options, do: content) do {icon, rest_opts} = Keyword.pop(opts, :icon, "") {classes, rest_opts} = Keyword.pop(rest_opts, :class, "") {label_text, rest_opts} = Keyword.pop(rest_opts, :label) + {input_helper, rest_opts} = Keyword.pop(rest_opts, :input_helper, :text_input) ~E"""
<%= if label_text do %> @@ -47,7 +48,11 @@ defmodule CoreWeb.Helpers do
- <%= text_input f, field, rest_opts %> + <%= if options == nil do %> + <%= apply(Phoenix.HTML.Form, input_helper, [f, field, rest_opts]) %> + <% else %> + <%= apply(Phoenix.HTML.Form, input_helper, [f, field, options, rest_opts]) %> + <% end %> <%= content %>
<%= error_tag f, field, class: "ui pointing red basic label" %> diff --git a/apps/core/lib/mix/legendary.ex b/apps/core/lib/mix/legendary.ex new file mode 100644 index 00000000..0fdebdcb --- /dev/null +++ b/apps/core/lib/mix/legendary.ex @@ -0,0 +1,35 @@ +defmodule Mix.Legendary do + alias Mix.Phoenix.{Schema} + + @doc false + def inputs(%Schema{} = schema) do + Enum.map(schema.attrs, fn + {_, {:references, _}} -> + nil + {key, :integer} -> + ~s(<%= styled_input f, #{inspect(key)}, input_helper: :number_input %>) + {key, :float} -> + ~s(<%= styled_input f, #{inspect(key)}, input_helper: :number_input, step: "any" %>) + {key, :decimal} -> + ~s(<%= styled_input f, #{inspect(key)}, input_helper: :number_input, step: "any" %>) + {key, :boolean} -> + ~s(<%= styled_input f, #{inspect(key)}, input_helper: :checkbox %>) + {key, :text} -> + ~s(<%= styled_input f, #{inspect(key)}, input_helper: :textarea %>) + {key, :date} -> + ~s(<%= styled_input f, #{inspect(key)}, input_helper: :date_select %>) + {key, :time} -> + ~s(<%= styled_input f, #{inspect(key)}, input_helper: :time_select %>) + {key, :utc_datetime} -> + ~s(<%= styled_input f, #{inspect(key)}, input_helper: :datetime_select %>) + {key, :naive_datetime} -> + ~s(<%= styled_input f, #{inspect(key)}, input_helper: :datetime_select %>) + {key, {:array, :integer}} -> + ~s(<%= styled_input f, #{inspect(key)}, [input_helper: :multiple_select], ["1": 1, "2": 2] %>) + {key, {:array, _}} -> + ~s(<%= styled_input f, #{inspect(key)}, [input_helper: :multiple_select], ["Option 1": "option1", "Option 2": "option2"] %>) + {key, _} -> + ~s(<%= styled_input f, #{inspect(key)} %>) + end) + end +end diff --git a/apps/core/priv/templates/phx.gen.channel/channel.ex b/apps/core/priv/templates/phx.gen.channel/channel.ex index 4c1cf821..d4846bed 100644 --- a/apps/core/priv/templates/phx.gen.channel/channel.ex +++ b/apps/core/priv/templates/phx.gen.channel/channel.ex @@ -1,5 +1,5 @@ defmodule <%= module %>Channel do - use <%= web_module %>, :channel + use <%= module %>, :channel @impl true def join("<%= singular %>:lobby", payload, socket) do diff --git a/apps/core/priv/templates/phx.gen.channel/channel_test.exs b/apps/core/priv/templates/phx.gen.channel/channel_test.exs index 6fc15ebd..65e75ff5 100644 --- a/apps/core/priv/templates/phx.gen.channel/channel_test.exs +++ b/apps/core/priv/templates/phx.gen.channel/channel_test.exs @@ -1,9 +1,9 @@ defmodule <%= module %>ChannelTest do - use <%= web_module %>.ChannelCase + use <%= module %>.ChannelCase setup do {:ok, _, socket} = - <%= web_module %>.UserSocket + <%= module %>.UserSocket |> socket("user_id", %{some: :assign}) |> subscribe_and_join(<%= module %>Channel, "<%= singular %>:lobby") diff --git a/apps/core/priv/templates/phx.gen.html/controller.ex b/apps/core/priv/templates/phx.gen.html/controller.ex index a5cc4576..8de444da 100644 --- a/apps/core/priv/templates/phx.gen.html/controller.ex +++ b/apps/core/priv/templates/phx.gen.html/controller.ex @@ -1,5 +1,5 @@ -defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>Controller do - use <%= inspect context.web_module %>, :controller +defmodule <%= inspect context.module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>Controller do + use <%= inspect context.module %>, :controller alias <%= inspect context.module %> alias <%= inspect schema.module %> diff --git a/apps/core/priv/templates/phx.gen.html/controller_test.exs b/apps/core/priv/templates/phx.gen.html/controller_test.exs index 35c76c0f..06326e50 100644 --- a/apps/core/priv/templates/phx.gen.html/controller_test.exs +++ b/apps/core/priv/templates/phx.gen.html/controller_test.exs @@ -1,5 +1,5 @@ -defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>ControllerTest do - use <%= inspect context.web_module %>.ConnCase +defmodule <%= inspect context.module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>ControllerTest do + use <%= inspect context.module %>.ConnCase import <%= inspect context.module %>Fixtures diff --git a/apps/core/priv/templates/phx.gen.html/view.ex b/apps/core/priv/templates/phx.gen.html/view.ex index e828b078..ab2538be 100644 --- a/apps/core/priv/templates/phx.gen.html/view.ex +++ b/apps/core/priv/templates/phx.gen.html/view.ex @@ -1,3 +1,3 @@ -defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>View do - use <%= inspect context.web_module %>, :view +defmodule <%= inspect context.module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>View do + use <%= inspect context.module %>, :view end diff --git a/apps/core/priv/templates/phx.gen.json/changeset_view.ex b/apps/core/priv/templates/phx.gen.json/changeset_view.ex index 27b58e8d..56df9417 100644 --- a/apps/core/priv/templates/phx.gen.json/changeset_view.ex +++ b/apps/core/priv/templates/phx.gen.json/changeset_view.ex @@ -1,11 +1,11 @@ -defmodule <%= inspect context.web_module %>.ChangesetView do - use <%= inspect context.web_module %>, :view +defmodule <%= inspect context.module %>.ChangesetView do + use <%= inspect context.module %>, :view @doc """ Traverses and translates changeset errors. See `Ecto.Changeset.traverse_errors/2` and - `<%= inspect context.web_module %>.ErrorHelpers.translate_error/1` for more details. + `<%= inspect context.module %>.ErrorHelpers.translate_error/1` for more details. """ def translate_errors(changeset) do Ecto.Changeset.traverse_errors(changeset, &translate_error/1) diff --git a/apps/core/priv/templates/phx.gen.json/controller.ex b/apps/core/priv/templates/phx.gen.json/controller.ex index 1eb81e55..61eb547f 100644 --- a/apps/core/priv/templates/phx.gen.json/controller.ex +++ b/apps/core/priv/templates/phx.gen.json/controller.ex @@ -1,10 +1,10 @@ -defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>Controller do - use <%= inspect context.web_module %>, :controller +defmodule <%= inspect context.module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>Controller do + use <%= inspect context.module %>, :controller alias <%= inspect context.module %> alias <%= inspect schema.module %> - action_fallback <%= inspect context.web_module %>.FallbackController + action_fallback <%= inspect context.module %>.FallbackController def index(conn, _params) do <%= schema.plural %> = <%= inspect context.alias %>.list_<%= schema.plural %>() diff --git a/apps/core/priv/templates/phx.gen.json/controller_test.exs b/apps/core/priv/templates/phx.gen.json/controller_test.exs index 9f99e08e..68ad9d81 100644 --- a/apps/core/priv/templates/phx.gen.json/controller_test.exs +++ b/apps/core/priv/templates/phx.gen.json/controller_test.exs @@ -1,5 +1,5 @@ -defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>ControllerTest do - use <%= inspect context.web_module %>.ConnCase +defmodule <%= inspect context.module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>ControllerTest do + use <%= inspect context.module %>.ConnCase import <%= inspect context.module %>Fixtures diff --git a/apps/core/priv/templates/phx.gen.json/fallback_controller.ex b/apps/core/priv/templates/phx.gen.json/fallback_controller.ex index 6ae62aa4..ed2e98c7 100644 --- a/apps/core/priv/templates/phx.gen.json/fallback_controller.ex +++ b/apps/core/priv/templates/phx.gen.json/fallback_controller.ex @@ -1,16 +1,16 @@ -defmodule <%= inspect context.web_module %>.FallbackController do +defmodule <%= inspect context.module %>.FallbackController do @moduledoc """ Translates controller action results into valid `Plug.Conn` responses. See `Phoenix.Controller.action_fallback/1` for more details. """ - use <%= inspect context.web_module %>, :controller + use <%= inspect context.module %>, :controller <%= if schema.generate? do %># This clause handles errors returned by Ecto's insert/update/delete. def call(conn, {:error, %Ecto.Changeset{} = changeset}) do conn |> put_status(:unprocessable_entity) - |> put_view(<%= inspect context.web_module %>.ChangesetView) + |> put_view(<%= inspect context.module %>.ChangesetView) |> render("error.json", changeset: changeset) end @@ -18,7 +18,7 @@ defmodule <%= inspect context.web_module %>.FallbackController do def call(conn, {:error, :not_found}) do conn |> put_status(:not_found) - |> put_view(<%= inspect context.web_module %>.ErrorView) + |> put_view(<%= inspect context.module %>.ErrorView) |> render(:"404") end end diff --git a/apps/core/priv/templates/phx.gen.json/view.ex b/apps/core/priv/templates/phx.gen.json/view.ex index 4ade8c42..7837957f 100644 --- a/apps/core/priv/templates/phx.gen.json/view.ex +++ b/apps/core/priv/templates/phx.gen.json/view.ex @@ -1,6 +1,6 @@ -defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>View do - use <%= inspect context.web_module %>, :view - alias <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>View +defmodule <%= inspect context.module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>View do + use <%= inspect context.module %>, :view + alias <%= inspect context.module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>View def render("index.json", %{<%= schema.plural %>: <%= schema.plural %>}) do %{data: render_many(<%= schema.plural %>, <%= inspect schema.alias %>View, "<%= schema.singular %>.json")} diff --git a/apps/core/priv/templates/phx.gen.live/form_component.ex b/apps/core/priv/templates/phx.gen.live/form_component.ex index 69572392..58961b7f 100644 --- a/apps/core/priv/templates/phx.gen.live/form_component.ex +++ b/apps/core/priv/templates/phx.gen.live/form_component.ex @@ -1,5 +1,5 @@ -defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>Live.FormComponent do - use <%= inspect context.web_module %>, :live_component +defmodule <%= inspect context.module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>Live.FormComponent do + use <%= inspect context.module %>, :live_component alias <%= inspect context.module %> diff --git a/apps/core/priv/templates/phx.gen.live/index.ex b/apps/core/priv/templates/phx.gen.live/index.ex index f46c53b7..8aa7fe48 100644 --- a/apps/core/priv/templates/phx.gen.live/index.ex +++ b/apps/core/priv/templates/phx.gen.live/index.ex @@ -1,5 +1,5 @@ -defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>Live.Index do - use <%= inspect context.web_module %>, :live_view +defmodule <%= inspect context.module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>Live.Index do + use <%= inspect context.module %>, :live_view alias <%= inspect context.module %> alias <%= inspect schema.module %> diff --git a/apps/core/priv/templates/phx.gen.live/index.html.leex b/apps/core/priv/templates/phx.gen.live/index.html.leex index 1ea9f0ab..0653c18b 100644 --- a/apps/core/priv/templates/phx.gen.live/index.html.leex +++ b/apps/core/priv/templates/phx.gen.live/index.html.leex @@ -1,7 +1,7 @@

Listing <%= schema.human_plural %>

<%%= if @live_action in [:new, :edit] do %> - <%%= live_modal @socket, <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>Live.FormComponent, + <%%= live_modal @socket, <%= inspect context.module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>Live.FormComponent, id: @<%= schema.singular %>.id || :new, title: @page_title, action: @live_action, diff --git a/apps/core/priv/templates/phx.gen.live/live_helpers.ex b/apps/core/priv/templates/phx.gen.live/live_helpers.ex index 91f0a5d6..141051a3 100644 --- a/apps/core/priv/templates/phx.gen.live/live_helpers.ex +++ b/apps/core/priv/templates/phx.gen.live/live_helpers.ex @@ -1,15 +1,15 @@ -defmodule <%= inspect context.web_module %>.LiveHelpers do +defmodule <%= inspect context.module %>.LiveHelpers do import Phoenix.LiveView.Helpers @doc """ - Renders a component inside the `<%= inspect context.web_module %>.ModalComponent` component. + Renders a component inside the `<%= inspect context.module %>.ModalComponent` component. The rendered modal receives a `:return_to` option to properly update the URL when the modal is closed. ## Examples - <%%= live_modal @socket, <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>Live.FormComponent, + <%%= live_modal @socket, <%= inspect context.module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>Live.FormComponent, id: @<%= schema.singular %>.id || :new, action: @live_action, <%= schema.singular %>: @<%= schema.singular %>, @@ -18,6 +18,6 @@ defmodule <%= inspect context.web_module %>.LiveHelpers do def live_modal(socket, component, opts) do path = Keyword.fetch!(opts, :return_to) modal_opts = [id: :modal, return_to: path, component: component, opts: opts] - live_component(socket, <%= inspect context.web_module %>.ModalComponent, modal_opts) + live_component(socket, <%= inspect context.module %>.ModalComponent, modal_opts) end end diff --git a/apps/core/priv/templates/phx.gen.live/live_test.exs b/apps/core/priv/templates/phx.gen.live/live_test.exs index 2c5609e0..210caaef 100644 --- a/apps/core/priv/templates/phx.gen.live/live_test.exs +++ b/apps/core/priv/templates/phx.gen.live/live_test.exs @@ -1,5 +1,5 @@ -defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>LiveTest do - use <%= inspect context.web_module %>.ConnCase +defmodule <%= inspect context.module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>LiveTest do + use <%= inspect context.module %>.ConnCase import Phoenix.LiveViewTest import <%= inspect context.module %>Fixtures diff --git a/apps/core/priv/templates/phx.gen.live/modal_component.ex b/apps/core/priv/templates/phx.gen.live/modal_component.ex index ab4301d9..f124c3aa 100644 --- a/apps/core/priv/templates/phx.gen.live/modal_component.ex +++ b/apps/core/priv/templates/phx.gen.live/modal_component.ex @@ -1,5 +1,5 @@ -defmodule <%= inspect context.web_module %>.ModalComponent do - use <%= inspect context.web_module %>, :live_component +defmodule <%= inspect context.module %>.ModalComponent do + use <%= inspect context.module %>, :live_component @impl true def render(assigns) do diff --git a/apps/core/priv/templates/phx.gen.live/show.ex b/apps/core/priv/templates/phx.gen.live/show.ex index b75badea..37997a95 100644 --- a/apps/core/priv/templates/phx.gen.live/show.ex +++ b/apps/core/priv/templates/phx.gen.live/show.ex @@ -1,5 +1,5 @@ -defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>Live.Show do - use <%= inspect context.web_module %>, :live_view +defmodule <%= inspect context.module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>Live.Show do + use <%= inspect context.module %>, :live_view alias <%= inspect context.module %> diff --git a/apps/core/priv/templates/phx.gen.live/show.html.leex b/apps/core/priv/templates/phx.gen.live/show.html.leex index 236f80e4..f23d1eff 100644 --- a/apps/core/priv/templates/phx.gen.live/show.html.leex +++ b/apps/core/priv/templates/phx.gen.live/show.html.leex @@ -1,7 +1,7 @@

Show <%= schema.human_singular %>

<%%= if @live_action in [:edit] do %> - <%%= live_modal @socket, <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>Live.FormComponent, + <%%= live_modal @socket, <%= inspect context.module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>Live.FormComponent, id: @<%= schema.singular %>.id, title: @page_title, action: @live_action, diff --git a/config/config.exs b/config/config.exs index b96dc4ad..2ba11159 100644 --- a/config/config.exs +++ b/config/config.exs @@ -1,9 +1,5 @@ use Mix.Config -config :app, - ecto_repos: [App.Repo], - generators: [context_app: false] - # Configures the endpoint config :app, App.Endpoint, url: [host: "localhost"], @@ -17,7 +13,8 @@ config :admin, generators: [context_app: false] config :app, - ecto_repos: [App.Repo] + ecto_repos: [App.Repo], + generators: [context_app: :app] # Configures the endpoint config :admin, Admin.Endpoint, @@ -27,6 +24,14 @@ config :admin, Admin.Endpoint, pubsub_server: Admin.PubSub, live_view: [signing_salt: "g5ltUbnQ"] +# Configures the endpoint +config :app, AppWeb.Endpoint, + url: [host: "localhost"], + secret_key_base: "r2eN53mJ9RmlGz9ZQ7xf43P3Or59aaO9rdf5D3hRcsuiH44pGW9kPGfl5mt9N1Gi", + render_errors: [view: AppWeb.ErrorView, accepts: ~w(html json), layout: false], + pubsub_server: AppWeb.PubSub, + live_view: [signing_salt: "g5ltUbnQ"] + # Configure Mix tasks and generators config :auth, ecto_repos: [Auth.Repo] @@ -67,7 +72,7 @@ config :core, {Content.Router, "/pages"}, {AuthWeb.Router, "/auth"}, {Admin.Router, "/admin"}, - {App.Router, "/app"}, + {AppWeb.Router, "/app"}, ], email_from: "example@example.org" @@ -77,7 +82,7 @@ config :content, config :content, Content.Endpoint, server: false config :auth_web, AuthWeb.Endpoint, server: false config :admin, Admin.Endpoint, server: false -config :app, App.Endpoint, server: false +config :app, AppWeb.Endpoint, server: false import_config "../apps/*/config/config.exs"