TACC / Core-CMS

The Core CMS codebase used by TACC Portals.
https://cep.tacc.utexas.edu
2 stars 1 forks source link

task/tup-555 order news article categories #776

Closed R-Tomas-Gonzalez closed 7 months ago

R-Tomas-Gonzalez commented 8 months ago

Overview

Orders the news article categories.

Related

https://tacc-main.atlassian.net/browse/TUP-555

Changes

Testing

  1. Create categories in Core-CMS image
  2. Add said categories (with some random ones) to a news story
  3. Test the order

UI

Screenshot 2023-12-19 at 7 01 07 PM

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

R-Tomas-Gonzalez commented 8 months ago

7c52f1c Accomplishes the following:

  1. 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).)
  2. 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.
    1. 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.

  3. 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).