devel #340

Merged
inhji merged 3 commits from devel into main 2023-09-23 22:49:48 +02:00
5 changed files with 28 additions and 12 deletions

View file

@ -25,8 +25,8 @@
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";
} }
body { body#site-body {
@apply bg-gradient-to-br from-background from-50% to-rose-100 text-foreground; @apply bg-gradient-to-br from-background from-50% to-rose-100 dark:to-rose-950 text-foreground;
} }
.stack > * + * { .stack > * + * {
@ -49,7 +49,7 @@
/* === SITE HEADER === */ /* === SITE HEADER === */
#site-header { #site-header {
@apply block px-3 py-6 bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 text-white print:hidden; @apply sticky top-0 block px-3 py-6 bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 text-white print:hidden;
& nav ul { & nav ul {
@apply flex; @apply flex;
@ -58,6 +58,10 @@
& a { & a {
@apply p-3 rounded transition border border-transparent hover:border-white; @apply p-3 rounded transition border border-transparent hover:border-white;
} }
& #site-title {
@apply font-bold uppercase;
}
} }
/* === PRIMARY SIDEBAR === */ /* === PRIMARY SIDEBAR === */
@ -67,7 +71,7 @@
@apply prose-a:no-underline; @apply prose-a:no-underline;
& nav { & nav {
@apply flex justify-around md:flex-row lg:flex-col mb-6 lg:mb-0; @apply flex justify-between md:flex-row lg:flex-col mb-6 lg:mb-0;
} }
& h3 { & h3 {
@ -83,7 +87,7 @@
#site-content { #site-content {
@apply grid grid-cols-1 lg:grid-cols-5 gap-0 lg:gap-12; @apply grid grid-cols-1 lg:grid-cols-5 gap-0 lg:gap-12;
@apply sm:mt-12 px-3 sm:px-0; @apply mt-6 sm:mt-12 px-6 sm:px-0;
#content-wrapper { #content-wrapper {
@apply col-span-4; @apply col-span-4;
@ -97,7 +101,7 @@
/* === SITE FOOTER === */ /* === SITE FOOTER === */
#site-footer { #site-footer {
@apply mt-8 prose max-w-none; @apply p-8 mt-8 max-w-none bg-foreground/20 border-t border-foreground/10;
} }
/* === CONCERNING MULTIPLE LAYOUT BLOCKS === */ /* === CONCERNING MULTIPLE LAYOUT BLOCKS === */

View file

@ -63,6 +63,7 @@ defmodule Chiya.Notes do
|> where([n], fragment("? ~ ?", n.name, ^tag.regex)) |> where([n], fragment("? ~ ?", n.name, ^tag.regex))
|> or_where([n], fragment("? ~ ?", n.url, ^tag.regex)) |> or_where([n], fragment("? ~ ?", n.url, ^tag.regex))
|> or_where([n], fragment("? ~ ?", n.content, ^tag.regex)) |> or_where([n], fragment("? ~ ?", n.content, ^tag.regex))
|> preload(^@preloads)
|> Repo.all() |> Repo.all()
end end

View file

@ -35,12 +35,12 @@
<%= @settings.custom_css %> <%= @settings.custom_css %>
</style> </style>
</head> </head>
<body class="h-feed hfeed"> <body id="site-body" class="h-feed hfeed">
<header id="site-header"> <header id="site-header">
<nav class="container"> <nav class="container">
<ul> <ul>
<li> <li>
<a href="/">Home</a> <a href="/" id="site-title">Inhji.de</a>
</li> </li>
<li class="flex-1"></li> <li class="flex-1"></li>
<%= if @current_user do %> <%= if @current_user do %>
@ -106,7 +106,7 @@
</main> </main>
<footer id="site-footer" class="container"> <footer id="site-footer" class="container">
<p class="container text-center"> <p class="text-center">
Struggling to make a decent website since 2011 Struggling to make a decent website since 2011
</p> </p>
</footer> </footer>

View file

@ -15,7 +15,18 @@ defmodule ChiyaWeb.TagController do
def apply_prepare(conn, %{"id" => id}) do def apply_prepare(conn, %{"id" => id}) do
tag = Tags.get_tag!(id) tag = Tags.get_tag!(id)
notes = Chiya.Notes.list_apply_notes(tag)
notes =
tag
|> Chiya.Notes.list_apply_notes()
|> Enum.filter(fn note ->
exists =
note.tags
|> Enum.map(fn t -> t.name end)
|> Enum.member?(tag.name)
!exists
end)
render(conn, :apply_prepare, tag: tag, notes: notes) render(conn, :apply_prepare, tag: tag, notes: notes)
end end

View file

@ -4,7 +4,7 @@
</.header> </.header>
<section class="card-list mt-8"> <section class="card-list mt-8">
<h3 class="leading-normal text-xl">With Regex</h3> <h3 class="leading-normal text-xl dark:text-gray-100">With Regex</h3>
<%= for tag <- Enum.filter(@tags, fn t -> !!t.regex end) do %> <%= for tag <- Enum.filter(@tags, fn t -> !!t.regex end) do %>
<article class="card"> <article class="card">
@ -25,7 +25,7 @@
</section> </section>
<section class="card-list mt-8"> <section class="card-list mt-8">
<h3 class="leading-normal text-xl">Without Regex</h3> <h3 class="leading-normal text-xl dark:text-gray-100">Without Regex</h3>
<%= for tag <- Enum.filter(@tags, fn t -> !t.regex end) do %> <%= for tag <- Enum.filter(@tags, fn t -> !t.regex end) do %>
<article class="card"> <article class="card">