r93087 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93086‎ | r93087 | r93088 >
Date:18:56, 25 July 2011
Author:krinkle
Status:ok
Tags:
Comment:
MoodBar front-end dev, adjustments for v1.0:

* Refactor content swapping. Add support to swap to "blank user input" state, which will be used when the trigger is clicked and the overlay was hidden. Previously this state couldn't be swapped to since it requires a lot of extra bindings, now the swapper detects this state and calls prepareUserinputContent() which was merged out of core()

* Rename *-using messages to *-editing. Maybe r92906 should've introduced a new bucket rather than re-using the existing one, but now that it has changed it makes sense to adjust the bucket names. Upping version.

* Adding missing message keys for ext.moodBar.core in MoodBar.php, some bucket's messages were not loaded

* Using is(':hidden') instead of !is(':visible'). jQuery's expression filter for "visible" uses "!hidden" internally. Might as well use "hidden" directly instead of "!visible"

* Adding overlayTitle to the bucket-roulation. Previously only the trigger's link-text was changed per bucket, now the title changes as well (using the new jquery.localize "keys" feature).

* Removing "moodbar" usergroup. This data is currently unfiltered and considered to be private and sensitive. Bureaucrats should not be able to add users to this group by default. The addition to wgAvailableRights stays so wikis can add this userright to a group that they trust (eg. "staff"), but not added to any group by default.
Modified paths:
  • /trunk/extensions/MoodBar/MoodBar.i18n.php (modified) (history)
  • /trunk/extensions/MoodBar/MoodBar.php (modified) (history)
  • /trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.core.css (modified) (history)
  • /trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.core.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MoodBar/MoodBar.i18n.php
