What type of PR is this? (check all applicable)
- [x] Refactor
- [x] Feature
- [x] Bug Fix
- [ ] Optimization
- [ ] Documentation Update
Description
At the core of this PR, is adding back in sanitation so that we allow for a consistent, safe interface for creating DisplayAd
content. It's currently awkward and fairly unsafe to use this functionality for many creators. This fixes things.
Therefore removes this code:
# Temporarily disable the sanitisation in order to launch the SheCoded Campaign.
# TODO: find an alternate solution.
I think the core purpose of this is well in the rearview for Forem and DEV needs.
This does remove the capacity for inline styles (not immediately breaking existing stuff, but will on re-save of anything), but adds the same wrapping class to the left-hand ads as the right. This should be a big win for visual consistency while still providing a lot of flexibility as far as how admins might choose to use this functionality.
This also fixes the issue of DisplayAdEvent
tracking only working for the left ad and not the right ad. This now works across the board, meaning we track impressions and clicks.
We already use a functionality called for_display
to determine which ad to display in order to reward top performing display units on average, but without consistent and complete implementation of the click tracking, it is hard for admins to understand how to use this functionality and we can't really document it properly.
I also added one new location: left_sidebar_2
which will now allow admins to set two units on the left if they choose to, and they all work with the same consistency.
This also uses FastImage
to detect image aspect ratios so they display without the page jumping when rendered without being cached. E.g. like this:
https://user-images.githubusercontent.com/3102842/134372470-ff602677-60b2-4fea-97e5-fbea214c4953.mov
All in all this should provide clarity and stability to allow admins to make more use of these features. We sure will be able to take advantage of this on DEV.
Related Tickets & Documents
QA Instructions, Screenshots, Recordings
Please replace this line with instructions on how to test your changes, a note
on the devices and browsers this has been tested on, as well as any relevant
images for UI changes.
UI accessibility concerns?
If your PR includes UI changes, please replace this line with details on how
accessibility is impacted and tested. For more info, check out the
Forem Accessibility Docs.
Added/updated tests?
- [x] Yes
- [ ] No, and this is why: please replace this line with details on why tests
have not been included
- [ ] I need help with writing tests
[Forem core team only] How will this change be communicated?
Will this PR introduce a change that impacts Forem members or creators, the
development process, or any of our internal teams? If so, please note how you
will share this change with the people who need to know about it.
This will provide an opportunity to add more clear and detailed docs of how this functionality works.
- [x] I plan to make a PR into to the admin docs myself when this is merged.