[Tags] Apply a className to various elements based on the active tags
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
_From @tobscure on August 27, 2015 13:50_
We should add a className to the body and each DiscussionListItem based on what tags are in use. Could be handy for doing some special tag-based styling.
What needs to be done:
- Extend IndexPage's `config` method to add a class (`IndexPage--tag--{slug}`) to the body based on the currently-active tag. Ensure that it is removed properly onunload.
- Extend DiscussionPage's `config` method to add classes (`DiscussionPage--tag--{slug}`) to the body based on the current discussion's tags. Ensure that they are removed properly onunload.
- Extract core's DiscussionListItem classes into a method that returns an object of class names, which is then applied to the root element using the classList util.
- Extend that new classNames method and add classes (`DiscussionListItem--tag--{slug}`) based on the discussion's tags.
_Copied from original issue: flarum/tags#15_
Contributor guide
Research direction
Start by locating IndexPage's and DiscussionPage's config methods, then find DiscussionListItem's existing class handling and the classList util. Add the specified body and item tag classes, remove body classes on unload, and verify that classes reflect active or discussion tags without affecting unrelated classes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100