diff --git a/lib/athena_web/admin/templates/layout/app.html.eex b/lib/athena_web/admin/templates/layout/app.html.eex deleted file mode 100644 index 22316a4e..00000000 --- a/lib/athena_web/admin/templates/layout/app.html.eex +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - <%= - case assigns[:event] do - nil -> "Athena" - %{name: name} -> name - end - %> - - "/> - - <%= csrf_meta_tag() %> - - - class="has_nav"<% end %>> - - <%= if Map.has_key?(assigns, :navigation) do %> - - <% end %> -
- - - <%= @inner_content %> -
- - diff --git a/lib/athena_web/admin/templates/layout/app.html.heex b/lib/athena_web/admin/templates/layout/app.html.heex new file mode 100644 index 00000000..65bb56e9 --- /dev/null +++ b/lib/athena_web/admin/templates/layout/app.html.heex @@ -0,0 +1,6 @@ +
+ + + + <%= @inner_content %> +
diff --git a/lib/athena_web/admin/templates/layout/live.html.heex b/lib/athena_web/admin/templates/layout/live.html.heex new file mode 100644 index 00000000..a29d6044 --- /dev/null +++ b/lib/athena_web/admin/templates/layout/live.html.heex @@ -0,0 +1,11 @@ +
+ + + + + <%= @inner_content %> +
diff --git a/lib/athena_web/admin/templates/layout/root.html.heex b/lib/athena_web/admin/templates/layout/root.html.heex new file mode 100644 index 00000000..959abf29 --- /dev/null +++ b/lib/athena_web/admin/templates/layout/root.html.heex @@ -0,0 +1,50 @@ + + + + + + + + <%= + case assigns[:event] do + nil -> "Athena" + %{name: name} -> name + end + %> + + + + <%= csrf_meta_tag() %> + + + + <%= if Map.has_key?(assigns, :navigation) do %> + + + <% end %> + + <%= @inner_content %> + + diff --git a/lib/athena_web/frontend/templates/layout/app.html.heex b/lib/athena_web/frontend/templates/layout/app.html.heex new file mode 100644 index 00000000..65bb56e9 --- /dev/null +++ b/lib/athena_web/frontend/templates/layout/app.html.heex @@ -0,0 +1,6 @@ +
+ + + + <%= @inner_content %> +
diff --git a/lib/athena_web/frontend/templates/layout/live.html.heex b/lib/athena_web/frontend/templates/layout/live.html.heex new file mode 100644 index 00000000..a29d6044 --- /dev/null +++ b/lib/athena_web/frontend/templates/layout/live.html.heex @@ -0,0 +1,11 @@ +
+ + + + + <%= @inner_content %> +
diff --git a/lib/athena_web/frontend/templates/layout/logistics.html.eex b/lib/athena_web/frontend/templates/layout/logistics.html.eex deleted file mode 100644 index 58e68841..00000000 --- a/lib/athena_web/frontend/templates/layout/logistics.html.eex +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - <%= @event.name %> - "/> - - <%= csrf_meta_tag() %> - - - - - -
- - - <%= @inner_content %> -
- - diff --git a/lib/athena_web/frontend/templates/layout/root.html.heex b/lib/athena_web/frontend/templates/layout/root.html.heex new file mode 100644 index 00000000..5d0b8e9d --- /dev/null +++ b/lib/athena_web/frontend/templates/layout/root.html.heex @@ -0,0 +1,55 @@ + + + + + + + <%= @event.name %> + + + <%= csrf_meta_tag() %> + + + "has_nav" + :vendor -> "" + end + }> + <%= case @access do %> + <% :logistics -> %> + + + + <% :vendor -> %> + <% end %> + + <%= @inner_content %> + + diff --git a/lib/athena_web/frontend/templates/layout/vendor.html.eex b/lib/athena_web/frontend/templates/layout/vendor.html.eex deleted file mode 100644 index b69a8218..00000000 --- a/lib/athena_web/frontend/templates/layout/vendor.html.eex +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - <%= @event.name %> - "/> - - <%= csrf_meta_tag() %> - - - -
- - - <%= @inner_content %> -
- - diff --git a/lib/athena_web/router.ex b/lib/athena_web/router.ex index 6ec4c7ea..5b2d4f9c 100644 --- a/lib/athena_web/router.ex +++ b/lib/athena_web/router.ex @@ -31,22 +31,16 @@ defmodule AthenaWeb.Router do pipeline :admin do plug :auth - plug :put_layout, {AthenaWeb.Admin.LayoutView, "app.html"} + plug :put_layout, {AthenaWeb.Admin.LayoutView, :app} + plug :put_root_layout, {AthenaWeb.Admin.LayoutView, :root} end - pipeline :frontend_logistics do - plug :put_layout, {AthenaWeb.Frontend.LayoutView, "logistics.html"} + pipeline :frontend do + plug :put_layout, {AthenaWeb.Frontend.LayoutView, :app} + plug :put_root_layout, {AthenaWeb.Frontend.LayoutView, :root} end - pipeline :frontend_vendor do - plug :put_layout, {AthenaWeb.Frontend.LayoutView, "vendor.html"} - end - - pipeline :api do - plug :accepts, ["json"] - end - - scope "/admin", AthenaWeb.Admin, as: :admin do + scope "/admin", AthenaWeb.Admin, as: :admin, assigns: %{access: :admin} do pipe_through [:browser, :admin] resources "/events", EventController @@ -66,7 +60,7 @@ defmodule AthenaWeb.Router do end scope "/logistics/", AthenaWeb.Frontend, as: :frontend_logistics, assigns: %{access: :logistics} do - pipe_through [:browser, :frontend_logistics] + pipe_through [:browser, :frontend] get "/locations/:id", LocationController, :show @@ -79,7 +73,7 @@ defmodule AthenaWeb.Router do end scope "/vendor/", AthenaWeb.Frontend, as: :frontend_vendor, assigns: %{access: :vendor} do - pipe_through [:browser, :frontend_vendor] + pipe_through [:browser, :frontend] get "/locations/:id", LocationController, :show end @@ -88,11 +82,6 @@ defmodule AthenaWeb.Router do get "/", Redirector, to: "/admin/events" end - # Other scopes may use custom stacks. - # scope "/api", AthenaWeb do - # pipe_through :api - # end - defp auth(conn, _opts), do: Plug.BasicAuth.basic_auth(conn, Application.fetch_env!(:athena, Plug.BasicAuth)) end