Creates three different lists to check... 'press-release, feature-story', 'multimedia, podcast', and 'press-release, feature-story, multimedia, podcast'
Logic: The if statement checks the slug against the strings in the first two, and checks if it is not in the last
-- The logic above will order the lists as such
press-release or feature-story
multimedia or podcast
any others any order
Testing
Create categories in Core-CMS image
Add said categories (with some random ones) to a news story
Test the order
UI
Notes
~~I came away with an issue. @wesleyboar Please let me know if this is an issue or if we can troubleshoot this together.
Issue: Although the categories are in the order we'd like them to be, they class numbers are not correlated with their order on the page. Unsure of a solution at the moment. But working to fix.~~
Move this new logic to its own template, then include that template.
This will isolate complex logic specific to one small aspect of the template.
Examples: I did this with [`includes/blog_cats.html`](https://github.com/TACC/Core-CMS/blob/v4.3.0/taccsite_cms/templates/djangocms_blog/includes/blog_cats.html) (included by [`base.html`](https://github.com/TACC/Core-CMS/blob/v4.3.0/taccsite_cms/templates/djangocms_blog/base.html#L29)). (I should do this to [dates](https://github.com/TACC/Core-CMS/blob/v4.3.0/taccsite_cms/templates/djangocms_blog/includes/blog_meta.html#L17-L42).)
Suggestion: Move this logic into Python (so it easier to grok and improve).
You can move logic to Python via a [template tag or filter (Django docs)](https://docs.djangoproject.com/en/4.2/howto/custom-template-tags/).
Example: An existing template tag [`blog_post_use_custom_media.py`](https://github.com/TACC/Core-CMS/blob/v4.3.0/taccsite_cms/templatetags/blog_post_use_custom_media.py) that works with News categories.
Consider how to reduce duplicate logic. (Probably easier w/ Python code.)
I see 3 for loops, and 3 <li>'s. Hopefully, this can be done with less of each.
Bonus: Consider whether and how to integrate with Core-CMS settings.
Other CMS's would have different categories, and maybe a different order.
Example: [Setting `TACC_SOCIAL_SHARE_PLATFORMS`](https://github.com/TACC/Core-CMS/blob/v4.3.0/taccsite_cms/settings.py#L293) is an array used by [`share_on_social.html`](https://github.com/TACC/Core-CMS/blob/v4.3.0/taccsite_cms/templates/share_on_social.html).
Overview
Orders the news article categories.
Related
https://tacc-main.atlassian.net/browse/TUP-555
Changes
'press-release, feature-story'
,'multimedia, podcast'
, and'press-release, feature-story, multimedia, podcast'
if
statement checks the slug against the strings in the first two, and checks if it is not in the last -- The logic above will order the lists as suchTesting
UI
Notes
~~I came away with an issue. @wesleyboar Please let me know if this is an issue or if we can troubleshoot this together. Issue: Although the categories are in the order we'd like them to be, they class numbers are not correlated with their order on the page. Unsure of a solution at the moment. But working to fix.~~
Edit: This is no longer issue as of 05d4e7f![Screenshot 2023-12-19 at 7 03 41 PM](https://github.com/TACC/Core-CMS/assets/63771558/604a71cb-5084-40b1-8d48-0ca84fcc4e26)