Add feed link to show page

This commit is contained in:
Shadowfacts 2020-06-06 15:23:03 -04:00
parent 3cd6495d3a
commit f5fb8cbdb4
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 13 additions and 1 deletions

View File

@ -2,7 +2,9 @@
<%= if @feed.favicon do %>
<img src="<%= @feed.favicon %>" alt="<%= @feed.title %> favicon" class="favicon">
<% end %>
<%= @feed.title %>
<a href="<%= feed_site_url(@feed) %>">
<%= @feed.title %>
</a>
</h1>
<%= form_tag Routes.feed_path(@conn, :refresh, @feed.id), method: :post, class: "d-inline" do %>

View File

@ -1,3 +1,13 @@
defmodule FrenzyWeb.FeedView do
use FrenzyWeb, :view
alias Frenzy.Feed
@spec feed_site_url(feed :: Feed.t()) :: String.t()
def feed_site_url(%Feed{site_url: site_url}) when is_binary(site_url) do
site_url
end
def feed_site_url(%Feed{feed_url: feed_url}) do
URI.merge(feed_url, "/") |> to_string()
end
end