5 Commits

Author SHA1 Message Date
d497eaa522 debug check_origin on render 2024-08-14 11:13:08 +02:00
eb47a26de7 removed dbg 2024-08-14 11:11:12 +02:00
256c883488 nicer pagination 2024-08-12 16:52:26 +02:00
6d64449c1b fix last page calculation 2024-08-12 16:52:01 +02:00
6751ade1d9 fix empty new_posts count 2024-08-12 16:37:50 +02:00
5 changed files with 18 additions and 9 deletions

View File

@ -48,7 +48,11 @@ if config_env() == :prod do
You can generate one by calling: mix phx.gen.secret
"""
host = System.get_env("PHX_HOST") || "example.com"
host =
System.get_env("PHX_HOST") ||
"example.com"
|> IO.inspect()
port = String.to_integer(System.get_env("PORT") || "4000")
config :something_erlang, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY")
@ -63,6 +67,7 @@ if config_env() == :prod do
ip: {0, 0, 0, 0, 0, 0, 0, 0},
port: port
],
check_origin: [host],
secret_key_base: secret_key_base
# ## SSL Support

View File

@ -38,7 +38,11 @@ defmodule SomethingErlang.AwfulApi.Bookmarks do
info = Meeseeks.one(td, css(".info"))
%{
new_posts: Meeseeks.text(last_seen) |> String.to_integer(),
new_posts:
case Meeseeks.text(last_seen) do
nil -> 0
n -> String.to_integer(n)
end,
thread_title: Meeseeks.text(Meeseeks.one(info, css(".thread_title")))
}
end

View File

@ -17,7 +17,7 @@ defmodule SomethingErlangWeb.BookmarksLive do
end
defp bookmark(assigns) do
assigns = assign(assigns, :pages, trunc(assigns.post_count / 40))
assigns = assign(assigns, :pages, ceil(assigns.post_count / 40))
~H"""
<div>
@ -37,6 +37,6 @@ defmodule SomethingErlangWeb.BookmarksLive do
{:ok,
socket
|> assign(:page_title, "Bookmarks")
|> assign(:bookmarks, Grover.get_bookmarks!(1) |> dbg())}
|> assign(:bookmarks, Grover.get_bookmarks!(1))}
end
end

View File

@ -69,10 +69,10 @@ defmodule SomethingErlangWeb.ThreadLive do
~H"""
<div class="navbar my-4 bg-base-200">
<div class="flex-1"></div>
<div class="pagination flex-none btn-group grid grid-cols-5">
<div class="pagination join">
<%= for btn <- buttons(@thread) do %>
<.link
class={["btn btn-sm btn-ghost", btn.special]}
class={["btn btn-sm btn-ghost join-item", btn.special]}
navigate={~p"/thread/#{@thread.id}?page=#{btn.page}"}
>
<.label_button label={btn.label} page={btn.page} />
@ -86,8 +86,8 @@ defmodule SomethingErlangWeb.ThreadLive do
defp label_button(%{label: label} = assigns) do
case label do
"«" -> ~H{<.icon name="hero-chevron-double-left-mini" /><%= @page %>}
"" -> ~H{<.icon name="hero-chevron-left-mini" /><%= @page %>}
"" -> ~H{<%= @page %><.icon name="hero-chevron-right-mini" />}
"" -> ~H{<.icon name="hero-chevron-left-mini" />}
"" -> ~H{<.icon name="hero-chevron-right-mini" />}
"»" -> ~H{<%= @page %><.icon name="hero-chevron-double-right-mini" />}
_ -> ~H{<%= @page %>}
end

View File

@ -14,7 +14,7 @@
"finch": {:hex, :finch, "0.18.0", "944ac7d34d0bd2ac8998f79f7a811b21d87d911e77a786bc5810adb75632ada4", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.3", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 0.2.6 or ~> 1.0", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "69f5045b042e531e53edc2574f15e25e735b522c37e2ddb766e15b979e03aa65"},
"floki": {:hex, :floki, "0.36.2", "a7da0193538c93f937714a6704369711998a51a6164a222d710ebd54020aa7a3", [:mix], [], "hexpm", "a8766c0bc92f074e5cb36c4f9961982eda84c5d2b8e979ca67f5c268ec8ed580"},
"gettext": {:hex, :gettext, "0.24.0", "6f4d90ac5f3111673cbefc4ebee96fe5f37a114861ab8c7b7d5b30a1108ce6d8", [:mix], [{:expo, "~> 0.5.1", [hex: :expo, repo: "hexpm", optional: false]}], "hexpm", "bdf75cdfcbe9e4622dd18e034b227d77dd17f0f133853a1c73b97b3d6c770e8b"},
"heroicons": {:git, "https://github.com/tailwindlabs/heroicons.git", "88ab3a0d790e6a47404cba02800a6b25d2afae50", [tag: "v2.1.1", sparse: "optimized"]},
"heroicons": {:git, "https://github.com/tailwindlabs/heroicons.git", "88ab3a0d790e6a47404cba02800a6b25d2afae50", [tag: "v2.1.1", sparse: "optimized", depth: 1]},
"hpax": {:hex, :hpax, "0.1.2", "09a75600d9d8bbd064cdd741f21fc06fc1f4cf3d0fcc335e5aa19be1a7235c84", [:mix], [], "hexpm", "2c87843d5a23f5f16748ebe77969880e29809580efdaccd615cd3bed628a8c13"},
"jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"},
"meeseeks": {:hex, :meeseeks, "0.17.0", "8a41ceccd2365476c2b779292e7649fb25f0a9735030905941f1244d2095c8a6", [:mix], [{:meeseeks_html5ever, "~> 0.14.3", [hex: :meeseeks_html5ever, repo: "hexpm", optional: false]}], "hexpm", "13efaf321a1517dea046cb48ff9baa9dc0604d9afd82c57501bc01dc45a5e309"},