r111402 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111401‎ | r111402 | r111403 >
Date:19:34, 13 February 2012
Author:werdna
Status:ok
Tags:
Comment:
ACW UI tweaks.
* Switch from fade-everything-else to highlight-on-hover.
* Fade everything else when an interstitial is being shown.
* Fix bug where interstitial would be hidden if you clicked on a checkbox.
* Hide interstitial when a user presses ESC.
Modified paths:
  • /trunk/extensions/ArticleCreationWorkflow/includes/ArticleCreationTemplates.php (modified) (history)
  • /trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.core/ext.articleCreation.core.css (modified) (history)
  • /trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.user/ext.articleCreation.user.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleCreationWorkflow/includes/ArticleCreationTemplates.php
@@ -129,7 +129,9 @@
130130
131131 return <<<HTML
132132 <div class="ac-button-wrap">
133 - <a class="ac-article-button ac-button ac-button-$color ac-article-$button" data-ac-button="$button" href="$target">
 133+ <a class="ac-article-button ac-button ac-button-$color
 134+ ac-article-$button" data-ac-button="$button"
 135+ data-ac-color="$color" href="$target">
134136 <div class="ac-arrow ac-arrow-forward">&nbsp;</div>
135137 <div class="ac-button-text">
136138 <div class="ac-button-title">$buttonTitle</div>
Index: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.user/ext.articleCreation.user.js
@@ -12,21 +12,23 @@
1313 ac.setupTooltips();
1414
1515 $(document).click( function(e) {
16 - $('.ac-article-button')
17 - //remove green states and hide their tooltips
18 - .removeClass('ac-button-green')
19 - .removeClass('ac-button-selected')
20 - .each ( function (i, e) {
21 - $(this) .parent()
22 - .find('.mw-ac-tooltip')
23 - .hide();
24 - });
 16+ if ( $(e.target).is('.mw-ac-interstitial *' ) ) {
 17+ return;
 18+ }
 19+
 20+ ac.hideInterstitial( $('.ac-article-button') );
2521
2622 ac.panel
2723 .find('.mw-ac-interstitial')
2824 .hide();
2925 } );
3026
 27+ $(document).keydown( function(e) {
 28+ if ( e.keyCode == 27 ) {// ESC
 29+ ac.hideInterstitial( $('.ac-article-button') );
 30+ }
 31+ });
 32+
3133 //setup button hover states
3234 ac.panel
3335 .find( '.ac-article-button' )
@@ -68,20 +70,21 @@
6971 e.preventDefault();
7072 e.stopPropagation();
7173
72 - $('.ac-article-button')
73 - //remove green states and hide their tooltips
74 - .removeClass('ac-button-green')
75 - .removeClass('ac-button-selected')
76 - .each ( function (i, e) {
77 - $(this) .parent()
78 - .find('.mw-ac-tooltip')
79 - .hide();
80 - });
81 -
 74+ var alreadySelected = $(this)
 75+ .hasClass('ac-button-selected');
 76+
 77+ ac.hideInterstitial($('.ac-article-button'));
 78+ $('.ac-article-button').not($(this))
 79+ .addClass('ac-faded');
 80+
8281 ac.panel
8382 .find('.mw-ac-interstitial')
8483 .hide();
8584
 85+ if ( alreadySelected ) {
 86+ return;
 87+ }
 88+
8689 if ( ! $(this).parent().find('.mw-ac-interstitial').length ||
8790 ac.isInterstitialDisabled($(this).data('ac-button'))
8891 ) {
@@ -93,6 +96,7 @@
9497
9598 $( this )
9699 //make it green
 100+ .removeClass('ac-button-blue')
97101 .addClass('ac-button-green')
98102 .addClass('ac-button-selected')
99103 .parent()
@@ -110,10 +114,11 @@
111115 .hover (function (){
112116 $( '.ac-article-button' )
113117 .not( this )
114 - .addClass( 'ac-faded' );
 118+ .removeClass( 'ac-button-hover' );
 119+ $(this).addClass('ac-button-hover');
115120 }, function(){
116121 $( '.ac-article-button' )
117 - .removeClass( 'ac-faded' );
 122+ .removeClass( 'ac-button-hover' );
118123 });
119124
120125 },
@@ -188,12 +193,31 @@
189194 title = article;
190195 }
191196
 197+ // Normalise title
 198+ title = title.charAt(0).toUpperCase() + title.substr(1);
 199+ title = title.replace(' ', '_' );
 200+
192201 jQuery.trackActionWithOptions( {
193202 id : ac.config['tracking-code-prefix'] + action,
194203 namespace : namespaceNumber,
195204 info : title
196205 } );
197206 }
 207+ },
 208+
 209+ hideInterstitial : function($elements) {
 210+ //remove green states and hide their tooltips
 211+ $elements
 212+ .removeClass('ac-button-green')
 213+ .removeClass('ac-button-selected')
 214+ .each ( function (i, e) {
 215+ var color = $(this).data('ac-color');
 216+ $(this) .addClass( 'ac-button-'+color )
 217+ .parent()
 218+ .find('.mw-ac-tooltip,.mw-ac-interstitial')
 219+ .hide();
 220+ });
 221+ $('.ac-article-button').removeClass('ac-faded');
198222 }
199223
200224 });
Index: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.core/ext.articleCreation.core.css
@@ -61,6 +61,22 @@
6262 );
6363 }
6464
 65+.ac-button-blue.ac-button-hover {
 66+ background-image: linear-gradient(bottom, #43649c 10%, #6699ee 90%);
 67+ background-image: -o-linear-gradient(bottom, #43649c 10%, #6699ee 90%);
 68+ background-image: -moz-linear-gradient(bottom, #43649c 10%, #6699ee 90%);
 69+ background-image: -webkit-linear-gradient(bottom, #43649c 10%, #6699ee 90%);
 70+ background-image: -ms-linear-gradient(bottom, #43649c 10%, #6699ee 90%);
 71+
 72+ background-image: -webkit-gradient(
 73+ linear,
 74+ left bottom,
 75+ left top,
 76+ color-stop(0.1, #43649c),
 77+ color-stop(0.9, #6699ee)
 78+ );
 79+}
 80+
6581 .ac-button-red {
6682 background-image: linear-gradient(bottom, #850000 10%, #CC0000 90%);
6783 background-image: -o-linear-gradient(bottom, #850000 10%, #CC0000 90%);

Status & tagging log