Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#16155 closed defect (bug) (fixed)

"Shortlink" button in admin bar relies on shortlink meta tag to work

Reported by: solarissmoke's profile solarissmoke Owned by:
Milestone: 3.1 Priority: normal
Severity: normal Version: 3.1
Component: Administration Keywords: has-patch dev-feedback
Focuses: Cc:

Description

If you remove the remove the action that adds <link rel="shortlink" ... into the head of a post, the shortlink button in the admin bar says "No shortlink available for this page" when you click it, even though the href for the link is a valid shortlink.

IMO the absence of the <link> does not mean that one doesn't exist (it could be announced in other ways, e.g., a HTTP header), and so the admin bar button needs to take this into account.

Maybe the clickShortlink Javascript function should check the href of the shortlink button in cases where there is no <link> tag?

Attachments (6)

16155.patch (1.1 KB) - added by SergeyBiryukov 14 years ago.
16155.2.patch (1.6 KB) - added by SergeyBiryukov 14 years ago.
16155.diff (6.6 KB) - added by koopersmith 14 years ago.
16155.2.diff (6.7 KB) - added by koopersmith 14 years ago.
16155.fixes.diff (1.6 KB) - added by koopersmith 14 years ago.
16155.remove.script.r17263.patch (682 bytes) - added by ocean90 14 years ago.

Download all attachments as: .zip

Change History (23)

#1 @nacin
14 years ago

  • Milestone changed from Awaiting Review to 3.1

Since it actually links to the shortlink, we should simply have it echo its own link.

#2 @SergeyBiryukov
14 years ago

  • Keywords has-patch added

#3 follow-up: @nacin
14 years ago

Look at all that red :-)

At that point, we don't even need var shortlink, right? Can just do t.href?

#4 follow-up: @nacin
14 years ago

Looks like we can also remove the noShortlink bit from script-loader, as the Shortlink menu item will only exist when there's a shortlink.

#5 in reply to: ↑ 3 @SergeyBiryukov
14 years ago

Replying to nacin:

At that point, we don't even need var shortlink, right? Can just do t.href?

I guess not, since after t = t.parentNode it's not a link anymore.

#6 @nacin
14 years ago

Ah, never mind on that point then.

#7 in reply to: ↑ 4 @SergeyBiryukov
14 years ago

Replying to nacin:

Looks like we can also remove the noShortlink bit from script-loader, as the Shortlink menu item will only exist when there's a shortlink.

Done.

#8 @solarissmoke
14 years ago

Just wondering, is there a reason why we don't give the Admin Bar li's an id (instead of class), and use that instead of class sniffing? I'm guessing there is, because otherwise it would be a lot simpler.

Also, the script currently adds an event handler to monitor ALL clicks in the admin bar area, even though the only one we do anything with is the shortlink button - wouldn't it be better to add the handler directly to the link? Again, there may be a reason it is done this way, just that I don't know it.

Last edited 14 years ago by solarissmoke (previous) (diff)

#9 @filosofo
14 years ago

Not putting id attributes on the admin menu elements avoids potential conflicts.

Also, note that the class attribute is on the li element, not the a element. The current admin bar view provides a way to put classes (and not ids) on the li elements but not the a elements.

#10 @sillybean
14 years ago

Related: #14760. (The Shortlink button appears only on posts.)

@koopersmith
14 years ago

#11 @koopersmith
14 years ago

This patch makes the shortlink menu item expand when clicked (like a sub-menu when a menu item is hovered over), and automatically highlights the shortlink.

@koopersmith
14 years ago

#12 @ryan
14 years ago

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

(In [17263]) Expand shortlink menu when clicked. Fix displayed of shortlinks when rel shortlink is missing. Props koopersmith. fixes #16155

#13 @koopersmith
14 years ago

Patch reselects shortlink when a user clicks on it, increases the shortlink container's width, and fixes a bug where hovering can be undefined.

#14 @koopersmith
14 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

#15 @nacin
14 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [17265]) Admin bar shortlink improvements. props koopersmith, fixes #16155.

#16 @ocean90
14 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

16155.remove.script.r17263.patch: In my mind it's now cruft, so we can remove it or is there something against this?

#17 @nacin
14 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [17313]) Stop localizing the admin bar. props ocean90, fixes #16155.

Note: See TracTickets for help on using tickets.