Closed Bug 567925 Opened 15 years ago Closed 15 years ago

Breadcrumbs for add-ons with lengthy names look awkward

Categories

(addons.mozilla.org Graveyard :: Public Pages, defect, P4)

defect

Tracking

(Not tracked)

VERIFIED FIXED
5.12.3

People

(Reporter: krupa.mozbugs, Assigned: chenba)

References

()

Details

(Whiteboard: [z])

Attachments

(3 files, 1 obsolete file)

Attached image screenshot
steps to reproduce: Notice the breadcrumb for the add-on-https://preview.addons.mozilla.org/en-US/firefox/addon/9412/ observed behavior: Breadcrumbs for add-ons with lengthy names look awkward.See screenshot.This would look worse once we add breadcrumbs to EULA and versionHistory pages
We should truncate long add-on names with an ellipsis in breadcrumbs. A little trail of breadcrumbs within breadcrumbs, if you will. Let's say 40 characters.
Whiteboard: [z][ddn] → [z]
Target Milestone: 5.11 → 5.11.1
Priority: -- → P4
Edmund, want to check this out? Looks like jinja has a truncate function: http://jinja.pocoo.org/2/documentation/templates
Assignee: nobody → ewong
Target Milestone: 5.11.1 → 5.11.2
Status: NEW → ASSIGNED
Comment on attachment 450657 [details] [diff] [review] Shortened addon description in the addon breadcrumb up to the 40th character and then used ellipses > {% block content %} >-{{ breadcrumbs([(addon.type.get_url_path(), amo.ADDON_TYPES[addon.type_id]), (None, addon.name)]) }} >+{% set addonname = "%s" % addon.name %} jinja has the |str filter for this. >+{% set addonname = addonname | truncate(40, True, '...') %} You only need to pass in the length; the other arguments can be left with their defaults. >+{{ breadcrumbs([(addon.type.get_url_path(), amo.ADDON_TYPES[addon.type_id]), (None, addonname )]) }} It's slightly cleaner to use a {% with %} so your new variable is only in a small scope. {% with name=addon.name|str|truncate(40) %} {{ breadcrumbs(...) }} {% endwith %}
Attachment #450657 - Flags: review?(clouserw)
Attachment #450657 - Flags: review-
Attachment #450797 - Flags: review?(clouserw)
Attachment #450797 - Flags: review?(clouserw) → review+
Thanks! I made a couple slight adjustments to bring it up to to date with the code. http://github.com/jbalogh/zamboni/commit/9686298a9dd5e17a2c919e96c40be515624fadb6
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
So, it occurs to me after the fact :-/ that this will only work on single add-on pages and not any of the sub pages, etc. Instead of the single fix in the patch above, we should edit apps/amo/helpers.py:breadcrumbs() to add a default truncate=40 kwarg and have it affect all portions of the breadcrumbs.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: 5.11.2 → 5.11.3
Status: REOPENED → ASSIGNED
Target Milestone: 5.11.3 → ---
stealing from ewong!
Assignee: ewong → chenba
Severity: normal → trivial
Target Milestone: --- → 5.12.3
looks good, please land
Status: ASSIGNED → RESOLVED
Closed: 15 years ago15 years ago
Resolution: --- → FIXED
Attached image post-fix screenshot
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: