Index: trunk/phase3/RELEASE-NOTES-1.20 |
— | — | @@ -21,6 +21,7 @@ |
22 | 22 | contentSub, ... The same div often also contains the class mw-content-ltr/rtl. |
23 | 23 | * (bug 27619) Remove preference option to display broken links as link? |
24 | 24 | * (bug 34896) Update jQuery JSON plugin to v2.3 (2011-09-17) |
| 25 | +* (bug 34302) Add CSS classes to email fields in user preferences |
25 | 26 | |
26 | 27 | === Bug fixes in 1.20 === |
27 | 28 | * (bug 30245) Use the correct way to construct a log page title. |
Index: trunk/phase3/CREDITS |
— | — | @@ -159,6 +159,7 @@ |
160 | 160 | * Nx.devnull |
161 | 161 | * Nikola Kovacs |
162 | 162 | * Nikolaos S. Karastathis |
| 163 | +* Nischay Nahata |
163 | 164 | * Olaf Lenz |
164 | 165 | * Olivier Finlay Beaton |
165 | 166 | * Paul Copperman |
Index: trunk/phase3/tests/phpunit/includes/PreferencesTest.php |
— | — | @@ -31,9 +31,10 @@ |
32 | 32 | */ |
33 | 33 | function testEmailFieldsWhenUserHasNoEmail() { |
34 | 34 | $prefs = $this->prefsFor( 'noemail' ); |
35 | | - $this->assertArrayNotHasKey( 'class', |
| 35 | + $this->assertArrayHasKey( 'cssclass', |
36 | 36 | $prefs['emailaddress'] |
37 | 37 | ); |
| 38 | + $this->assertEquals( 'mw-email-none', $prefs['emailaddress']['cssclass'] ); |
38 | 39 | } |
39 | 40 | /** |
40 | 41 | * Placeholder to verify bug 34302 |
— | — | @@ -41,9 +42,10 @@ |
42 | 43 | */ |
43 | 44 | function testEmailFieldsWhenUserEmailNotAuthenticated() { |
44 | 45 | $prefs = $this->prefsFor( 'notauth' ); |
45 | | - $this->assertArrayNotHasKey( 'class', |
| 46 | + $this->assertArrayHasKey( 'cssclass', |
46 | 47 | $prefs['emailaddress'] |
47 | 48 | ); |
| 49 | + $this->assertEquals( 'mw-email-not-authenticated', $prefs['emailaddress']['cssclass'] ); |
48 | 50 | } |
49 | 51 | /** |
50 | 52 | * Placeholder to verify bug 34302 |
— | — | @@ -51,9 +53,10 @@ |
52 | 54 | */ |
53 | 55 | function testEmailFieldsWhenUserEmailIsAuthenticated() { |
54 | 56 | $prefs = $this->prefsFor( 'auth' ); |
55 | | - $this->assertArrayNotHasKey( 'class', |
| 57 | + $this->assertArrayHasKey( 'cssclass', |
56 | 58 | $prefs['emailaddress'] |
57 | 59 | ); |
| 60 | + $this->assertEquals( 'mw-email-authenticated', $prefs['emailaddress']['cssclass'] ); |
58 | 61 | } |
59 | 62 | |
60 | 63 | |
Index: trunk/phase3/includes/Preferences.php |
— | — | @@ -354,16 +354,19 @@ |
355 | 355 | $emailAddress .= $emailAddress == '' ? $link : " ($link)"; |
356 | 356 | } |
357 | 357 | |
| 358 | + |
358 | 359 | $defaultPreferences['emailaddress'] = array( |
359 | 360 | 'type' => 'info', |
360 | 361 | 'raw' => true, |
361 | 362 | 'default' => $emailAddress, |
362 | 363 | 'label-message' => 'youremail', |
363 | 364 | 'section' => 'personal/email', |
| 365 | + # 'cssclass' chosen below |
364 | 366 | ); |
365 | 367 | |
366 | 368 | $disableEmailPrefs = false; |
367 | 369 | |
| 370 | + $emailauthenticationclass = 'mw-email-not-authenticated'; |
368 | 371 | if ( $wgEmailAuthentication ) { |
369 | 372 | if ( $user->getEmail() ) { |
370 | 373 | if ( $user->getEmailAuthenticationTimestamp() ) { |
— | — | @@ -378,6 +381,7 @@ |
379 | 382 | $emailauthenticated = $context->msg( 'emailauthenticated', |
380 | 383 | $time, $d, $t )->parse() . '<br />'; |
381 | 384 | $disableEmailPrefs = false; |
| 385 | + $emailauthenticationclass = 'mw-email-authenticated'; |
382 | 386 | } else { |
383 | 387 | $disableEmailPrefs = true; |
384 | 388 | $emailauthenticated = $context->msg( 'emailnotauthenticated' )->parse() . '<br />' . |
— | — | @@ -385,10 +389,12 @@ |
386 | 390 | SpecialPage::getTitleFor( 'Confirmemail' ), |
387 | 391 | $context->msg( 'emailconfirmlink' )->escaped() |
388 | 392 | ) . '<br />'; |
| 393 | + $emailauthenticationclass="mw-email-not-authenticated"; |
389 | 394 | } |
390 | 395 | } else { |
391 | 396 | $disableEmailPrefs = true; |
392 | 397 | $emailauthenticated = $context->msg( 'noemailprefs' )->escaped(); |
| 398 | + $emailauthenticationclass = 'mw-email-none'; |
393 | 399 | } |
394 | 400 | |
395 | 401 | $defaultPreferences['emailauthentication'] = array( |
— | — | @@ -397,9 +403,11 @@ |
398 | 404 | 'section' => 'personal/email', |
399 | 405 | 'label-message' => 'prefs-emailconfirm-label', |
400 | 406 | 'default' => $emailauthenticated, |
| 407 | + # Apply the same CSS class used on the input to the message: |
| 408 | + 'cssclass' => $emailauthenticationclass, |
401 | 409 | ); |
402 | | - |
403 | 410 | } |
| 411 | + $defaultPreferences['emailaddress']['cssclass'] = $emailauthenticationclass; |
404 | 412 | |
405 | 413 | if ( $wgEnableUserEmail && $user->isAllowed( 'sendemail' ) ) { |
406 | 414 | $defaultPreferences['disablemail'] = array( |
Index: trunk/phase3/resources/Resources.php |
— | — | @@ -786,6 +786,7 @@ |
787 | 787 | ), |
788 | 788 | 'mediawiki.special.preferences' => array( |
789 | 789 | 'scripts' => 'resources/mediawiki.special/mediawiki.special.preferences.js', |
| 790 | + 'styles' => 'resources/mediawiki.special/mediawiki.special.preferences.css', |
790 | 791 | ), |
791 | 792 | 'mediawiki.special.recentchanges' => array( |
792 | 793 | 'scripts' => 'resources/mediawiki.special/mediawiki.special.recentchanges.js', |
Index: trunk/phase3/resources/mediawiki.special/mediawiki.special.changeemail.css |
— | — | @@ -5,6 +5,8 @@ |
6 | 6 | border-bottom-right-radius: 0.8em; |
7 | 7 | border-top-right-radius: 0.8em; |
8 | 8 | } |
| 9 | + |
| 10 | +/** colors also used in mediawiki.special.preferences.css */ |
9 | 11 | #mw-emailaddress-validity.valid { |
10 | 12 | border: 1px solid #80FF80; |
11 | 13 | background-color: #C0FFC0; |
Index: trunk/phase3/resources/mediawiki.special/mediawiki.special.preferences.css |
— | — | @@ -0,0 +1,11 @@ |
| 2 | +/** Reuses colors from mediawiki.special.changeemail.css */ |
| 3 | +.mw-email-not-authenticated .mw-input, |
| 4 | +.mw-email-none .mw-input{ |
| 5 | + border: 1px solid #FF8080; |
| 6 | + background-color: #FFC0C0; |
| 7 | + color: black; |
| 8 | +} |
| 9 | +/** Authenticated email field has its own class too. Unstyled by default */ |
| 10 | +/* |
| 11 | +.mw-email-authenticated .mw-input { } |
| 12 | +*/ |
Property changes on: trunk/phase3/resources/mediawiki.special/mediawiki.special.preferences.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 13 | + native |