r90902 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90901‎ | r90902 | r90903 >
Date:20:03, 27 June 2011
Author:reedy
Status:resolved (Comments)
Tags:
Comment:
* (bug 28259) Localise CR Tooltips
Modified paths:
  • /trunk/extensions/CodeReview/CodeReview.i18n.php (modified) (history)
  • /trunk/extensions/CodeReview/CodeReview.php (modified) (history)
  • /trunk/extensions/CodeReview/backend/CodeRevision.php (modified) (history)
  • /trunk/extensions/CodeReview/modules/ext.codereview.tooltips.js (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/CodeReview.php
@@ -168,7 +168,8 @@
169169 // Revision tooltips CodeRevisionView:
170170 $wgResourceModules['ext.codereview.tooltips'] = array(
171171 'scripts' => 'ext.codereview.tooltips.js',
172 - 'dependencies' => 'jquery.tipsy'
 172+ 'dependencies' => 'jquery.tipsy',
 173+ 'messages' => array_merge( CodeRevision::getPossibleStateMessageKeys(), array( 'code-tooltip-withsummary', 'code-tooltip-withoutsummary' ) ),
173174 ) + $commonModuleInfo;
174175
175176 // Revision 'scapmap':
@@ -203,7 +204,7 @@
204205
205206 /**
206207 * The maximum number of paths that we will perform a diff on.
207 - * If a revision contains more changed paths than this, we will skip getting the
 208+ * If a revision contains more changed paths than this, we will skip getting the
208209 * diff altogether.
209210 * May be set to 0 to indicate no limit.
210211 */
Index: trunk/extensions/CodeReview/backend/CodeRevision.php
@@ -240,6 +240,20 @@
241241 }
242242
243243 /**
 244+ * @return array
 245+ */
 246+ public static function getPossibleStateMessageKeys() {
 247+ return array_map( array( 'self', 'makeStateMessageKey'), self::getPossibleStates() );
 248+ }
 249+
 250+ /**
 251+ * @param $key string
 252+ * @return string
 253+ */
 254+ private static function makeStateMessageKey( $key ) {
 255+ return "code-status-$key";
 256+ }
 257+ /**
244258 * List of all flags a user can mark themself as having done to a revision
245259 * @return Array
246260 */
@@ -446,7 +460,7 @@
447461 // No sense in notifying the author of this rev if they are a commenter/the author on the target rev
448462 if ( $commitAuthorId == $user->getId() ) {
449463 continue;
450 - }
 464+ }
