Commit 992f1d4
authored
fix: article image alignment and sizing (#1050)
## Overview
> [!IMPORTANT]
> **To Do**
> - [x] Extract ee9838c and b7d7df7 to separate PR.
> - [ ] Update image thumbnail opts of all sites that have News.
> - [ ] Prepare to [offset small main
image](https://github.com/user-attachments/assets/a97471ce-209a-4691-bdcc-5da827207c49)
instead of [just
align](https://github.com/user-attachments/assets/51ef1107-1bb5-40a7-8e07-79b5947a3380).
Fix alignment and size of:
1. main image (on news article page):
- narrow image, narrow screen
- full-width image[^1], narrow screen
- narrow image, wide screen
- full-width image[^1], wide screen
2. thumbnail image (on news feed page and embed):
- narrow image, narrow screen
- full-width image[^1], narrow screen
- narrow image, wide screen
- full-width image[^1], wide screen
[^1]: I.e. use a Thumbnail Option with `width` of `0`.
## Related
- [RT
#37827](https://tickets.tacc.utexas.edu/Ticket/Display.html?id=37827)
## Changes
- **renamed** mixins to express what its styles do
- `news-article-page__media--slim-context` → `…--layout-center`
- `news-article-page__media--wide-context` → `…--layout-float`
- **changed** mixin `…--layout-center` to be used **only** if main image
thumb. opt. has `0` width
- **fixed** unaligned blog content images
- **deleted** unnecessary code
- **fixed** large article list image from overflowing list
- **fixed** small article list image from not filling item
- **changed** overwritten code to be reminder comment instead
- **moved** mixins `news-article-page__media--…`
- from `x-news.css`
- to `django.cms.blog.app.page.css`
- **changed** markup of form to choose news list layout
- **added** thumb. opt. values into HTML (for CSS)
- `data-width`
- `data-height`
## Testing
Given an article main image of thumbnail size with **width = 0**:
- On news **article page**, that image should be:
- as wide as content
- On news **feed page** (and **feed embed**):
- In **list view**:
- On a wide screen (1 wide column),
that image should be **no wider than 50%**.
- On a narrow screen (1 narrow column),
that image should **shrink** to fit item.
- In **grid layout**[^2]:
- On a wide screen (N narrow columns),
that image should **shrink** to fit item.
- On a narrow screen (1 narrow column),
that image should **shrink** to fit item.
Given an article main image of thumbnail size with **width > 0**:
- On news **article page**, that image should be:
- no wider than 50% of content
- right-aligned
- On news **feed page** (and **feed fembed**):
- In list view:
- On a wide screen (1 wide column),
that image width should **define media grid cell width**.
- On a narrow screen (1 narrow column),
that image should **grow** to fit item.
- In grid view:
- On a wide screen (N narrow columns),
that image should **grow** to fit item.
- On a narrow screen (1 narrow column),
that image should **grow** to fit item.
[^2]: This is a secret layout. Unhide the `#layout-choice-form` element
to reveal the layout options.
## UI
Skipped.1 parent 5590821 commit 992f1d4
File tree
3 files changed
+40
-15
lines changed- taccsite_cms
- static/site_cms/css/src/_imports
- components
- tools
- templates/djangocms_blog
3 files changed
+40
-15
lines changedLines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
84 | 98 | | |
85 | 99 | | |
86 | 100 | | |
| |||
175 | 189 | | |
176 | 190 | | |
177 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
178 | 201 | | |
179 | 202 | | |
180 | 203 | | |
| |||
Lines changed: 16 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
108 | 111 | | |
109 | 112 | | |
110 | 113 | | |
| |||
146 | 149 | | |
147 | 150 | | |
148 | 151 | | |
149 | | - | |
150 | | - | |
151 | 152 | | |
152 | 153 | | |
153 | 154 | | |
| |||
158 | 159 | | |
159 | 160 | | |
160 | 161 | | |
161 | | - | |
| 162 | + | |
162 | 163 | | |
163 | 164 | | |
164 | 165 | | |
| |||
248 | 249 | | |
249 | 250 | | |
250 | 251 | | |
251 | | - | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
252 | 255 | | |
253 | 256 | | |
254 | 257 | | |
| |||
366 | 369 | | |
367 | 370 | | |
368 | 371 | | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | 372 | | |
377 | 373 | | |
378 | 374 | | |
379 | 375 | | |
380 | 376 | | |
381 | | - | |
| 377 | + | |
382 | 378 | | |
383 | 379 | | |
384 | 380 | | |
385 | | - | |
| 381 | + | |
386 | 382 | | |
387 | 383 | | |
388 | 384 | | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
389 | 391 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
0 commit comments