HomePhabricator

Vary cog click behavior
3c5515c0b797Unpublished

Unpublished Commit · Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

Vary cog click behavior

The behavior of the cog varies when:

  • The user is logged in/out.
  • Page Previews is enabled as a beta feature.

Since the behavior of the cog doesn't vary per-preview, it can be
determined at boot time and passed to the renderer. However, in order to
keep the renderer stateless, we pass the behavior to it when a preview
is added to the DOM.

Changes:

  • Add the mw.popups.createPreviewBehavior factory function, which returns an object that encapsulates how a preview responds to the user dwelling on it, abandoning it, and clicking on the cog.
  • Invoke mw.popups.createPreviewBehavior at boot time and pass it to the mw.popups.changeListeners.render change listener, which then passes it to mw.popups.Preview#show.
  • Make mw.popups.Preview#show responsible for binding event handlers and configuring the cog based on the behavior.

Bug: T146889
Change-Id: I39d7d0afd7b1fe896019a1b3a82ee907bfb20edd

Details

Provenance
phuedxAuthored on Jan 15 2017, 2:44 AM
Parents
rEPOPc13ab30bfa6b: Move conflicting NavPopups gadget name into config var
Branches
Unknown
Tags
Unknown
References
refs/changes/75/328675/5
ChangeId
I39d7d0afd7b1fe896019a1b3a82ee907bfb20edd