Closed MarkEWaite closed 4 months ago
I like the idea and followed a quite similar one in #151 as well. I expose the style
and class
attributes of an enclosing <span>
for the text / icon and let the user have all the freedom they desire. For the icons itself I still hard-coded icon-sm
as class, just to not render huge images by default. This may go a little too far for this issue here.
I can see some minor differences in the screenshots you provided that I'd like to investigate a little further and see how some edge cases behave (larger text, multiple rows, etc.).
@MarkEWaite do you want to merge it?
Thanks @strangelookingnerd . I'll merge it and let you run the release.
JENKINS-73187 - Do not apply icon size to text badges
This is a prototype that I'd like to use for discussion. I think that it may go "too far" along the path to compatibility with the 1.9.1 release of the badge plugin, but I think it is worth discussion from others who are more expert in CSS and page layout.
JENKINS-73187 describes result of the mistake that I made when setting the icon class to always include "icon-sm". Short text badges do not need to be limited by that class because it causes the text field to be too small for any text to fit.
Fixes #152 as well.
Includes a test for the icon class of short text.
That change (in the first commit in the pull request) resolves the most glaring issue, but then I started comparing the new layout with the 1.9.1 layout. The second commit restores the short text layout from the 1.9.1 release and removes the CSS styling of the short text box. The Jenkins design library probably has much better ways of styling that text box, but I've not explored those techniques.
The third commit in the pull request replaces paired "if / if not" conditions with paireed "when / otherwise" conditions. I think it makes the jelly file a little easier to read.
Testing done
Compared the layout of short text badges in Jenkins 2.452.1 with plugin version 1.9.1 and with this pull request.
Results for comparison will be uploaded to the pull request as images
Testing details
Compared the results with badge plugin 1.9.1 and this pull request
Short text
With the Pipeline script:
Badge 1.9.1
Badge PR-153
Short text with yellow background
With the Pipeline script:
Badge 1.9.1
Badge PR-153