451465
452466 if ( $user->canReceiveEmail() ) {
453467 // Send message in receiver's language
Index: trunk/extensions/CodeReview/CodeReview.i18n.php
@@ -206,6 +206,9 @@
207207 'code-stats-new-breakdown' => 'Breakdown of new revisions per author',
208208 'code-stats-count' => 'Number of revisions',
209209
 210+ 'code-tooltip-withsummary' => 'r$1 [$2] by $3 - $4',
 211+ 'code-tooltip-withoutsummary' => 'r$1 [$2] by $3',
 212+
210213 'repoadmin' => 'Repository Administration',
211214 'repoadmin-new-legend' => 'Create a new repository',
212215 'repoadmin-new-label' => 'Repository name:',
@@ -301,7 +304,7 @@
302305 * {{msg-mw|code-signoff-flag-inspected}}
303306 * {{msg-mw|code-signoff-flag-tested}}',
304307 'code-signoff-field-date' => 'Table column header: timestamp of the sign-off. {{Identical|Date}}',
305 - 'code-signoff-struckdate' => 'This is displayed in the date column for a struck sign-off. $1 is the timestamp of the sign-off, $2 is the timestamp of when it was struck.
 308+ 'code-signoff-struckdate' => 'This is displayed in the date column for a struck sign-off. $1 is the timestamp of the sign-off, $2 is the timestamp of when it was struck.
306309 Struck is the past tense of verb strike (as in delete).',
307310 'code-pathsearch-path' => '{{Identical|Path}}',
308311 'code-revfilter-cr_status' => '{{Identical|Status}}',
@@ -1004,7 +1007,7 @@
10051008 'codereview-email-body' => '"$1" ҡулланыусыһы $3 өсөн аңлатма өҫтәне.
10061009
10071010 Тулы URL: $2
1008 -Ҡыҫҡаса тасуирлама:
 1011+Ҡыҫҡаса тасуирлама:
10091012
10101013 $5
10111014
@@ -1015,7 +1018,7 @@
10161019 'codereview-email-body2' => '"$1" ҡатнашыусыһы $2 өлгөһөнә артабанғы үҙгәрештәр кереткән.
10171020
10181021 Алдағы өлгөнөң тулы URL адресы: $5
1019 -Ҡыҫҡаса тасуирлама:
 1022+Ҡыҫҡаса тасуирлама:
10201023
10211024 $6
10221025
@@ -1814,7 +1817,7 @@
18151818 Postet ez eus bet un evezhiadenn war $2 gant an implijer "$1" ivez.
18161819
18171820 URL klok : $5
1818 -Diverrañ eus ar c\'hemmoù :
 1821+Diverrañ eus ar c\'hemmoù :
18191822
18201823 $7
18211824
@@ -2861,7 +2864,7 @@
28622865 'codereview-subtitle' => 'Qe $1',
28632866 'codereview-reply-link' => 'cewab bide',
28642867 'codereview-email-subj' => '[$1 $2]: Xulasayê newî de biyo',
2865 - 'codereview-email-body' => 'Karberê "$1"î yew xulasa se $3 rê nuşt.
 2868+ 'codereview-email-body' => 'Karberê "$1"î yew xulasa se $3 rê nuşt.
28662869
28672870 Full URL: $2
28682871
@@ -2869,7 +2872,7 @@
28702873
28712874 $4',
28722875 'codereview-email-subj2' => '[$1 $2]: Vurnayîşan kontrol bike',
2873 - 'codereview-email-body2' => 'Karberê "$1"î, $2 vurna.
 2876+ 'codereview-email-body2' => 'Karberê "$1"î, $2 vurna.
28742877
28752878 Full URL: $3
28762879
@@ -2877,7 +2880,7 @@
28782881
28792882 $4',
28802883 'codereview-email-subj3' => '[$1 $2]: Regression otomatik test keno',
2881 - 'codereview-email-body3' => 'Qe vurnayîşê $1î otomatik test yew regression mucna.
 2884+ 'codereview-email-body3' => 'Qe vurnayîşê $1î otomatik test yew regression mucna.
28822885
28832886 Full URL: $2
28842887
@@ -3215,7 +3218,7 @@
32163219 $6
32173220
32183221 Πλήρες URL: $3
3219 -Σύνοψη της καταχώρησης:
 3222+Σύνοψη της καταχώρησης:
32203223
32213224 $4',
32223225 'codereview-email-subj3' => '[$1 $2]: Η κατάσταση της αλλαγής άλλαξε',
@@ -3237,7 +3240,7 @@
32383241 Ο χρήστης "$1" επίσης απέστειλε σχόλιο για το $2.
32393242
32403243 Πλήρες URL: $5
3241 -Σύνοψη της καταχώρησης:
 3244+Σύνοψη της καταχώρησης:
32423245
32433246 $7
32443247
@@ -4451,7 +4454,7 @@
44524455
44534456 $4',
44544457 'codereview-email-subj3' => '[$1 $2] : l’état de la version a changé',
4455 - 'codereview-email-body3' => 'L’utilisateur « $1 » a modifié l’état de $2.
 4458+ 'codereview-email-body3' => 'L’utilisateur « $1 » a modifié l’état de $2.
44564459
44574460 Ancien état : $3
44584461 Nouvel état : $4
@@ -8440,7 +8443,7 @@
84418444
84428445 $7
84438446
8444 -അഭിപ്രായം:
 8447+അഭിപ്രായം:
84458448
84468449 $6',
84478450 'code-stats' => 'സ്ഥിതിവിവരക്കണക്കുകൾ',
@@ -13013,7 +13016,7 @@
1301413017
1301513018 $4',
1301613019 'codereview-email-subj3' => '[$1 $2]: Awtomatik synag regressiýany ýüze çykardy',
13017 - 'codereview-email-body3' => '$1 üçin üýtgeşmeler zerarly awtomatik synag bir regressiýany ýüze çykardy.
 13020+ 'codereview-email-body3' => '$1 üçin üýtgeşmeler zerarly awtomatik synag bir regressiýany ýüze çykardy.
1301813021
1301913022 Doly URL: $2
1302013023
@@ -13216,7 +13219,7 @@
1321713220 Nagpaskil din ang tagagamit na si "$1" ng isang puna sa $2.
1321813221
1321913222 Buong URL: $5
13220 -Buod ng pagsasagawa:
 13223+Buod ng pagsasagawa:
1322113224
1322213225 $7
1322313226
Index: trunk/extensions/CodeReview/modules/ext.codereview.tooltips.js
@@ -12,7 +12,7 @@
1313 if ( !matches ) {
1414 return;
1515 }
16 -
 16+
1717 function showTooltip() {
1818 var $el = $( this );
1919 if ( $el.data('codeTooltip') ) {
@@ -45,10 +45,19 @@
4646
4747 var tip = '<div class="mw-codereview-status-' + status + '" style="padding:5px 8px 4px; margin:-5px -8px -4px;">'
4848 + 'r' + matches[2]
49 - + ' [' + status + '] by '
 49+ + ' [' + mw.msg( 'codereview-status-' + status ) + '] by '
5050 + author
5151 + ( rev['*'] ? ' - ' + text : '' )
5252 + '</div>';
 53+
 54+ var tip = '<div class="mw-codereview-status-' + status + '" style="padding:5px 8px 4px; margin:-5px -8px -4px;">';
 55+
 56+ if ( rev[*] ) {
 57+ tip += mw.msg( 'code-tooltip-withsummary', matches[2], mw.msg( 'codereview-status-' + status ), author, text );
 58+ } else {
 59+ tip += mw.msg( 'code-tooltip-withoutsummary', matches[2], mw.msg( 'codereview-status-' + status ), author );
 60+ }
 61+ tip += '</div>';
5362 $el.attr( 'title', tip );
5463 $el.data( 'codeTooltip', true );
5564 if ( !$el.data( 'codeTooltipLeft' ) ) {
@@ -57,7 +66,7 @@
5867 }
5968 );
6069 }
61 -
 70+
6271 // We want to avoid doing API calls just because someone accidentally moves the mouse
6372 // over a link, so we only want to do an API call after the mouse has been on a link
6473 // for 250ms.
@@ -80,7 +89,7 @@
8190 // Clear the running timer
8291 clearTimeout( timerID );
8392 }
84 -
 93+
