~afontaine/home

ref: f3beb1218e86a2a61489737177c64308174b0201 home/apps/home_web/lib/home_web/views/post_view.ex -rw-r--r-- 560 bytes
f3beb121Andrew Fontaine Fix typo for Discussion Email 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
defmodule HomeWeb.PostView do
  use HomeWeb, :view

  alias Blog.Content.Post

  def markdown(body) do
    body
    |> Earmark.as_html!(code_class_prefix: "language-")
    |> raw()
  end

  def reply_link(%Post{message_id: id, subject: subject}) do
    address = "~afontaine/blog-discuss@lists.sr.ht"

    link(address, to: "mailto:#{address}?in-reply-to=#{id}&subject=Re: #{subject}")
  end

  def title("show.html", %{post: post}) do
    "#{post.subject} · #{post.author}"
  end

  def title("index.html", _) do
    "Andrew Fontaine · All posts"
  end
end