WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 12 months ago

#11446 closed defect (bug) (fixed)

Show ellipsis after truncated filename in Media dialog

Reported by: caesarsgrunt Owned by: SergeyBiryukov
Milestone: 3.6 Priority: normal
Severity: normal Version: 2.9
Component: General Keywords: has-patch dev-feedback needs-codex
Focuses: Cc:

Description

Ellipses should be shown after truncated filenames in the Media dialog (and anywhere else where they are truncated, actually).

Otherwise it is sometimes hard to identify pictures.

Attachments (6)

11446-This image has a name which is too long to show fully - well let us say it has a name that is really tooo long to show fully.png (153.9 KB) - added by hakre 4 years ago.
11446.diff (820 bytes) - added by solarissmoke 3 years ago.
Add ellipsis to the end of truncated strings
11446.2.diff (6.8 KB) - added by solarissmoke 3 years ago.
11446.3.patch (6.8 KB) - added by bpetty 16 months ago.
11446.4.patch (7.0 KB) - added by bpetty 12 months ago.
11446.5.patch (9.6 KB) - added by SergeyBiryukov 12 months ago.

Download all attachments as: .zip

Change History (22)

comment:1 caesarsgrunt4 years ago

  • Milestone changed from 2.9 to Unassigned

comment:2 follow-up: hakre4 years ago

Can you provide a screenshot of the locations you see fit?

comment:3 in reply to: ↑ 2 caesarsgrunt4 years ago

Replying to hakre:

Can you provide a screenshot of the locations you see fit?

I'm not sure what you mean by the "locations you see fit".

If you mean where should there be ellipses; then the answer is anywhere a file name is truncated (at the end of the part of the name which is shown).

So for example, if I have an image called This image has a name which is too long to show fully}}, then it would currently be shown as something like {{{This image has a name. Instead, it should be This image has a name....

Alternatively we could do it the OS X way, with the ellipsis in the middle. Then it would be something like This image has ... fully.

I'll do a patch later for the first method; it shouldn't be hard.

comment:4 caesarsgrunt4 years ago

Grrr... I hate it when Trac does that to my formatting and then won't let me fix it! Should preview, I know...

comment:5 hakre4 years ago

Was able to reproduce, you're right. I'll attach the image I was able to reproduce with.

comment:6 hakre4 years ago

Related: #11447

comment:7 hakre4 years ago

Related: #11417

comment:8 nacin4 years ago

  • Milestone changed from Unassigned to 3.1

comment:9 nacin3 years ago

  • Milestone changed from Awaiting Triage to Future Release

No patch.

solarissmoke3 years ago

Add ellipsis to the end of truncated strings

comment:10 solarissmoke3 years ago

  • Keywords has-patch dev-feedback added; needs-patch removed

Added a patch to add an ellipsis to truncated html strings. This will however increase the returned string length beyond $count specified in wp_html_excerpt(). If this is going to be an issue then I can modify the patch to account for this.

comment:11 garyc403 years ago

An additional flag in wp_html_excerpt() would be nice. Something like:

function wp_html_excerpt( $str, $count, $ellipsis = false )

Otherwise this can break themes. $ellipsis can be true when you use it in the Media dialog, or other WP core places. But it should default to false.

comment:12 solarissmoke3 years ago

Replying to garyc40:

An additional flag in wp_html_excerpt() would be nice. Something like:

Added this in attachment:11446.2.diff. Actually there are lots of places in core where we were adding the ellipsis manually (see patch), so adding this argument makes sense.

Changes will probably need testing to make sure nothing awkward happens - in some cases I have replaced '...' with '…'.

solarissmoke3 years ago

bpetty16 months ago

comment:13 follow-up: bpetty16 months ago

  • Cc bpetty added
  • Component changed from Media to General
  • Keywords needs-codex added
  • Milestone changed from Future Release to 3.6

I've refreshed 11446.2.diff as 11446.3.patch with a minor change of using a named option array with wp_html_excerpt() for specifying extra optional settings. See coding standards for reason behind named option.

This will still need Codex updates (and I can do this) if applied.

bpetty12 months ago

comment:15 in reply to: ↑ 13 SergeyBiryukov12 months ago

Replying to bpetty:

I've refreshed 11446.2.diff as 11446.3.patch with a minor change of using a named option array with wp_html_excerpt() for specifying extra optional settings. See coding standards for reason behind named option.

A cleaner approach might be to make it a $more string, for consistency with wp_trim_words():
http://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/formatting.php#L2159

This would be more flexible and also would allow us to avoid a named entity in XML context (an issue raised in ticket:8714:27).

See 11446.5.patch.

Last edited 12 months ago by SergeyBiryukov (previous) (diff)

SergeyBiryukov12 months ago

comment:16 SergeyBiryukov12 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 24214:

  • Pass ellipsis as a parameter to wp_html_excerpt() instead of appending it manually.
  • Consolidate the logic to avoid appending ellipsis if the entire string is shown.
  • Show ellipsis after truncated filenames and post titles.

props solarissmoke, bpetty, SergeyBiryukov. fixes #11446.

Note: See TracTickets for help on using tickets.