Page MenuHomePhabricator

Add CSS classes to email fields in user preferences
Closed, ResolvedPublic

Description

Author: paxed

Description:
It's not possible to style the email in Special:Preferences differently depending on whether it's verified or not.

Currently it shows <table id="mw-htmlform-email">, would be nice to have eg. <table id="mw-htmlform-email" class="email-verified">


Version: unspecified
Severity: enhancement

Details

Reference
bz34302

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:17 AM
bzimport set Reference to bz34302.
bzimport added a subscriber: Unknown Object (MLST).

I have added a basic placeholder to test this bug with r113016

Please note the bug is being fixed by nischayn22.

adds new css classes based on email verification

The css design has been given a simple redish look and can be modified as desired

attachment my.patch ignored as obsolete

Great! Firstly, you have to add the css to the mediawiki.special.preferences module:

Index: resources/Resources.php

  • resources/Resources.php (revision 113031)

+++ resources/Resources.php (working copy)
@@ -786,6 +786,7 @@

	),
	'mediawiki.special.preferences' => array(
		'scripts' => 'resources/mediawiki.special/mediawiki.special.preferences.js',

+ 'styles' => 'resources/mediawiki.special/mediawiki.special.preferences.css',

	),
	'mediawiki.special.recentchanges' => array(
		'scripts' => 'resources/mediawiki.special/mediawiki.special.recentchanges.js',

You probably forgot resources/Resources.php when making the patch.

I don't think we should change the text color, you probably want to keep it black. Have a look at resources/mediawiki.special/mediawiki.special.changeemail.css which apply to a similar case, you can even reuse the colors from there.

I don't think you should change the background color of the label but only the input. The CSS should be something like:

.mw-email-notverified .mw-input

That will leave the label as is.

Then the PHP variable holding the css class is using the term "verify" whereas the rest of the code talk about "authentication". Please rephrase $emailverificationclass to $emailAuthClass (we use camel case).

Finally the class names are:

  • mw-email-verified
  • mw-email-notverified
  • mw-noemailprefs

As above, please considerate using the "authentication" term. Maybe use:

  • mw-email-authenticated
  • mw-email-not-authenticated
  • mw-email-none

Edited as per direction given in above comment

I hope this one serves the purpose!

Attached:

paxed wrote:

If HTML5 is allowed, this could be solved more generally by using the HTML5 data attributes.

sumanah wrote:

Antoine, could you review this patch, please? Thanks.

You had a minor issue in the patch, one string was missing quotes.

Anyway, I have made some trivial additions, amended existing tests and sent that as r113221

Please note this is not going to be deployed yet on Wikimedia website.

Thanks for the patch, you will have to find a new bug to fix now :-]]]