Skip to content

Conversation

@SegiNyn
Copy link
Contributor

@SegiNyn SegiNyn commented Jun 23, 2025

This PR adds an option in the badge designer for dealing with overflowing text: To either wrap (already the default), resize or add ellipsis to the text.

E.g Given this badge design:
Screenshot 2025-06-23 at 14 04 26

Changing the text_overflow option for the "Event Title" and "Fixed text" as example, the resulting badge should look like:

Wrap option:
Screenshot 2025-06-23 at 14 03 14

Resize option:
Screenshot 2025-06-23 at 14 04 04

@SegiNyn SegiNyn force-pushed the resize-text-in-designer branch from e732ba9 to dad10ab Compare June 23, 2025 12:32
Comment on lines 84 to 85
let fontSize = item.font_size;
fontSize = parseFloat(pattern.exec(fontSize)[1]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let fontSize = item.font_size;
fontSize = parseFloat(pattern.exec(fontSize)[1]);
let fontSize = parseFloat(pattern.exec(item.font_size)[1]);

@tomasr8
Copy link
Member

tomasr8 commented Jun 27, 2025

Is the ellipsis option going to be useful for badges? It seems no better than truncating. Maybe just wrap and resize is enough?

@SegiNyn
Copy link
Contributor Author

SegiNyn commented Jun 30, 2025

Is the ellipsis option going to be useful for badges? It seems no better than truncating. Maybe just wrap and resize is enough?

I added the ellipsis since this was a setting so we could add different options but I can remove it if no one thinks it's useful.

I didn't understand "seems no better than truncating" as there is no truncating option.

@SegiNyn SegiNyn force-pushed the resize-text-in-designer branch from 501ee52 to 27ed8d0 Compare June 30, 2025 08:29
@tomasr8
Copy link
Member

tomasr8 commented Jun 30, 2025

Ah I thought truncating was the default, disregard my comment :)

I'd only add the resize option (and keep the wrap option) unless someone needs the ellipsis as well.

@SegiNyn
Copy link
Contributor Author

SegiNyn commented Jun 30, 2025

The ellipsis option has been removed.

return color

def _get_resized_font(self, content, font_size, font_name, width):
min_font_size = 4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave it a try and 4 is pretty much unreadable. What about using 6 as the minimum?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact the minimum selectable size in the badge editor is 7. I don't have a strong opinion on whether to go for 6 or 7 as the minimum though. But maybe when going for 6, it shouldalso be the smallest selectable size?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I went with 6 as the minimum.

@SegiNyn SegiNyn force-pushed the resize-text-in-designer branch from 6184aea to ac0aa86 Compare June 30, 2025 10:02
@ThiefMaster ThiefMaster force-pushed the resize-text-in-designer branch from ac0aa86 to a349e95 Compare June 30, 2025 12:22
@ThiefMaster ThiefMaster added this to the v3.3 milestone Jun 30, 2025
@ThiefMaster ThiefMaster enabled auto-merge (squash) June 30, 2025 12:23
@ThiefMaster ThiefMaster merged commit 0d272d0 into indico:master Jun 30, 2025
11 checks passed
@ThiefMaster ThiefMaster deleted the resize-text-in-designer branch June 30, 2025 12:26
SegiNyn added a commit to UNOG-Indico/indico-core that referenced this pull request Jul 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants