yay #290
20 changed files with 272 additions and 395 deletions
|
@ -9,70 +9,79 @@
|
||||||
The base layer is for things like reset rules or default styles applied to plain HTML elements.
|
The base layer is for things like reset rules or default styles applied to plain HTML elements.
|
||||||
*/
|
*/
|
||||||
@layer base {
|
@layer base {
|
||||||
:root {
|
|
||||||
--color-background: 255 255 255;
|
|
||||||
--color-foreground: 0 0 0;
|
|
||||||
--color-primary: 0 0 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
:root[mode=dark] {
|
|
||||||
--color-background: 0 0 0;
|
|
||||||
--color-foreground: 255 255 255;
|
|
||||||
--color-primary: 255 255 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
html {
|
html {
|
||||||
font-family: 'Inter', sans-serif;
|
font-family: 'Inter', sans-serif;
|
||||||
font-feature-settings: "case", "cpsp", "frac", "salt", "ccmp", "cv01", "cv02", "cv03", "cv04", "cv05", "cv06", "cv07", "cv09", "cv10", "cv11";
|
font-feature-settings: "case", "cpsp", "frac", "salt", "ccmp", "cv01", "cv02", "cv03", "cv04", "cv05", "cv06", "cv07", "cv09", "cv10", "cv11";
|
||||||
|
@apply text-slate-800;
|
||||||
}
|
}
|
||||||
|
|
||||||
header h1 { @apply text-xl; }
|
|
||||||
|
|
||||||
.stack > * + * {
|
.stack > * + * {
|
||||||
margin-block-start: var(--flow-space, 1em);
|
margin-block-start: var(--flow-space, 1em);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ============= SITE LAYOUT =============
|
||||||
|
*/
|
||||||
|
|
||||||
|
#site-header {
|
||||||
|
@apply block px-3 py-6 bg-gradient-to-r from-slate-900 to-slate-950 text-white print:hidden;
|
||||||
|
|
||||||
|
nav ul {
|
||||||
|
@apply flex gap-3;
|
||||||
|
|
||||||
|
a { @apply p-3 rounded hover:bg-primary-500 transition; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#primary-sidebar {
|
||||||
|
@apply col-span-1;
|
||||||
|
|
||||||
|
nav {
|
||||||
|
@apply flex flex-col md:flex-row lg:flex-col mb-6 lg:mb-0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu {
|
||||||
|
@apply flex-1;
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
@apply font-bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#site-content {
|
||||||
|
@apply grid grid-cols-1 lg:grid-cols-5 gap-0 lg:gap-12;
|
||||||
|
|
||||||
|
#secondary-sidebar {
|
||||||
|
@apply col-span-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content-wrapper {
|
||||||
|
@apply col-span-4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ============= PAGE LAYOUT =============
|
||||||
|
*/
|
||||||
|
|
||||||
|
header.page-header {
|
||||||
|
@apply border-b border-slate-300;
|
||||||
|
|
||||||
|
> h1 {
|
||||||
|
@apply text-3xl leading-loose font-bold text-slate-900;
|
||||||
|
}
|
||||||
|
|
||||||
|
> p {
|
||||||
|
@apply mb-3;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The components layer is for class-based styles that you want to be able to override with utilities.
|
The components layer is for class-based styles that you want to be able to override with utilities.
|
||||||
*/
|
*/
|
||||||
@layer components {
|
@layer components {
|
||||||
|
|
||||||
#site-header {
|
|
||||||
@apply py-8 block px-3 bg-black text-white print:hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
#site-header nav ul {
|
|
||||||
@apply flex gap-3;
|
|
||||||
}
|
|
||||||
|
|
||||||
#site-content {
|
|
||||||
@apply grid grid-cols-1 lg:grid-cols-5 gap-12;
|
|
||||||
}
|
|
||||||
|
|
||||||
aside#primary-sidebar {
|
|
||||||
@apply col-span-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
aside#primary-sidebar nav {
|
|
||||||
@apply flex flex-col md:flex-row lg:flex-col;
|
|
||||||
}
|
|
||||||
aside#primary-sidebar .menu {
|
|
||||||
@apply flex-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
aside#primary-sidebar .menu h2 {
|
|
||||||
@apply font-bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
aside#secondary-sidebar {
|
|
||||||
@apply col-span-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
section#content-wrapper {
|
|
||||||
@apply col-span-4;
|
|
||||||
}
|
|
||||||
|
|
||||||
.divider {
|
.divider {
|
||||||
@apply flex items-center my-8 before:flex-1 after:flex-1 before:content-[''] after:content-[''] before:p-[0.5px] after:p-[0.5px] w-full mx-auto last:hidden;
|
@apply flex items-center my-8 before:flex-1 after:flex-1 before:content-[''] after:content-[''] before:p-[0.5px] after:p-[0.5px] w-full mx-auto last:hidden;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
/*!
|
|
||||||
Theme: Gruvbox dark, hard
|
|
||||||
Author: Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox)
|
|
||||||
License: ~ MIT (or more permissive) [via base16-schemes-source]
|
|
||||||
Maintainer: @highlightjs/core-team
|
|
||||||
Version: 2021.09.0
|
|
||||||
*/pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{color:#d5c4a1;background:#1d2021}.hljs ::selection,.hljs::selection{background-color:#504945;color:#d5c4a1}.hljs-comment{color:#665c54}.hljs-tag{color:#bdae93}.hljs-operator,.hljs-punctuation,.hljs-subst{color:#d5c4a1}.hljs-operator{opacity:.7}.hljs-bullet,.hljs-deletion,.hljs-name,.hljs-selector-tag,.hljs-template-variable,.hljs-variable{color:#fb4934}.hljs-attr,.hljs-link,.hljs-literal,.hljs-number,.hljs-symbol,.hljs-variable.constant_{color:#fe8019}.hljs-class .hljs-title,.hljs-title,.hljs-title.class_{color:#fabd2f}.hljs-strong{font-weight:700;color:#fabd2f}.hljs-addition,.hljs-code,.hljs-string,.hljs-title.class_.inherited__{color:#b8bb26}.hljs-built_in,.hljs-doctag,.hljs-keyword.hljs-atrule,.hljs-quote,.hljs-regexp{color:#8ec07c}.hljs-attribute,.hljs-function .hljs-title,.hljs-section,.hljs-title.function_,.ruby .hljs-property{color:#83a598}.diff .hljs-meta,.hljs-keyword,.hljs-template-tag,.hljs-type{color:#d3869b}.hljs-emphasis{color:#d3869b;font-style:italic}.hljs-meta,.hljs-meta .hljs-keyword,.hljs-meta .hljs-string{color:#d65d0e}.hljs-meta .hljs-keyword,.hljs-meta-keyword{font-weight:700}
|
|
|
@ -1,52 +0,0 @@
|
||||||
/*
|
|
||||||
1. Use a more-intuitive box-sizing model.
|
|
||||||
*/
|
|
||||||
*, *::before, *::after {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
2. Remove default margin
|
|
||||||
*/
|
|
||||||
* {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
3. Allow percentage-based heights in the application
|
|
||||||
*/
|
|
||||||
html, body {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
Typographic tweaks!
|
|
||||||
4. Add accessible line-height
|
|
||||||
5. Improve text rendering
|
|
||||||
*/
|
|
||||||
body {
|
|
||||||
line-height: 1.5;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
6. Improve media defaults
|
|
||||||
*/
|
|
||||||
img, picture, video, canvas, svg {
|
|
||||||
display: block;
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
7. Remove built-in form typography styles
|
|
||||||
*/
|
|
||||||
input, button, textarea, select {
|
|
||||||
font: inherit;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
8. Avoid text overflows
|
|
||||||
*/
|
|
||||||
p, h1, h2, h3, h4, h5, h6 {
|
|
||||||
overflow-wrap: break-word;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
9. Create a root stacking context
|
|
||||||
*/
|
|
||||||
#root, #__next {
|
|
||||||
isolation: isolate;
|
|
||||||
}
|
|
|
@ -14,7 +14,12 @@ module.exports = {
|
||||||
],
|
],
|
||||||
darkMode: ['class', '[data-mode="dark"]'],
|
darkMode: ['class', '[data-mode="dark"]'],
|
||||||
theme: {
|
theme: {
|
||||||
container: { center: true }
|
container: { center: true },
|
||||||
|
extend: {
|
||||||
|
colors: {
|
||||||
|
primary: colors.pink
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
require("@tailwindcss/forms"),
|
require("@tailwindcss/forms"),
|
||||||
|
|
|
@ -8,7 +8,7 @@ defmodule Chiya.Tags do
|
||||||
|
|
||||||
alias Chiya.Tags.Tag
|
alias Chiya.Tags.Tag
|
||||||
|
|
||||||
@preloads [notes: [:tags]]
|
@preloads [notes: [tags: [:notes]]]
|
||||||
defp with_preloads(query), do: preload(query, ^@preloads)
|
defp with_preloads(query), do: preload(query, ^@preloads)
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
|
|
|
@ -74,20 +74,26 @@
|
||||||
<aside id="primary-sidebar">
|
<aside id="primary-sidebar">
|
||||||
<nav>
|
<nav>
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
<h2>Info</h2>
|
<h2>Pages</h2>
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>Served by Chiya v<%= Application.spec(:chiya, :vsn) %></li>
|
|
||||||
<li>Made by Inhji</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="menu">
|
|
||||||
<h2>Links</h2>
|
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href={~p"/wiki"}>Wiki</a></li>
|
<li><a href={~p"/wiki"}>Wiki</a></li>
|
||||||
<li><a href={~p"/about"}>About</a></li>
|
<li><a href={~p"/about"}>About</a></li>
|
||||||
|
<li><a href={~p"/bookmarks"}>Bookmarks</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="menu">
|
||||||
|
<h2>Channels</h2>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<%= for channel <- @channels do %>
|
||||||
|
<li>
|
||||||
|
<a href={~p"/channel/#{channel.slug}"}>
|
||||||
|
<%= channel.name %>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -100,20 +106,6 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="menu">
|
|
||||||
<h2>Elsewhere</h2>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<%= for channel <- @channels do %>
|
|
||||||
<li>
|
|
||||||
<a href={~p"/channel/#{channel.slug}"}>
|
|
||||||
<%= channel.name %>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
</nav>
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
|
@ -139,13 +131,5 @@
|
||||||
<span class="p-note"><%= @profile.bio %></span>
|
<span class="p-note"><%= @profile.bio %></span>
|
||||||
</section>
|
</section>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<section class="flex h-1 w-full flex-row">
|
|
||||||
<div class="bg-rose-500 w-full"></div>
|
|
||||||
<div class="bg-violet-500 w-full"></div>
|
|
||||||
<div class="bg-blue-500 w-full"></div>
|
|
||||||
<div class="bg-cyan-500 w-full"></div>
|
|
||||||
<div class="bg-emerald-500 w-full"></div>
|
|
||||||
</section>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -76,7 +76,7 @@ defmodule ChiyaWeb.PublicComponents do
|
||||||
<%= tag.name %>
|
<%= tag.name %>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<.dot class="text-theme-base/50 last:hidden" />
|
<.dot class="last:hidden" />
|
||||||
<% end %>
|
<% end %>
|
||||||
</span>
|
</span>
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
defmodule ChiyaWeb.PageController do
|
defmodule ChiyaWeb.PageController do
|
||||||
use ChiyaWeb, :controller
|
use ChiyaWeb, :controller
|
||||||
|
alias Chiya.Channels
|
||||||
|
|
||||||
plug :put_layout, html: {ChiyaWeb.Layouts, :public}
|
plug :put_layout, html: {ChiyaWeb.Layouts, :public}
|
||||||
|
|
||||||
|
@ -9,7 +10,7 @@ defmodule ChiyaWeb.PageController do
|
||||||
channel =
|
channel =
|
||||||
case settings.home_channel_id do
|
case settings.home_channel_id do
|
||||||
nil -> nil
|
nil -> nil
|
||||||
id -> Chiya.Channels.get_channel!(id) |> Chiya.Channels.preload_channel_public()
|
id -> Channels.get_channel!(id) |> Channels.preload_channel_public()
|
||||||
end
|
end
|
||||||
|
|
||||||
render(conn, :home,
|
render(conn, :home,
|
||||||
|
@ -20,8 +21,8 @@ defmodule ChiyaWeb.PageController do
|
||||||
|
|
||||||
def channel(conn, %{"slug" => channel_slug}) do
|
def channel(conn, %{"slug" => channel_slug}) do
|
||||||
channel =
|
channel =
|
||||||
Chiya.Channels.get_channel_by_slug!(channel_slug)
|
Channels.get_channel_by_slug!(channel_slug)
|
||||||
|> Chiya.Channels.preload_channel_public()
|
|> Channels.preload_channel_public()
|
||||||
|
|
||||||
render(conn, :channel,
|
render(conn, :channel,
|
||||||
channel: channel,
|
channel: channel,
|
||||||
|
@ -42,14 +43,14 @@ defmodule ChiyaWeb.PageController do
|
||||||
note = Chiya.Notes.get_note_by_slug_preloaded!(note_slug)
|
note = Chiya.Notes.get_note_by_slug_preloaded!(note_slug)
|
||||||
changeset = Chiya.Notes.change_note_comment(%Chiya.Notes.NoteComment{}, %{note_id: note.id})
|
changeset = Chiya.Notes.change_note_comment(%Chiya.Notes.NoteComment{}, %{note_id: note.id})
|
||||||
|
|
||||||
if is_nil(note.published_at) and is_nil(conn.assigns.current_user) do
|
if note.published_at || conn.assigns.current_user do
|
||||||
render_error(conn, :not_found)
|
|
||||||
else
|
|
||||||
render(conn, :note,
|
render(conn, :note,
|
||||||
note: note,
|
note: note,
|
||||||
page_title: note.name,
|
page_title: note.name,
|
||||||
changeset: changeset
|
changeset: changeset
|
||||||
)
|
)
|
||||||
|
else
|
||||||
|
render_error(conn, :not_found)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -57,66 +58,44 @@ defmodule ChiyaWeb.PageController do
|
||||||
note = Chiya.Notes.get_note_by_slug_preloaded("about")
|
note = Chiya.Notes.get_note_by_slug_preloaded("about")
|
||||||
user = Chiya.Accounts.get_user!(1)
|
user = Chiya.Accounts.get_user!(1)
|
||||||
|
|
||||||
|
if note && user do
|
||||||
render(conn, :about,
|
render(conn, :about,
|
||||||
note: note,
|
note: note,
|
||||||
user: user,
|
user: user,
|
||||||
page_title: "About"
|
page_title: "About"
|
||||||
)
|
)
|
||||||
|
else
|
||||||
|
render_error(conn, :not_found)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def wiki(conn, _params) do
|
def wiki(conn, _params) do
|
||||||
[channel, notes_updated, notes_published] =
|
if id = conn.assigns.settings.wiki_channel_id do
|
||||||
case conn.assigns.settings.wiki_channel_id do
|
|
||||||
nil ->
|
|
||||||
[nil, nil, nil]
|
|
||||||
|
|
||||||
id ->
|
|
||||||
channel = Chiya.Channels.get_channel!(id)
|
channel = Chiya.Channels.get_channel!(id)
|
||||||
updated = Chiya.Notes.list_notes_by_channel_updated(channel, 5)
|
notes = Chiya.Notes.list_notes_by_channel_updated(channel, 999)
|
||||||
published = Chiya.Notes.list_notes_by_channel_published(channel, 5)
|
|
||||||
[channel, updated, published]
|
|
||||||
end
|
|
||||||
|
|
||||||
render(conn, :wiki,
|
render(conn, :wiki,
|
||||||
channel: channel,
|
channel: channel,
|
||||||
notes_updated: notes_updated,
|
notes: notes,
|
||||||
notes_published: notes_published,
|
|
||||||
page_title: "Wiki"
|
page_title: "Wiki"
|
||||||
)
|
)
|
||||||
|
else
|
||||||
|
render_error(conn, :not_found)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def bookmarks(conn, _params) do
|
def bookmarks(conn, _params) do
|
||||||
[channel, notes, tags] =
|
if id = conn.assigns.settings.bookmark_channel_id do
|
||||||
case conn.assigns.settings.bookmark_channel_id do
|
|
||||||
nil ->
|
|
||||||
[nil, nil]
|
|
||||||
|
|
||||||
id ->
|
|
||||||
channel = Chiya.Channels.get_channel!(id)
|
channel = Chiya.Channels.get_channel!(id)
|
||||||
notes = Chiya.Notes.list_notes_by_channel_published(channel, 999)
|
notes = Chiya.Notes.list_notes_by_channel_published(channel, 999)
|
||||||
tags = group_tags(notes)
|
|
||||||
|
|
||||||
[channel, notes, tags]
|
|
||||||
end
|
|
||||||
|
|
||||||
render(conn, :bookmarks,
|
render(conn, :bookmarks,
|
||||||
channel: channel,
|
channel: channel,
|
||||||
notes: notes,
|
notes: notes,
|
||||||
tags: tags,
|
|
||||||
page_title: "Bookmarks"
|
page_title: "Bookmarks"
|
||||||
)
|
)
|
||||||
end
|
else
|
||||||
|
render_error(conn, :not_found)
|
||||||
defp group_tags(notes) do
|
end
|
||||||
Enum.reduce(notes, [], fn n, acc ->
|
|
||||||
acc ++ n.tags
|
|
||||||
end)
|
|
||||||
|> Enum.uniq_by(fn t -> t.id end)
|
|
||||||
|> Enum.sort_by(fn t -> t.slug end, :asc)
|
|
||||||
|> Enum.group_by(
|
|
||||||
fn n -> String.first(n.name) end,
|
|
||||||
fn n -> n end
|
|
||||||
)
|
|
||||||
|> IO.inspect()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,10 @@ defmodule ChiyaWeb.PageHTML do
|
||||||
|
|
||||||
embed_templates "page_html/*"
|
embed_templates "page_html/*"
|
||||||
|
|
||||||
|
attr :notes, :list, required: true
|
||||||
|
attr :layout, :atom, default: :default
|
||||||
|
attr :show_content, :boolean, default: true
|
||||||
|
def note_list(assigns)
|
||||||
|
|
||||||
attr :notes, :list, required: true
|
attr :notes, :list, required: true
|
||||||
attr :show_content, :boolean, default: true
|
attr :show_content, :boolean, default: true
|
||||||
|
@ -47,4 +51,16 @@ defmodule ChiyaWeb.PageHTML do
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def group_tags(notes) do
|
||||||
|
Enum.reduce(notes, [], fn n, acc ->
|
||||||
|
acc ++ n.tags
|
||||||
|
end)
|
||||||
|
|> Enum.uniq_by(fn t -> t.id end)
|
||||||
|
|> Enum.sort_by(fn t -> t.slug end, :asc)
|
||||||
|
|> Enum.group_by(
|
||||||
|
fn n -> String.first(n.name) end,
|
||||||
|
fn n -> n end
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,20 +1,18 @@
|
||||||
<section class="max-w-2xl mx-auto">
|
<article class="h-card hcard | stack">
|
||||||
<article class="h-card hcard">
|
|
||||||
<section class="flex gap-3">
|
<section class="flex gap-3">
|
||||||
<img
|
<img
|
||||||
class="rounded-lg block text-center w-28 h-28 | u-photo"
|
class="rounded-lg block text-center w-28 h-28 | u-photo"
|
||||||
src={ChiyaWeb.Uploaders.UserImage.url({@user.user_image, @current_user}, :thumb)}
|
src={ChiyaWeb.Uploaders.UserImage.url({@user.user_image, @current_user}, :thumb)}
|
||||||
/>
|
/>
|
||||||
<.header class="flex-1">
|
<header class="page-header | flex-1">
|
||||||
<span class="p-name"><%= @user.name %></span>
|
<h1 class="p-name"><%= @user.name %></h1>
|
||||||
<:subtitle><%= @user.bio %></:subtitle>
|
<p><%= @user.bio %></p>
|
||||||
</.header>
|
</header>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<%= if @note do %>
|
<%= if @note do %>
|
||||||
<section class="mx-auto mt-8 prose prose-gruvbox md:prose-lg lg:prose-xl | p-summary e-content">
|
<section class="prose max-w-none | p-summary e-content">
|
||||||
<%= Markdown.render(@note.content) |> raw %>
|
<%= Markdown.render(@note.content) |> raw %>
|
||||||
</section>
|
</section>
|
||||||
<% end %>
|
<% end %>
|
||||||
</article>
|
</article>
|
||||||
</section>
|
|
||||||
|
|
|
@ -1,40 +1,14 @@
|
||||||
<%= if @channel do %>
|
<header class="page-header">
|
||||||
<header>
|
|
||||||
<h1><%= Enum.count(@notes) %> Bookmarks</h1>
|
<h1><%= Enum.count(@notes) %> Bookmarks</h1>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<section class="mt-6 grid grid-cols-1 md:grid-cols-3 gap-3">
|
<section class="mt-6 grid grid-cols-1 md:grid-cols-3 gap-3">
|
||||||
<section class="col-span-1 md:col-span-2">
|
<section class="col-span-1 md:col-span-2">
|
||||||
<%= if @channel.layout == :default do %>
|
<.note_list notes={@notes} layout={@channel.layout} />
|
||||||
<.note_list_default notes={@notes}/>
|
|
||||||
<% end %>
|
|
||||||
<%= if @channel.layout == :gallery do %>
|
|
||||||
<.note_list_gallery notes={@notes}/>
|
|
||||||
<% end %>
|
|
||||||
<%= if @channel.layout == :microblog do %>
|
|
||||||
<.note_list_microblog notes={@notes}/>
|
|
||||||
<% end %>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<ul>
|
<.tag_list notes={@notes} />
|
||||||
<%= for {letter, tag_group} <- @tags do %>
|
</section>
|
||||||
<li class="mb-2">
|
</section>
|
||||||
<span class="capitalize text-theme-primary border border-theme-background1 rounded font-sm px-2 py-1 inline-block mb-2">
|
|
||||||
<%= letter %>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<%= for tag <- tag_group do %>
|
|
||||||
<a
|
|
||||||
href={~p"/tagged-with/#{tag.slug}"}
|
|
||||||
class="border border-theme-background1 rounded font-sm px-2 py-1 inline-block mb-2 hover:bg-theme-background1 transition"
|
|
||||||
>
|
|
||||||
<%= tag.name %> <span class="text-theme-base text-xs font-mono bg-theme-primary/25 rounded-full py-0.5 px-1 align-middle"><%= Enum.count(tag.notes) %></span>
|
|
||||||
</a>
|
|
||||||
<% end %>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
<% end %>
|
|
||||||
|
|
|
@ -1,18 +1,8 @@
|
||||||
<section class="max-w-2xl mx-auto">
|
<header class="page-header">
|
||||||
<.header>
|
<h1><%= @channel.name %></h1>
|
||||||
<%= @channel.name %>
|
<p><%= Markdown.render(@channel.content) |> raw %></p>
|
||||||
<:subtitle><%= Markdown.render(@channel.content) |> raw %></:subtitle>
|
</header>
|
||||||
</.header>
|
|
||||||
|
|
||||||
<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">
|
||||||
<%= if @channel.layout == :default do %>
|
<.note_list notes={@channel.notes}/>
|
||||||
<.note_list_default notes={@channel.notes}/>
|
|
||||||
<% end %>
|
|
||||||
<%= if @channel.layout == :gallery do %>
|
|
||||||
<.note_list_gallery notes={@channel.notes}/>
|
|
||||||
<% end %>
|
|
||||||
<%= if @channel.layout == :microblog do %>
|
|
||||||
<.note_list_microblog notes={@channel.notes}/>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
<%= if @channel do %>
|
<%= if @channel do %>
|
||||||
<.note_list notes={@channel.notes} channel={@channel} />
|
<.note_list notes={@channel.notes} layout={@channel.layout} />
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -9,10 +9,14 @@
|
||||||
<ul class="flex gap-3">
|
<ul class="flex gap-3">
|
||||||
<li>
|
<li>
|
||||||
<a href={~p"/admin/notes/#{@note}/edit"} class="button">
|
<a href={~p"/admin/notes/#{@note}/edit"} class="button">
|
||||||
<.icon name="hero-pencil-square" /> Edit
|
Edit
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href={~p"/admin/notes/#{@note}"} class="button">
|
||||||
|
Show in Admin
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href={~p"/admin/notes/#{@note}"} class="button">Show in Admin</a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
@ -50,25 +54,24 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
|
<dl>
|
||||||
|
<dt>
|
||||||
<%= if @note.published_at do %>
|
<%= if @note.published_at do %>
|
||||||
<span>Published</span>
|
<span>Published</span>
|
||||||
<% else %>
|
<% else %>
|
||||||
<span>Unpublished</span>
|
<span>Unpublished</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<time class="font-semibold | dt-published"><%= pretty_date(@note.published_at) %></time>
|
</dt>
|
||||||
<.dot />
|
<dd><time class="dt-published"><%= pretty_date(@note.published_at) %></time></dd>
|
||||||
<span>Last Updated</span>
|
<dt>Last updated</dt>
|
||||||
<time class="font-semibold" datetime={datetime(@note.updated_at)}>
|
<dd>
|
||||||
<%= pretty_date(@note.updated_at) %>
|
<time class="dt-published"><%= pretty_date(@note.published_at) %></time>
|
||||||
</time>
|
</dd>
|
||||||
<%= if not Enum.empty?(@note.tags) do %>
|
<dt>Tags</dt>
|
||||||
<.dot />
|
<dd><.tags note={@note} /></dd>
|
||||||
<.tags note={@note} />
|
<dt>Kind</dt>
|
||||||
<% end %>
|
<dd><%= @note.kind %></dd>
|
||||||
<%= if @note.kind != :post do %>
|
</dl>
|
||||||
<.dot />
|
|
||||||
<span><%= @note.kind %></span>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<a href={~p"/"} class="hidden | h-card u-author">Inhji</a>
|
<a href={~p"/"} class="hidden | h-card u-author">Inhji</a>
|
||||||
<a href={~p"/note/#{@note.slug}"} class="hidden | u-url u-uid"><%= @note.name %></a>
|
<a href={~p"/note/#{@note.slug}"} class="hidden | u-url u-uid"><%= @note.name %></a>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<%= if @channel.layout == :default do %>
|
<%= if @layout == :default do %>
|
||||||
<.note_list_default notes={@notes_updated}/>
|
<.note_list_default notes={@notes} show_content={@show_content}/>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= if @channel.layout == :gallery do %>
|
<%= if @layout == :gallery do %>
|
||||||
<.note_list_gallery notes={@notes_updated}/>
|
<.note_list_gallery notes={@notes} show_content={@show_content}/>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= if @channel.layout == :microblog do %>
|
<%= if @layout == :microblog do %>
|
||||||
<.note_list_microblog notes={@notes_updated}/>
|
<.note_list_microblog notes={@notes} show_content={@show_content}/>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
<section class="note-list default">
|
<section class="note-list default stack">
|
||||||
<%= for note <- assigns.notes do %>
|
<%= for note <- assigns.notes do %>
|
||||||
|
<article>
|
||||||
<a
|
<a
|
||||||
href={~p"/note/#{note.slug}"}
|
href={~p"/note/#{note.slug}"}
|
||||||
class="block rounded-lg px-6 py-4 border border-theme-background1 hover:bg-theme-background1 transition"
|
class="block"
|
||||||
>
|
>
|
||||||
<header class="flex flex-row items-center gap-1">
|
<header class="flex flex-row items-center gap-1">
|
||||||
<span class="text-theme-primary text-lg font-semibold leading-8 flex-1">
|
<span class="text-theme-primary text-lg font-semibold leading-8 flex-1">
|
||||||
|
@ -25,5 +26,6 @@
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</a>
|
</a>
|
||||||
|
</article>
|
||||||
<% end %>
|
<% end %>
|
||||||
</section>
|
</section>
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
<section class="note-list gallery | stack">
|
<section class="note-list gallery | stack">
|
||||||
<%= for note <- assigns.notes do %>
|
<%= for note <- assigns.notes do %>
|
||||||
<article>
|
<article>
|
||||||
|
|
|
@ -1,18 +1,14 @@
|
||||||
<section class="max-w-2xl mx-auto">
|
<header class="page-header">
|
||||||
<.header>
|
<h1><%= Enum.count(@tag.notes) %> Tagged with “<%= @tag.name %>”</h1>
|
||||||
Tagged with “<%= @tag.name %>”
|
<p><%= @tag.content %></p>
|
||||||
<:subtitle><%= @tag.content %></:subtitle>
|
</header>
|
||||||
</.header>
|
|
||||||
|
|
||||||
<div class="w-full mt-6 sm:w-auto flex flex-col gap-1.5">
|
<section class="mt-6 grid grid-cols-1 md:grid-cols-3 gap-3">
|
||||||
<%= if @channel.layout == :default do %>
|
<section class="col-span-1 md:col-span-2">
|
||||||
<.note_list_default note={@channel.notes}/>
|
<.note_list notes={@tag.notes} />
|
||||||
<% end %>
|
</section>
|
||||||
<%= if @channel.layout == :gallery do %>
|
|
||||||
<.note_list_gallery note={@channel.notes}/>
|
<section>
|
||||||
<% end %>
|
<.tag_list notes={@tag.notes} />
|
||||||
<%= if @channel.layout == :microblog do %>
|
</section>
|
||||||
<.note_list_microblog note={@channel.notes}/>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
18
lib/chiya_web/controllers/page_html/tag_list.html.heex
Normal file
18
lib/chiya_web/controllers/page_html/tag_list.html.heex
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<ul>
|
||||||
|
<%= for {letter, tag_group} <- group_tags(@notes) do %>
|
||||||
|
<li class="mb-2">
|
||||||
|
<span class="capitalize text-theme-primary border border-theme-background1 rounded font-sm px-2 py-1 inline-block mb-2">
|
||||||
|
<%= letter %>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<%= for tag <- tag_group do %>
|
||||||
|
<a
|
||||||
|
href={~p"/tagged-with/#{tag.slug}"}
|
||||||
|
class="border border-theme-background1 rounded font-sm px-2 py-1 inline-block mb-2 hover:bg-theme-background1 transition"
|
||||||
|
>
|
||||||
|
<%= tag.name %> <span class="text-theme-base text-xs font-mono bg-theme-primary/25 rounded-full py-0.5 px-1 align-middle"><%= Enum.count(tag.notes) %></span>
|
||||||
|
</a>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
|
@ -1,51 +1,14 @@
|
||||||
<%= if @channel do %>
|
<header class="page-header">
|
||||||
<header>
|
|
||||||
<h1><%= @channel.name %></h1>
|
<h1><%= @channel.name %></h1>
|
||||||
|
<p><%= Markdown.render(@channel.content) |> raw %></p>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<section class="mt-6 flex flex-col">
|
<section class="mt-6 grid grid-cols-1 md:grid-cols-3 gap-3">
|
||||||
<section class="prose prose-gruvbox md:prose-lg lg:prose-xl max-w-none">
|
<section class="col-span-1 md:col-span-2">
|
||||||
<%= Markdown.render(@channel.content) |> raw %>
|
<.note_list notes={@notes} />
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<aside class="flex flex-col md:flex-row gap-3 mt-6">
|
|
||||||
<div class="mt-6 flex flex-1 flex-col gap-1.5">
|
|
||||||
<h2 class="text-xl text-theme-base">Recently Updated</h2>
|
|
||||||
|
|
||||||
<%= if @channel.layout == :default do %>
|
|
||||||
<.note_list_default notes={@notes_updated}/>
|
|
||||||
<% end %>
|
|
||||||
<%= if @channel.layout == :gallery do %>
|
|
||||||
<.note_list_gallery notes={@notes_updated}/>
|
|
||||||
<% end %>
|
|
||||||
<%= if @channel.layout == :microblog do %>
|
|
||||||
<.note_list_microblog notes={@notes_updated}/>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-6 flex flex-1 flex-col gap-1.5">
|
|
||||||
<h2 class="text-xl text-theme-base">Recently Published</h2>
|
|
||||||
|
|
||||||
<%= if @channel.layout == :default do %>
|
|
||||||
<.note_list_default notes={@notes_published}/>
|
|
||||||
<% end %>
|
|
||||||
<%= if @channel.layout == :gallery do %>
|
|
||||||
<.note_list_gallery notes={@notes_published}/>
|
|
||||||
<% end %>
|
|
||||||
<%= if @channel.layout == :microblog do %>
|
|
||||||
<.note_list_microblog notes={@notes_published}/>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</aside>
|
|
||||||
</section>
|
|
||||||
<% else %>
|
|
||||||
<section>
|
<section>
|
||||||
<.header>
|
<.tag_list notes={@notes} />
|
||||||
Wiki
|
|
||||||
</.header>
|
|
||||||
|
|
||||||
<section class="prose">
|
|
||||||
Wiki is not set up.
|
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
<% end %>
|
|
||||||
|
|
Loading…
Reference in a new issue