@@ -15,16 +15,17 @@
1616 $messages['en'] = array(
1717 'moodbar-desc' => 'Allows specified users to send their "mood" back to the site operator',
1818 // Portlet link
19 - 'moodbar-trigger-using' => 'Editing $1...',
2019 'moodbar-trigger-feedback' => 'Feedback about editing',
2120 'moodbar-trigger-share' => 'Share your experience',
22 - 'tooltip-p-moodbar-trigger-using' => '',
 21+ 'moodbar-trigger-editing' => 'Editing $1...',
2322 'tooltip-p-moodbar-trigger-feedback' => '',
2423 'tooltip-p-moodbar-trigger-share' => '',
 24+ 'tooltip-p-moodbar-trigger-editing' => '',
2525 // Overlay
2626 'moodbar-close' => '(close)',
27 - 'moodbar-intro-using' => 'Editing $1 made me...',
28 - 'moodbar-intro-feedback' => 'Feedback:',
 27+ 'moodbar-intro-feedback' => 'Editing $1 made me... ',
 28+ 'moodbar-intro-share' => 'My experience on $1 made me...',
 29+ 'moodbar-intro-editing' => 'Editing $1 made me...',
2930 'moodbar-type-happy-title' => 'Happy',
3031 'moodbar-type-sad-title' => 'Sad',
3132 'moodbar-type-confused-title' => 'Confused',
@@ -88,9 +89,9 @@
8990
9091 $messages['qqq'] = array(
9192 'moodbar-desc' => 'This is a feature in development. See [[mw:MoodBar 0.1/Design]] for background information.',
92 - 'moodbar-trigger-using' => "Link text of the MoodBar overlay trigger. \$1 is the SITENAME. The implied sentence is ''\"Using [Sitename] made me happy/sad/...\"''. See [[mw:MoodBar 0.1/Design]] for background development information.",
 93+ 'moodbar-trigger-editing' => "Link text of the MoodBar overlay trigger. \$1 is the SITENAME. The implied sentence is ''\"Using [Sitename] made me happy/sad/...\"''. See [[mw:MoodBar 0.1/Design]] for background development information.",
9394 'moodbar-trigger-feedback' => 'Link text of the MoodBar overlay trigger. $1 is the SITENAME.',
94 - 'moodbar-intro-using' => 'Intro title of the MoodBar overlay trigger. $1 is the SITENAME.',
 95+ 'moodbar-intro-editing' => 'Intro title of the MoodBar overlay trigger. $1 is the SITENAME.',
9596 'moodbar-intro-feedback' => 'Intro title of the MoodBar overlay trigger. $1 is the SITENAME.',
9697 'moodbar-close' => 'Link text of the close-button. Make sure to include parentheses.
9798
@@ -119,13 +120,13 @@
120121 $messages['qqq'] = array(
121122 'moodbar-desc' => '{{desc}}
122123 This is a feature in development. See [[mw:MoodBar 0.1/Design]] for background information.',
123 - 'moodbar-trigger-using' => "Link text of the MoodBar overlay trigger. \$1 is the SITENAME. The implied sentence is ''\"Using [Sitename] made me happy/sad/...\"''. See [[mw:MoodBar 0.1/Design]] for background development information.",
 124+ 'moodbar-trigger-editing' => "Link text of the MoodBar overlay trigger. \$1 is the SITENAME. The implied sentence is ''\"Using [Sitename] made me happy/sad/...\"''. See [[mw:MoodBar 0.1/Design]] for background development information.",
124125 'moodbar-trigger-feedback' => 'Link text of the MoodBar overlay trigger. $1 is the SITENAME.',
125126 'moodbar-close' => 'Link text of the close-button. Make sure to include parentheses.
126127
127128 See also:
128129 * {{msg|parentheses}}',
129 - 'moodbar-intro-using' => '[[File:MoodBar-Step-1.png|right|200px]]
 130+ 'moodbar-intro-editing' => '[[File:MoodBar-Step-1.png|right|200px]]
130131 Intro title of the MoodBar overlay trigger. $1 is the SITENAME.',
131132 'moodbar-intro-feedback' => 'Intro title of the MoodBar overlay trigger. $1 is the SITENAME.',
132133 'tooltip-moodbar-what' => 'Tooltip displayed when hovering the What-link.
@@ -150,7 +151,7 @@
151152 */
152153 $messages['be-tarask'] = array(
153154 'moodbar-desc' => 'Дазваляе вызначаным удзельнікам дасылаць іх «настрой» апэратару сайта',
154 - 'moodbar-trigger-using' => 'Выкарыстоўваючы $1…',
 155+ 'moodbar-trigger-editing' => 'Выкарыстоўваючы $1…',
155156 'moodbar-trigger-feedback' => 'Водгук',
156157 );
157158
@@ -160,11 +161,11 @@
161162 */
162163 $messages['de'] = array(
163164 'moodbar-desc' => 'Ermöglicht es Benutzern dem Betreiber des Wikis ihre Stimmung bezüglich des Bearbeitens von Seiten mitzuteilen',
164 - 'moodbar-trigger-using' => 'Bearbeite $1 …',
 165+ 'moodbar-trigger-editing' => 'Bearbeite $1 …',
165166 'moodbar-trigger-feedback' => 'Rückmeldung zum Bearbeiten',
166167 'moodbar-trigger-share' => 'Teile uns deinen Eindruck mit',
167168 'moodbar-close' => '(schließen)',
168 - 'moodbar-intro-using' => '$1 zu bearbeiten macht mich …',
 169+ 'moodbar-intro-editing' => '$1 zu bearbeiten macht mich …',
169170 'moodbar-intro-feedback' => 'Rückmeldung:',
170171 'moodbar-type-happy-title' => 'Glücklich',
171172 'moodbar-type-sad-title' => 'Traurig',
@@ -264,7 +265,7 @@
265266 */
266267 $messages['gl'] = array(
267268 'moodbar-desc' => 'Permite que os usuarios especificados envíen ao operador do sitio o seu "humor"',
268 - 'moodbar-trigger-using' => 'Usando $1...',
 269+ 'moodbar-trigger-editing' => 'Usando $1...',
269270 'moodbar-trigger-feedback' => 'Comentarios',
270271 );
271272
@@ -273,10 +274,10 @@
274275 */
275276 $messages['he'] = array(
276277 'moodbar-desc' => 'מתן אפשרות למשתמשם לשלוח את "מצב הרוח" שלהם למפעיל האתר',
277 - 'moodbar-trigger-using' => 'עריכה $1...',
 278+ 'moodbar-trigger-editing' => 'עריכה $1...',
278279 'moodbar-trigger-feedback' => 'משוב על עריכה',
279280 'moodbar-close' => '(סגירה)',
280 - 'moodbar-intro-using' => 'עריכת $1 גרמה לי ...',
 281+ 'moodbar-intro-editing' => 'עריכת $1 גרמה לי ...',
281282 'moodbar-intro-feedback' => 'משוב:',
282283 'moodbar-type-happy-title' => 'שמחה',
283284 'moodbar-type-sad-title' => 'עצב',
@@ -306,11 +307,11 @@
307308 */
308309 $messages['ia'] = array(
309310 'moodbar-desc' => 'Permitte al usatores specificate de inviar lor "humor" retro al operator del sito',
310 - 'moodbar-trigger-using' => 'Modificar $1...',
 311+ 'moodbar-trigger-editing' => 'Modificar $1...',
311312 'moodbar-trigger-feedback' => 'Commentos super le modification',
312313 'moodbar-trigger-share' => 'Divider tu experientia',
313314 'moodbar-close' => '(clauder)',
314 - 'moodbar-intro-using' => 'Le uso de $1 me rendeva...',
 315+ 'moodbar-intro-editing' => 'Le uso de $1 me rendeva...',
315316 'moodbar-intro-feedback' => 'Reaction:',
316317 'moodbar-type-happy-title' => 'Felice',
317318 'moodbar-type-sad-title' => 'Triste',
@@ -376,7 +377,7 @@
377378 */
378379 $messages['lb'] = array(
379380 'moodbar-desc' => 'Erméiglecht et spezifesche Benotzer fir dem Responsabele vum Site hir Stëmmung ze schécken',
380 - 'moodbar-trigger-using' => 'Ännert $1...',
 381+ 'moodbar-trigger-editing' => 'Ännert $1...',
381382 'moodbar-trigger-feedback' => "Feedback iwwert d'Änneren",
382383 'moodbar-close' => '(zoumaachen)',
383384 'moodbar-intro-feedback' => 'Feedback:',
@@ -412,11 +413,11 @@
413414 */
414415 $messages['mk'] = array(
415416 'moodbar-desc' => 'Им овозможува на одредени корисници да му го соопштуваат нивното „расположение“ на операторот на мрежното место',
416 - 'moodbar-trigger-using' => 'Уредување на $1...',
 417+ 'moodbar-trigger-editing' => 'Уредување на $1...',
417418 'moodbar-trigger-feedback' => 'Мислења за уредувањето',
418419 'moodbar-trigger-share' => 'Споделете го вашето искуство',
419420 'moodbar-close' => '(затвори)',
420 - 'moodbar-intro-using' => 'Уредувањето на $1 ме...',
 421+ 'moodbar-intro-editing' => 'Уредувањето на $1 ме...',
421422 'moodbar-intro-feedback' => 'Мислења',
422423 'moodbar-type-happy-title' => 'усреќи',
423424 'moodbar-type-sad-title' => 'натажи',
@@ -472,11 +473,11 @@
473474 */
474475 $messages['nl'] = array(
475476 'moodbar-desc' => 'Laat bepaalde gebruikers toe hun "gemoedstoestand" naar de sitebeheerders te verzenden',
476 - 'moodbar-trigger-using' => 'Het bewerken van $1...',
 477+ 'moodbar-trigger-editing' => 'Het bewerken van $1...',
477478 'moodbar-trigger-feedback' => 'Terugkoppeling over het bewerken',
478479 'moodbar-trigger-share' => 'Deel uw ervaring',
479480 'moodbar-close' => '(sluiten)',
480 - 'moodbar-intro-using' => 'Het gebruiken van $1 maakte mij...',
 481+ 'moodbar-intro-editing' => 'Het gebruiken van $1 maakte mij...',
481482 'moodbar-intro-feedback' => 'Terugkoppeling:',
482483 'moodbar-type-happy-title' => 'Blij',
483484 'moodbar-type-sad-title' => 'Triest',
@@ -524,11 +525,11 @@
525526 */
526527 $messages['pt'] = array(
527528 'moodbar-desc' => 'Permite que os utilizadores especificados enviem ao operador do site uma indicação do seu estado de espírito',
528 - 'moodbar-trigger-using' => 'A editar $1...',
 529+ 'moodbar-trigger-editing' => 'A editar $1...',
529530 'moodbar-trigger-feedback' => 'Comentários sobre edição',
530531 'moodbar-trigger-share' => 'Partilhe a sua experiência',
531532 'moodbar-close' => '(fechar)',
532 - 'moodbar-intro-using' => 'Usar a $1 tornou-me...',
 533+ 'moodbar-intro-editing' => 'Usar a $1 tornou-me...',
533534 'moodbar-intro-feedback' => 'Comentários:',
534535 'moodbar-type-happy-title' => 'Feliz',
535536 'moodbar-type-sad-title' => 'Triste',
Index: trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.core.css
@@ -51,18 +51,6 @@
5252 font-size: 12px;
5353 }
5454
55 -.mw-moodBar-overlayWhat > a:hover {
56 - text-decoration: none !important;
57 -}
58 -
59 -a:hover .mw-moodBar-overlayWhatLabel {
60 - text-decoration: underline;
61 -}
62 -
63 -.mw-moodBar-overlayWhatTrigger {
64 - text-decoration: none;
65 -}
66 -
6755 .mw-moodBar-form,
6856 .mw-moodBar-overlayWhatContent {
6957 display: none;
Index: trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.core.js
@@ -15,7 +15,7 @@
1616 <div class="mw-moodBar-overlayContent"></div>\
1717 </div></div>',
1818 userinput: '\
19 - <div class="mw-moodBar-overlayTitle"><html:msg key="moodbar-intro-using" /></div>\
 19+ <div class="mw-moodBar-overlayTitle"><html:msg key="INTROTITLE" /></div>\
2020 <div class="mw-moodBar-types"></div>\
2121 <div class="mw-moodBar-form">\
2222 <div class="mw-moodBar-formTitle">\
@@ -59,7 +59,8 @@
6060 event: {
6161 trigger: function( e ) {
6262 e.preventDefault();
63 - if ( !mb.ui.overlay.is( ':visible' ) ) {
 63+ if ( mb.ui.overlay.is( ':hidden' ) ) {
 64+ mb.swapContent( mb.tpl.userinput );
6465 mb.ui.overlay.show();
6566 } else {
6667 mb.ui.overlay.hide();
@@ -94,22 +95,8 @@
9596 }
9697 },
9798
98 - core: function() {
99 - var msgOptions = { params: {} };
100 - msgOptions.params['moodbar-intro-using'] = [mw.config.get( 'wgSiteName' )];
101 -
102 - // Create overlay
103 - mb.ui.overlay = $( mb.tpl.overlayBase )
104 - // Fill content with user input screen
105 - .find( '.mw-moodBar-overlayContent' )
106 - .html( mb.tpl.userinput )
107 - .end()
108 - // Handle all html:msgs
109 - .localize( msgOptions )
110 - // Bind close-toggle
111 - .find( '.mw-moodBar-overlayClose' )
112 - .click( mb.event.trigger )
113 - .end()
 99+ prepareUserinputContent: function( overlay ) {
 100+ overlay
114101 // Populate type selector
115102 .find( '.mw-moodBar-types' )
116103 .append( function() {
@@ -166,7 +153,7 @@
167154 .find( '.mw-moodBar-overlayWhatContent' )
168155 .html(
169156 function() {
170 - var message, linkMessage, link,
 157+ var message, linkMessage, link,
171158 disableMsg, disableLink, out;
172159
173160 message = mw.msg( 'moodbar-what-content' );
@@ -225,7 +212,19 @@
226213 $.moodBar.submit( mb.feedbackItem );
227214 } )
228215 .end();
 216+ },
229217
 218+ core: function() {
 219+
 220+ // Create overlay
 221+ mb.ui.overlay = $( mb.tpl.overlayBase )
 222+ .localize()
 223+ // Bind close-toggle
 224+ .find( '.mw-moodBar-overlayClose' )
 225+ .click( mb.event.trigger )
 226+ .end();
 227+ mb.swapContent( mb.tpl.userinput );
 228+
230229 mb.ui.overlay
231230 // Inject overlay
232231 .appendTo( 'body' )
@@ -237,11 +236,25 @@
238237 // Bind triger
239238 mb.ui.trigger.click( mb.event.trigger );
240239 },
 240+
241241 swapContent: function( tpl ) {
 242+ var msgOptions = {
 243+ keys: {
 244+ INTROTITLE: 'moodbar-intro-' + mb.conf.bucketKey
 245+ },
 246+ params: {
 247+ INTROTITLE: [mw.config.get( 'wgSiteName' )]
 248+ }
 249+ };
 250+
242251 mb.ui.overlay
243252 .find( '.mw-moodBar-overlayContent' )
244253 .html( tpl )
245 - .localize();
 254+ .localize( msgOptions );
 255+
 256+ if ( tpl == mb.tpl.userinput ) {
 257+ mb.prepareUserinputContent( mb.ui.overlay );
 258+ }
246259 return true;
247260 }
248261 } );
Index: trunk/extensions/MoodBar/MoodBar.php
@@ -34,7 +34,6 @@
3535
3636 // User rights
3737 $wgAvailableRights[] = 'moodbar-view';
38 -$wgGroupPermissions['moodbar']['moodbar-view'] = true;
3938
4039 // Internationalisation
4140 $wgExtensionMessagesFiles['MoodBar'] = dirname(__FILE__).'/MoodBar.i18n.php';
@@ -45,18 +44,16 @@
4645 'remoteExtPath' => 'MoodBar/modules'
4746 );
4847
49 -$oldVersion = version_compare( $wgVersion, '1.17', '<=' );
50 -
5148 $wgResourceModules['ext.moodBar.init'] = $mbResourceTemplate + array(
5249 'styles' => 'ext.moodBar/ext.moodBar.init.css',
5350 'scripts' => 'ext.moodBar/ext.moodBar.init.js',
5451 'messages' => array(
55 - 'moodbar-trigger-using',
5652 'moodbar-trigger-feedback',
5753 'moodbar-trigger-share',
 54+ 'moodbar-trigger-editing',
5855 'tooltip-p-moodbar-trigger-feedback',
59 - 'tooltip-p-moodbar-trigger-using',
6056 'tooltip-p-moodbar-trigger-share',
 57+ 'tooltip-p-moodbar-trigger-editing',
6158 ),
6259 'position' => 'top',
6360 'dependencies' => array(
@@ -65,6 +62,8 @@
6663 ),
6764 );
6865
 66+$oldVersion = version_compare( $wgVersion, '1.17', '<=' );
 67+
6968 if ( !$oldVersion ) {
7069 $wgResourceModules['ext.moodBar.init']['dependencies'][] = 'mediawiki.user';
7170 }
@@ -74,8 +73,9 @@
7574 'scripts' => 'ext.moodBar/ext.moodBar.core.js',
7675 'messages' => array(
7776 'moodbar-close',
78 - 'moodbar-intro-using',
7977 'moodbar-intro-feedback',
 78+ 'moodbar-intro-share',
 79+ 'moodbar-intro-editing',
8080 'moodbar-type-happy-title',
8181 'moodbar-type-sad-title',
8282 'moodbar-type-confused-title',
@@ -131,10 +131,10 @@
132132 'buckets' =>
133133 array(
134134 'feedback' => 80,
135 - 'using' => 10,
136135 'share' => 10,
 136+ 'editing' => 10,
137137 ),
138 - 'version' => 2,
 138+ 'version' => 3,
139139 'expires' => 30,
140140 ),
141141 'infoUrl' => 'http://www.mediawiki.org/wiki/MoodBar',

Follow-up revisions

RevisionCommit summaryAuthorDate
r93110Followup r93087 for translatewiki.netraymond20:28, 25 July 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r92906Wording updateswerdna22:30, 22 July 2011

Status & tagging log