devel #37
8 changed files with 52 additions and 4 deletions
|
@ -41,6 +41,24 @@
|
|||
--color-text-muted: 76 87 111;
|
||||
--color-text-dim: 57 65 83;
|
||||
}
|
||||
|
||||
:root[data-theme=gruvbox] {
|
||||
--color-primary: 175 58 3;
|
||||
--color-background: 251 241 199;
|
||||
--color-text-base :40 40 40;
|
||||
--color-text-heading: 66 123 88;
|
||||
--color-text-muted: 60 56 54;
|
||||
--color-text-dim: 102 92 84;
|
||||
}
|
||||
|
||||
:root[data-theme=gruvbox][data-mode=dark] {
|
||||
--color-primary: 214 93 14;
|
||||
--color-background: 40 40 40;
|
||||
--color-text-base: 251 241 199;
|
||||
--color-text-heading: 104 157 106;
|
||||
--color-text-muted: 235 219 178;
|
||||
--color-text-dim: 189 174 147;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -67,5 +85,4 @@ a[rel] svg {
|
|||
/* Set width and color for identity icons */
|
||||
svg {
|
||||
width: 1.5em;
|
||||
@apply fill-emerald-500 dark:fill-emerald-700;
|
||||
}
|
|
@ -9,7 +9,7 @@ defmodule Chiya.Site.Setting do
|
|||
field :custom_css, :string, default: ""
|
||||
field :custom_html, :string, default: ""
|
||||
|
||||
field :theme, Ecto.Enum, values: [:default, :frame], default: :default
|
||||
field :theme, Ecto.Enum, values: [:default, :frame, :gruvbox], default: :default
|
||||
|
||||
field :user_agent, :string, default: "Chiya/0.x +https://inhji.de"
|
||||
|
||||
|
|
|
@ -64,6 +64,17 @@ defmodule ChiyaWeb.NoteController do
|
|||
|> redirect(to: ~p"/admin/notes")
|
||||
end
|
||||
|
||||
def raw(conn, %{"id" => id}) do
|
||||
raw_note =
|
||||
id
|
||||
|> Notes.get_note!()
|
||||
|> Notes.preload_note()
|
||||
|> ChiyaWeb.Exim.export_note()
|
||||
|
||||
conn
|
||||
|> text(raw_note)
|
||||
end
|
||||
|
||||
defp from_channel_ids(note_params) do
|
||||
selected_ids = Enum.map(note_params["channels"] || [], &String.to_integer/1)
|
||||
|
||||
|
|
12
lib/chiya_web/exim.ex
Normal file
12
lib/chiya_web/exim.ex
Normal file
|
@ -0,0 +1,12 @@
|
|||
defmodule ChiyaWeb.Exim do
|
||||
alias Chiya.Notes.Note
|
||||
|
||||
defp frontmatter(%Note{name: title, channels: channels}) do
|
||||
channels_raw = Enum.map_join(channels, "], [", fn c -> "\"#{c.name}\"" end)
|
||||
"title: \"#{title}\"\ncategories: [#{channels_raw}]"
|
||||
end
|
||||
|
||||
def export_note(%Note{content: content} = note) do
|
||||
"---\n#{frontmatter(note)}\n---\n#{content}"
|
||||
end
|
||||
end
|
|
@ -17,7 +17,10 @@ defmodule ChiyaWeb.NoteShowLive do
|
|||
<.button>Edit note</.button>
|
||||
</.link>
|
||||
<.link href={~p"/n/#{@note.slug}"}>
|
||||
<.button>Preview note</.button>
|
||||
<.button>Preview</.button>
|
||||
</.link>
|
||||
<.link href={~p"/admin/notes/#{@note}/raw"}>
|
||||
<.button>Raw</.button>
|
||||
</.link>
|
||||
</:actions>
|
||||
</.header>
|
||||
|
|
|
@ -62,6 +62,7 @@ defmodule ChiyaWeb.Router do
|
|||
resources "/identities", IdentityController
|
||||
|
||||
live "/notes/:id", NoteShowLive, :show
|
||||
get "/notes/:id/raw", NoteController, :raw
|
||||
end
|
||||
|
||||
## Authentication routes
|
||||
|
|
3
mix.exs
3
mix.exs
|
@ -53,7 +53,8 @@ defmodule Chiya.MixProject do
|
|||
{:oban, "~> 2.14"},
|
||||
{:waffle, "~> 1.1"},
|
||||
{:waffle_ecto, "~> 0.0.12"},
|
||||
{:earmark, "~> 1.4"}
|
||||
{:earmark, "~> 1.4"},
|
||||
{:yaml_front_matter, "~> 1.0.0"}
|
||||
]
|
||||
end
|
||||
|
||||
|
|
3
mix.lock
3
mix.lock
|
@ -56,4 +56,7 @@
|
|||
"waffle_ecto": {:hex, :waffle_ecto, "0.0.12", "e5c17c49b071b903df71861c642093281123142dc4e9908c930db3e06795b040", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:waffle, "~> 1.0", [hex: :waffle, repo: "hexpm", optional: false]}], "hexpm", "585fe6371057066d2e8e3383ddd7a2437ff0668caf3f4cbf5a041e0de9837168"},
|
||||
"websock": {:hex, :websock, "0.4.3", "184ac396bdcd3dfceb5b74c17d221af659dd559a95b1b92041ecb51c9b728093", [:mix], [], "hexpm", "5e4dd85f305f43fd3d3e25d70bec4a45228dfed60f0f3b072d8eddff335539cf"},
|
||||
"websock_adapter": {:hex, :websock_adapter, "0.4.5", "30038a3715067f51a9580562c05a3a8d501126030336ffc6edb53bf57d6d2d26", [:mix], [{:bandit, "~> 0.6", [hex: :bandit, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.6", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:websock, "~> 0.4", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "1d9812dc7e703c205049426fd4fe0852a247a825f91b099e53dc96f68bafe4c8"},
|
||||
"yamerl": {:hex, :yamerl, "0.10.0", "4ff81fee2f1f6a46f1700c0d880b24d193ddb74bd14ef42cb0bcf46e81ef2f8e", [:rebar3], [], "hexpm", "346adb2963f1051dc837a2364e4acf6eb7d80097c0f53cbdc3046ec8ec4b4e6e"},
|
||||
"yaml_elixir": {:hex, :yaml_elixir, "2.9.0", "9a256da867b37b8d2c1ffd5d9de373a4fda77a32a45b452f1708508ba7bbcb53", [:mix], [{:yamerl, "~> 0.10", [hex: :yamerl, repo: "hexpm", optional: false]}], "hexpm", "0cb0e7d4c56f5e99a6253ed1a670ed0e39c13fc45a6da054033928607ac08dfc"},
|
||||
"yaml_front_matter": {:hex, :yaml_front_matter, "1.0.0", "9f3310906a9647d04fc4715b6bac5ed177defc9625c53b93430d36d8fd0961db", [:mix], [{:yaml_elixir, "~> 2.0", [hex: :yaml_elixir, repo: "hexpm", optional: false]}], "hexpm", "73cf825c18b7a14bfd8fb5856fa4887196035be69d2d45d1c370917aae0572ec"},
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue