fixes #119: link associated streams to artist tags

This commit is contained in:
byte[] 2020-05-13 14:17:04 -04:00
parent 64dd6d061c
commit 033fac01e9
4 changed files with 11 additions and 1 deletions

View file

@ -2,6 +2,7 @@ defmodule Philomena.Tags.Tag do
use Ecto.Schema
import Ecto.Changeset
alias Philomena.Channels.Channel
alias Philomena.DnpEntries.DnpEntry
alias Philomena.UserLinks.UserLink
alias Philomena.Tags.Tag
@ -46,6 +47,8 @@ defmodule Philomena.Tags.Tag do
belongs_to :aliased_tag, Tag, source: :aliased_tag_id
has_many :aliases, Tag, foreign_key: :aliased_tag_id
has_many :channels, Channel, foreign_key: :associated_artist_tag_id
many_to_many :implied_tags, Tag,
join_through: "tags_implied_tags",
join_keys: [tag_id: :id, implied_tag_id: :id],

View file

@ -20,6 +20,7 @@ defmodule PhilomenaWeb.TagController do
:implied_tags,
:implied_by_tags,
:dnp_entries,
:channels,
public_links: :user,
hidden_links: :user
]

View file

@ -122,6 +122,7 @@ defmodule PhilomenaWeb.ImageLoader do
:implied_tags,
:implied_by_tags,
:dnp_entries,
:channels,
public_links: :user,
hidden_links: :user
])

View file

@ -50,7 +50,7 @@
br
= if present?(@tag.public_links) or present?(@tag.implied_by_tags) or present?(@tag.description) do
= if present?(@tag.public_links) or present?(@tag.channels) or present?(@tag.implied_by_tags) or present?(@tag.description) do
br
= link "Toggle detailed information", to: "#", data: [click_toggle: ".tag-info__more"]
@ -74,6 +74,11 @@
br
= if Enum.any?(@tag.channels) do
strong> Associated streams:
= for channel <- @tag.channels do
=> link channel.title, to: Routes.channel_path(@conn, :show, channel)
= if Enum.any?(@tag.implied_by_tags) do
input.toggle-box id="implied_by" type="checkbox"
label for="implied_by"