Skip to content

task/tup-555 order news article categories#776

Merged
wesleyboar merged 7 commits intomainfrom
task/tup-555-reorder-news-categories
Jan 2, 2024
Merged

task/tup-555 order news article categories#776
wesleyboar merged 7 commits intomainfrom
task/tup-555-reorder-news-categories

Conversation

@R-Tomas-Gonzalez
Copy link
Copy Markdown
Contributor

@R-Tomas-Gonzalez R-Tomas-Gonzalez commented Dec 20, 2023

Overview

Orders the news article categories.

  • Check Notes

Related

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

Changes

  • 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
  1. press-release or feature-story
  2. multimedia or podcast
  3. any others any order

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 R-Tomas-Gonzalez added priority ▼ Low priority effort S Small effort task (~½ a week) — does not include review time labels Dec 20, 2023
@R-Tomas-Gonzalez R-Tomas-Gonzalez self-assigned this Dec 20, 2023
Copy link
Copy Markdown
Member

@wesleyboar wesleyboar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good! This is an excellent base upon which to refine this feature.

  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 (included by base.html). (I should do this to dates.)

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

    Example: An existing template tag blog_post_use_custom_media.py that works with News categories.

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

  4. 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 is an array used by share_on_social.html.

@R-Tomas-Gonzalez
Copy link
Copy Markdown
Contributor Author

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 (included by base.html). (I should do this to dates.)

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

    Example: An existing template tag blog_post_use_custom_media.py that works with News categories.

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

  4. 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 is an array used by share_on_social.html.

Copy link
Copy Markdown
Member

@wesleyboar wesleyboar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice.

Copy link
Copy Markdown
Member

@wesleyboar wesleyboar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the issue about category numbers not being in order:

  1. I don't mind. We don't use those class names.1
  2. I failed to replicate the issue. They are in order for me.

Footnotes

  1. Most of the blog/news class names came from a reference template. I might even replace them with TACC class names.

@wesleyboar wesleyboar merged commit b3c60bd into main Jan 2, 2024
@wesleyboar wesleyboar deleted the task/tup-555-reorder-news-categories branch January 2, 2024 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort S Small effort task (~½ a week) — does not include review time priority ▼ Low priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants