Skip to content

Commit

Permalink
Make newsletter link prominent in News feed (no notes)
Browse files Browse the repository at this point in the history
  • Loading branch information
jerodsanto committed Aug 27, 2024
1 parent 4a23236 commit 713e0d2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
6 changes: 5 additions & 1 deletion lib/changelog_web/templates/admin/episode/_form.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,12 @@
<%= text_input(f, :doc_url, placeholder: "https://hackmd.io/8675309/edit") %>
</div>

<%= if !Podcast.is_news(@podcast) do %>
<div class="field">
<%= label(f, :notes) %>
<%= textarea(f, :notes, placeholder: "The more, the better. Markdown enabled.", rows: 5) %>
</div>
<% end %>

<div class="field">
<%= label(f, :audio_file) do %>
Expand Down Expand Up @@ -552,7 +554,9 @@
</div>

<div class={"field #{AdminHelpers.error_class(f, :email_teaser)}"}>
<%= label(:f, :email_teaser) %>
<%= label(:f, :email_teaser) do %>
Email teaser <%= AdminHelpers.help_icon("Sentence case FTW") %>
<% end %>
<%= text_input(f, :email_teaser) %>
</div>

Expand Down
23 changes: 20 additions & 3 deletions lib/changelog_web/xml/podcast.ex
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,36 @@ defmodule ChangelogWeb.Xml.Podcast do
data =
[
SharedHelpers.md_to_html(episode.summary),
show_notes_newsletter_link(episode),
FeedView.discussion_link(episode),
~s(<p><a href="#{url(~p"/++")}" rel="payment">Changelog++</a> #{EpisodeView.plusplus_cta(episode)} Join today!</p>),
show_notes_sponsors(sponsors),
show_notes_featuring(participants),
"<p>Show Notes:</p>",
"<p>#{SharedHelpers.md_to_html(episode.notes)}</p>",
~s(<p>Something missing or broken? <a href="#{EpisodeView.show_notes_source_url(episode)}">PRs welcome!</a></p>)
show_notes_notes(episode)
]
|> ListKit.compact_join("")

{:cdata, data}
end

# Only News episodes have a newsletter link for now
defp show_notes_newsletter_link(%{slug: slug, podcast: %{slug: "news"}}) do
~s(<p><a href="#{url(~p"/news/#{slug}/email")}">View the newsletter</a></p>)
end

defp show_notes_newsletter_link(_other), do: nil

# However, News episodes do not have additional notes
defp show_notes_notes(%{podcast: %{slug: "news"}}), do: nil

defp show_notes_notes(episode) do
[
"<p>Show Notes:</p>",
"<p>#{SharedHelpers.md_to_html(episode.notes)}</p>",
~s(<p>Something missing or broken? <a href="#{EpisodeView.show_notes_source_url(episode)}">PRs welcome!</a></p>)
] |> Enum.join("")
end

defp show_notes_sponsors([]), do: nil

defp show_notes_sponsors(sponsors) do
Expand Down

0 comments on commit 713e0d2

Please sign in to comment.