Make WordPress Core

Opened 15 years ago

Closed 11 years ago

#11446 closed defect (bug) (fixed)

Show ellipsis after truncated filename in Media dialog

Reported by: caesarsgrunt's profile caesarsgrunt Owned by: sergeybiryukov's profile 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 15 years ago.
11446.diff (820 bytes) - added by solarissmoke 14 years ago.
Add ellipsis to the end of truncated strings
11446.2.diff (6.8 KB) - added by solarissmoke 14 years ago.
11446.3.patch (6.8 KB) - added by bpetty 12 years ago.
11446.4.patch (7.0 KB) - added by bpetty 11 years ago.
11446.5.patch (9.6 KB) - added by SergeyBiryukov 11 years ago.

Download all attachments as: .zip

Change History (22)

#1 @caesarsgrunt
15 years ago

  • Milestone changed from 2.9 to Unassigned

#2 follow-up: @hakre
15 years ago

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

#3 in reply to: ↑ 2 @caesarsgrunt
15 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.

#4 @caesarsgrunt
15 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...

#5 @hakre
15 years ago

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

#6 @hakre
15 years ago

Related: #11447

#7 @hakre
15 years ago

Related: #11417

#8 @nacin
14 years ago

  • Milestone changed from Unassigned to 3.1

#9 @nacin
14 years ago

  • Milestone changed from Awaiting Triage to Future Release

No patch.

@solarissmoke
14 years ago

Add ellipsis to the end of truncated strings

#10 @solarissmoke
14 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.

#11 @garyc40
14 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.

#12 @solarissmoke
14 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 '…'.

@bpetty
12 years ago

#13 follow-up: @bpetty
12 years 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.

@bpetty
11 years ago

#15 in reply to: ↑ 13 @SergeyBiryukov
11 years 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 11 years ago by SergeyBiryukov (previous) (diff)

#16 @SergeyBiryukov
11 years 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.