Commit 1158bd9
widgets: Fix some issues (#1900)
* widgets: correct OH_Partner_frame.png dimensions, metadata, and test fixtures
OH_Partner_frame.png had a 1px transparent row at y=0, so all visible
content started at y=1. This caused the rendered Detailed widget to
appear shifted down with an empty row at the top and the bottom pixel
clipped off.
The Detailed widget model also reported width: 230 but the frame image
is 232px wide, causing the HTML embed <img width="230"> to clip 2px off
the right edge.
Test fixtures regenerated to match the corrected frame.
* widgets: correct Tiny widget height to match profile_tiny.png (15 → 16)
profile_tiny.png is 80×16 but the Tiny widget model reported height: 15,
causing the HTML embed <img height="15"> to scale the image down by 1px
vertically.
* widgets: add PNG output format support
Widget image generation produces PNG internally — the pipeline opens
OH_Partner_frame.png, composites text and kudos onto it, and returns the
result via MiniMagick's to_blob, which emits PNG bytes. Previously those
bytes were served as image/gif regardless of what was requested, which
is a lie about the Content-Type.
Add proper ?format=png support by renaming render_image_for_gif_format
to render_image_for_image_format (and the "not supported" equivalent)
across all five widget controllers. PNG requests now receive
Content-Type: image/png with the same underlying bytes — no conversion
needed since the data is already PNG. GIF requests preserve existing
behavior for backward compatibility.
* widgets: flatten transparent background to white
OH_Partner_frame.png has an alpha channel — the right-side content area
where name, commits, and kudos are composited was transparent rather
than opaque white. The kudos laurel badge composited on top has a white
background, making the two visually inconsistent: the laurel shows white
while surrounding areas are transparent, appearing as a checkerboard in
image viewers or taking on the page background color in browsers.
Add image.flatten to setup_blank in badge_helper.rb. flatten fills
transparent pixels with the current background color, which is already
set to white on the line above, producing a fully opaque image before
any compositing begins. setup_blank is shared by all three badge types
(Account, Partner, Thin), so all affected test fixtures are regenerated.
* positions: use must_include instead of must_match for org name
Faker-generated org names with special characters (e.g. apostrophes)
create broken regexes when passed as strings to must_match. Use
must_include instead, which does plain substring matching.1 parent 7411042 commit 1158bd9
22 files changed
Lines changed: 33 additions & 21 deletions
File tree
- app
- assets/images/widget_logos
- controllers
- models/widget/account_widget
- lib/widget_badge
- test
- controllers
- data/widget_badge
- account
- partner
- thin
- helpers
- lib/widget_badge
- models/widget/account_widget
Loading
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
| 6 | + | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
| 30 | + | |
| 31 | + | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
33 | 37 | | |
34 | | - | |
35 | | - | |
| 38 | + | |
36 | 39 | | |
37 | 40 | | |
38 | | - | |
39 | | - | |
| 41 | + | |
| 42 | + | |
40 | 43 | | |
41 | 44 | | |
42 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
43 | 54 | | |
44 | 55 | | |
45 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
335 | | - | |
| 335 | + | |
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
| |||
0 commit comments