Skip to content

Commit f6ede31

Browse files
committed
Restructure project file layout and inject TOML
The file organisation in the web app has been changed to group things togather a little more logically. Also, the app is now using the documentation metadata generated by the Ruby server.
1 parent c22be33 commit f6ede31

32 files changed

+2590
-88
lines changed

etc/docs/lib/docs_web.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ defmodule DocsWeb do
3030
def view do
3131
quote do
3232
use Phoenix.View,
33-
root: "lib/docs_web/templates",
33+
root: "lib/docs_web/templates", pattern: "**/*",
3434
namespace: DocsWeb
3535

3636
# Import convenience functions from controllers

etc/docs/lib/docs_web/live/page_live.ex

Lines changed: 0 additions & 39 deletions
This file was deleted.

etc/docs/lib/docs_web/live/page_live.html.leex

Lines changed: 0 additions & 48 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
defmodule DocsWeb.PageLive.ContentComponent do
2+
use DocsWeb, :live_component
3+
4+
@impl true
5+
def update(%{content: content, active_tab: active_tab}, socket) do
6+
{:ok, assign(socket, content: content, active_tab: active_tab)}
7+
end
8+
9+
@impl true
10+
def render(assigns) when assigns.active_tab == :fx or assigns.active_tab == :synths do
11+
#test = Map.take(assigns.content, [:doc])
12+
Phoenix.View.render(DocsWeb.PageView, "components/synths_or_fx_component.html", assigns)
13+
end
14+
15+
# TODO: Store active_page per tab? this would allow us to check whether a page has been chosen on each tab,
16+
# and if not, render a default. (Also to render the last active page per tab when switching between them).
17+
@impl true
18+
def render(assigns) when assigns.active_tab == nil do
19+
Phoenix.View.render(DocsWeb.PageView, "components/welcome_component.html", %{})
20+
end
21+
end
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
defmodule DocsWeb.PageLive.LangComponent do
2+
use DocsWeb, :live_component
3+
4+
@impl true
5+
def update(%{content: content}, socket) do
6+
{:ok, assign(socket, content: content)}
7+
end
8+
9+
@impl true
10+
def render(assigns) do
11+
Phoenix.View.render(DocsWeb.PageView, "components/lang_component.html", assigns)
12+
end
13+
end
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
defmodule DocsWeb.PageLive.NavbarComponent do
2+
use DocsWeb, :live_component
3+
@impl true
4+
def render(assigns) do
5+
Phoenix.View.render(DocsWeb.PageView, "components/navbar_component.html", assigns)
6+
end
7+
8+
@impl true
9+
def update(%{active_tab: active_tab}, socket) do
10+
{:ok, assign(socket, active_tab: active_tab)}
11+
end
12+
13+
end
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
defmodule DocsWeb.PageLive.SamplesComponent do
2+
use DocsWeb, :live_component
3+
4+
@impl true
5+
def update(%{content: content}, socket) do
6+
{:ok, assign(socket, content: content)}
7+
end
8+
9+
@impl true
10+
def render(assigns) do
11+
Phoenix.View.render(DocsWeb.PageView, "components/samples_component.html", assigns)
12+
end
13+
end
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
require IEx
2+
3+
defmodule DocsWeb.PageLive.SideNavComponent do
4+
use DocsWeb, :live_component
5+
6+
@impl true
7+
def render(assigns) do
8+
Phoenix.View.render(DocsWeb.PageView, "components/side_nav_component.html", assigns)
9+
end
10+
11+
@impl true
12+
def update(%{active_page: active_page, active_tab: active_tab, active_pages: active_pages, page_titles: page_titles}, socket) do
13+
case active_tab do
14+
nil -> {:ok, assign(socket, active_pages: active_pages, page_titles: page_titles)}
15+
_ -> {:ok, assign(socket, active_page: active_page, active_pages: %{active_pages | active_tab => active_page}, page_titles: page_titles)}
16+
end
17+
end
18+
end
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
defmodule DocsWeb.PageLive.SynthsComponent do
2+
use DocsWeb, :live_component
3+
4+
@impl true
5+
def update(%{content: content}, socket) do
6+
{:ok, assign(socket, content: content)}
7+
end
8+
9+
@impl true
10+
def render(assigns) do
11+
Phoenix.View.render(DocsWeb.PageView, "components/synths_component.html", assigns)
12+
end
13+
end
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
defmodule DocsWeb.PageLive.SynthsOrFxComponent do
2+
use DocsWeb, :live_component
3+
4+
@impl true
5+
def update(%{content: content}, socket) do
6+
{:ok, assign(socket, content: content)}
7+
end
8+
9+
@impl true
10+
def render(assigns) do
11+
Phoenix.View.render(DocsWeb.PageView, "components/synths_or_fx_component.html", assigns)
12+
end
13+
end

0 commit comments

Comments
 (0)