8594 if ( $el.data( 'codeTooltip' ) || !$el.data( 'codeTooltipLoading' ) ) {
8695 return;
8796 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r90903Followup r90902, remove old code that was supposed to be deleted...reedy20:11, 27 June 2011
r91033Follow-up r90902: Parse errorkrinkle00:22, 29 June 2011
r91098Followup r90902: messages are code-status-foobar, not codereview-status-foobardemon19:10, 29 June 2011
r95644Followup r95642, messages are added to RL before they can be customizedjohnduhart02:24, 29 August 2011

Comments

#Comment by Krinkle (talk | contribs)   18:14, 17 September 2011

Although it's no longer in trunk, the following caused a uncaught exception in the Installer of 1.17.0 when trying to install CodeReview, because the CodeRevision class wasn't autoloaded (obviously)

 // Revision tooltips CodeRevisionView:
 $wgResourceModules['ext.codereview.tooltips'] = array(
 	'scripts' => 'ext.codereview.tooltips.js',
-	'dependencies' => 'jquery.tipsy'
+	'dependencies' => 'jquery.tipsy',
+	'messages' => array_merge( CodeRevision::getPossibleStateMessageKeys(), array( 'code-tooltip-withsummary', 'code-tooltip-withoutsummary' ) ),

The setup just crashed/stopped after it includes CodeReview.php. The following was temporary hack to fix it.

+require_once($dir . 'backend/CodeRevision.php'); # KrinkleDev local hack. Used below

Fixed by r95644

Status & tagging log