devel #27
10 changed files with 36 additions and 24 deletions
|
@ -50,6 +50,10 @@
|
||||||
@apply prose-invert;
|
@apply prose-invert;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.prose :where(a):not(:where([class~="not-prose"] *)) {
|
||||||
|
@apply underline decoration-2 decoration-theme-primary;
|
||||||
|
}
|
||||||
|
|
||||||
/* Set width and color for identity icons */
|
/* Set width and color for identity icons */
|
||||||
a[rel] svg {
|
a[rel] svg {
|
||||||
width: 1em;
|
width: 1em;
|
||||||
|
|
|
@ -20,7 +20,10 @@ defmodule Chiya.Notes do
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def list_notes do
|
def list_notes do
|
||||||
Repo.all(Note) |> Repo.preload(@preloads)
|
Note
|
||||||
|
|> order_by([n], [desc: n.updated_at, desc: n.published_at])
|
||||||
|
|> Repo.all()
|
||||||
|
|> Repo.preload(@preloads)
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
|
|
|
@ -5,7 +5,7 @@ defmodule Chiya.Notes.Note do
|
||||||
@derive {Jason.Encoder, only: [:id, :name, :content, :slug, :channels]}
|
@derive {Jason.Encoder, only: [:id, :name, :content, :slug, :channels]}
|
||||||
schema "notes" do
|
schema "notes" do
|
||||||
field :content, :string
|
field :content, :string
|
||||||
field :kind, Ecto.Enum, values: [:post, :bookmark]
|
field :kind, Ecto.Enum, values: [:post, :bookmark], default: :post
|
||||||
field :name, :string
|
field :name, :string
|
||||||
field :published_at, :naive_datetime
|
field :published_at, :naive_datetime
|
||||||
field :slug, :string
|
field :slug, :string
|
||||||
|
|
|
@ -65,11 +65,20 @@ defmodule ChiyaWeb.AdminComponents do
|
||||||
|
|
||||||
def admin_bar(assigns) do
|
def admin_bar(assigns) do
|
||||||
~H"""
|
~H"""
|
||||||
<ul class="relative z-10 flex items-center gap-4 px-4 sm:px-6 lg:px-8 justify-end bg-black">
|
<ul class="relative z-10 flex items-center gap-4 py-1 px-4 sm:px-6 lg:px-8 bg-black">
|
||||||
<%= if @current_user do %>
|
<li>
|
||||||
<li class="text-xs leading-6 text-gray-100">
|
<.link
|
||||||
<%= @current_user.email %>
|
href={~p"/"}
|
||||||
|
class="flex gap-3 text-sm leading-6 text-gray-100 font-semibold hover:text-gray-300"
|
||||||
|
>
|
||||||
|
<span>Chiya</span>
|
||||||
|
<p class="rounded-full bg-theme-primary/10 px-2 text-[0.8125rem] font-medium leading-6 text-theme-primary">
|
||||||
|
v<%= Application.spec(:chiya, :vsn) %>
|
||||||
|
</p>
|
||||||
|
</.link>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="flex-1"></li>
|
||||||
|
<%= if @current_user do %>
|
||||||
<li>
|
<li>
|
||||||
<.link
|
<.link
|
||||||
href="#"
|
href="#"
|
||||||
|
|
|
@ -305,6 +305,8 @@ defmodule ChiyaWeb.CoreComponents do
|
||||||
<.input name="my-input" errors={["oh no!"]} />
|
<.input name="my-input" errors={["oh no!"]} />
|
||||||
"""
|
"""
|
||||||
attr :id, :any, default: nil
|
attr :id, :any, default: nil
|
||||||
|
attr :class, :string, default: nil
|
||||||
|
|
||||||
attr :name, :any
|
attr :name, :any
|
||||||
attr :label, :string, default: nil
|
attr :label, :string, default: nil
|
||||||
attr :value, :any
|
attr :value, :any
|
||||||
|
@ -391,6 +393,7 @@ defmodule ChiyaWeb.CoreComponents do
|
||||||
"phx-no-feedback:border-gray-300 phx-no-feedback:focus:border-gray-400 phx-no-feedback:focus:ring-gray-800/5",
|
"phx-no-feedback:border-gray-300 phx-no-feedback:focus:border-gray-400 phx-no-feedback:focus:ring-gray-800/5",
|
||||||
"border-gray-300 focus:border-gray-400 focus:ring-gray-800/5",
|
"border-gray-300 focus:border-gray-400 focus:ring-gray-800/5",
|
||||||
"dark:bg-gray-800 dark:text-gray-300 dark:border-gray-700 dark:focus:border-gray-400",
|
"dark:bg-gray-800 dark:text-gray-300 dark:border-gray-700 dark:focus:border-gray-400",
|
||||||
|
@class,
|
||||||
@errors != [] && "border-rose-400 focus:border-rose-400 focus:ring-rose-400/10"
|
@errors != [] && "border-rose-400 focus:border-rose-400 focus:ring-rose-400/10"
|
||||||
]}
|
]}
|
||||||
{@rest}
|
{@rest}
|
||||||
|
@ -415,6 +418,7 @@ defmodule ChiyaWeb.CoreComponents do
|
||||||
"phx-no-feedback:border-gray-300 phx-no-feedback:focus:border-gray-400 phx-no-feedback:focus:ring-gray-800/5",
|
"phx-no-feedback:border-gray-300 phx-no-feedback:focus:border-gray-400 phx-no-feedback:focus:ring-gray-800/5",
|
||||||
"border-gray-300 focus:border-gray-400 focus:ring-gray-800/5",
|
"border-gray-300 focus:border-gray-400 focus:ring-gray-800/5",
|
||||||
"dark:bg-gray-800 dark:text-gray-300 dark:border-gray-700 dark:focus:border-gray-400",
|
"dark:bg-gray-800 dark:text-gray-300 dark:border-gray-700 dark:focus:border-gray-400",
|
||||||
|
@class,
|
||||||
@errors != [] && "border-rose-400 focus:border-rose-400 focus:ring-rose-400/10"
|
@errors != [] && "border-rose-400 focus:border-rose-400 focus:ring-rose-400/10"
|
||||||
]}
|
]}
|
||||||
{@rest}
|
{@rest}
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
<header class="px-4 sm:px-6 lg:px-8">
|
<header class="px-4 sm:px-6 lg:px-8">
|
||||||
<div class="flex items-center justify-between border-b border-gray-100 dark:border-gray-800 py-3">
|
<div class="flex items-center justify-end border-b border-gray-100 dark:border-gray-800 py-3">
|
||||||
<div class="flex items-center gap-4">
|
|
||||||
<a href="/" class="text-gray-900 font-semibold dark:text-gray-100">Chiya</a>
|
|
||||||
<p class="rounded-full bg-emerald-500/5 px-2 text-[0.8125rem] font-medium leading-6 text-emerald-500">
|
|
||||||
v<%= Application.spec(:chiya, :vsn) %>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center gap-4">
|
<div class="flex items-center gap-4">
|
||||||
<.link
|
<.link
|
||||||
href={~p"/admin/notes"}
|
href={~p"/admin/notes"}
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
<header class="px-4 sm:px-6 lg:px-8">
|
<header class="px-4 sm:px-6 lg:px-8">
|
||||||
<div class="flex items-center justify-between border-b border-theme-dim py-3">
|
<div class="flex items-center justify-end border-b border-theme-dim/50 py-3">
|
||||||
<div class="flex items-center gap-4">
|
|
||||||
<a href="/" class="text-theme-base font-semibold">Chiya</a>
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center gap-4">
|
<div class="flex items-center gap-4">
|
||||||
<.link
|
<.link
|
||||||
href={~p"/n/about"}
|
href={~p"/n/about"}
|
||||||
|
@ -13,6 +10,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main class="px-4 py-20 sm:px-6 lg:px-8">
|
<main class="px-4 py-20 sm:px-6 lg:px-8">
|
||||||
<div class="mx-auto max-w-2xl">
|
<div class="mx-auto max-w-2xl">
|
||||||
<.flash_group flash={@flash} />
|
<.flash_group flash={@flash} />
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
<.table id="notes" rows={@notes} row_click={&JS.navigate(~p"/admin/notes/#{&1}")}>
|
<.table id="notes" rows={@notes} row_click={&JS.navigate(~p"/admin/notes/#{&1}")}>
|
||||||
<:col :let={note} label="Name"><%= note.name %></:col>
|
<:col :let={note} label="Name"><%= note.name %></:col>
|
||||||
|
<:col :let={note} label="Updated at"><%= from_now(note.updated_at) %></:col>
|
||||||
<:col :let={note} label="Published at"><%= from_now(note.published_at) %></:col>
|
<:col :let={note} label="Published at"><%= from_now(note.published_at) %></:col>
|
||||||
<:col :let={note} label="Kind"><%= note.kind %></:col>
|
|
||||||
<:action :let={note}>
|
<:action :let={note}>
|
||||||
<div class="sr-only">
|
<div class="sr-only">
|
||||||
<.link navigate={~p"/admin/notes/#{note}"}>Show</.link>
|
<.link navigate={~p"/admin/notes/#{note}"}>Show</.link>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
rel={identity.rel}
|
rel={identity.rel}
|
||||||
href={identity.url}
|
href={identity.url}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
class="group -mx-2 -my-0.5 inline-flex items-center gap-3 rounded-lg px-2 py-0.5 hover:bg-theme-dim"
|
class="group -mx-2 -my-0.5 inline-flex items-center gap-3 rounded-lg px-2 py-0.5 hover:bg-theme-primary/10 transition"
|
||||||
>
|
>
|
||||||
<%= raw identity.icon %>
|
<%= raw identity.icon %>
|
||||||
<%= identity.name %>
|
<%= identity.name %>
|
||||||
|
@ -27,9 +27,9 @@
|
||||||
<%= if @channel do %>
|
<%= if @channel do %>
|
||||||
<div class="w-full mt-6 sm:w-auto flex flex-col gap-1.5">
|
<div class="w-full mt-6 sm:w-auto flex flex-col gap-1.5">
|
||||||
<%= for note <- @channel.notes do %>
|
<%= for note <- @channel.notes do %>
|
||||||
<a href={~p"/n/#{note.slug}"} class="group rounded -mx-2 -my-0.5 px-2 py-0.5 hover:bg-theme-dim">
|
<a href={~p"/n/#{note.slug}"} class="rounded -mx-2 -my-0.5 px-2 py-0.5 hover:bg-theme-primary/10 transition">
|
||||||
<span class="text-theme-heading text-lg font-semibold leading-8 group-hover:text-theme-heading/75"><%= note.name %></span>
|
<span class="text-theme-heading text-lg font-semibold leading-8"><%= note.name %></span>
|
||||||
<span class="text-theme-muted text-sm group-hover:text-theme-muted/75"><%= pretty_date(note.published_at) %></span>
|
<span class="text-theme-base text-sm"><%= pretty_date(note.published_at) %></span>
|
||||||
</a>
|
</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
options={Ecto.Enum.values(Chiya.Site.Setting, :theme)}
|
options={Ecto.Enum.values(Chiya.Site.Setting, :theme)}
|
||||||
/>
|
/>
|
||||||
<.input field={f[:user_agent]} type="text" label="User agent" />
|
<.input field={f[:user_agent]} type="text" label="User agent" />
|
||||||
<.input field={f[:custom_css]} type="textarea" label="Custom css" />
|
<.input field={f[:custom_css]} type="textarea" label="Custom css" class="font-mono" />
|
||||||
<.input field={f[:custom_html]} type="textarea" label="Custom html" />
|
<.input field={f[:custom_html]} type="textarea" label="Custom html" class="font-mono" />
|
||||||
<.input field={f[:home_channel_id]} type="select" label="Home Channel" options={@channels} />
|
<.input field={f[:home_channel_id]} type="select" label="Home Channel" options={@channels} />
|
||||||
<:actions>
|
<:actions>
|
||||||
<.button>Save Setting</.button>
|
<.button>Save Setting</.button>
|
||||||
|
|
Loading…
Reference in a new issue