r98735 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98734‎ | r98735 | r98736 >
Date:02:41, 3 October 2011
Author:krinkle
Status:resolved (Comments)
Tags:
Comment:
[RL2] Entire gadget row is now clickable
Modified paths:
  • /branches/RL2/extensions/Gadgets/modules/ext.gadgets.gadgetmanager.css (modified) (history)
  • /branches/RL2/extensions/Gadgets/modules/ext.gadgets.gadgetmanager.js (modified) (history)

Diff [purge]

Index: branches/RL2/extensions/Gadgets/modules/ext.gadgets.gadgetmanager.css
@@ -23,6 +23,13 @@
2424 }
2525
2626 /**
 27+ * Gadget list
 28+ */
 29+.client-js .mw-gadgets-gadget:hover {
 30+ cursor: pointer;
 31+}
 32+
 33+/**
2734 * The PropCloud
2835 */
2936 .mw-gadgetmanager-propcloud {
Index: branches/RL2/extensions/Gadgets/modules/ext.gadgets.gadgetmanager.js
@@ -142,6 +142,26 @@
143143 }
144144 } );
145145
 146+ // Entire gadget list item is clickable
 147+ $( '.mw-gadgets-gadget' ).click( function( e ) {
 148+ e.preventDefault();
 149+ var t,
 150+ id = $( this ).data( 'gadget-id' );
 151+
 152+ if ( ga.conf.userIsAllowed['gadgets-definition-edit'] ) {
 153+ ga.ui.startGadgetEditor( id );
 154+ return;
 155+ }
 156+ // Use localized page name if possible to avoid redirect
 157+ if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Gadgets' ) {
 158+ t = new mw.Title( mw.config.get( 'wgTitle' ) + '/' + id, -1 );
 159+ } else {
 160+ t = new mw.Title( 'Gadgets/' + id, -1 );
 161+ }
 162+ window.location.href = t.getUrl();
 163+ return false;
 164+ } );
 165+
146166 if ( ga.conf.userIsAllowed['gadgets-definition-create'] ) {
147167 var createTab = mw.util.addPortletLink(
148168 // Not all skins use the new separated tabs yet,

Follow-up revisions

RevisionCommit summaryAuthorDate
r98942[RL2] Stop propagation of clicks on other anchor tags inside the gadget row....krinkle22:32, 4 October 2011
r98945[RL2] Use variable name instead of literal -1 for clarity...krinkle22:38, 4 October 2011

Comments

#Comment by Catrope (talk | contribs)   17:51, 4 October 2011

This breaks the permalink and export link when JS is enabled.

#Comment by Brion VIBBER (talk | contribs)   17:53, 4 October 2011

Is that literal -1 supposed to indicate 'special namespace'? If so, it really should be using a nice named constant...

#Comment by Krinkle (talk | contribs)   17:57, 4 October 2011

I'm aware of the on-click issue. Discovered it shortly after committing but already had everything closed up for the day. I have a fix ready on my local copy that addresses some other related issues as well.


the -1 should be namespaceids.special, thanks.

#Comment by Krinkle (talk | contribs)   22:39, 4 October 2011

Fixed in r98942 / r98945.

Status & tagging log