This episode is part 2 in a Phoenix CMS series:
- Series Overview - Planning
- Part 1 - Setting up schemas, contexts and ecto relations
- Part 2 - Editing multiple tags at once as a list
- Part 3 - Listing mixed forms of content together for topics
- Part 4 - Setting up meta tags for SEO
- Part 5 - Making content-specific markdown extensions
- Part 6 - Using ETS to cache information and speed up the site <hr />
Last episode, we started work on a unified tagging system for multiple types of content. We came up with a data model, generated the schemas and migrations we needed and put the basic pieces in place.
In this episode, we display do the following:
- put videos in our episode pages
- set up functions to add and remove tags on our various types of content en masse
- create edit forms that use them
- update styles to display the tags in a nicer way
Once we're done, it will be possible to quickly update an article or a video with a new set of tags and the episodes portion of the CMS will have the basic functionality we need. Next episode, we'll make pages that display all the content (of various types) with that topic tag.
(Source code available for premium members)
4 Comments
This fkey constraint is on the join table, not on the topics!
Trying to delete topics from the topics index page produces an error:
I cannot find the correct way to display an appropriate message for the error. Adding something like |> foreign_key_constraint(:entities, name: :entities_topics_topic_id_fkey, message: "There still is content related to that Topic") to the Topic changeset doesn't seem to work. Is this something discussed in the followup video's?
Thank you, this worked:
No problem!