Page MenuHomePhabricator

ResourceLoader-ify Quiz CSS
Closed, ResolvedPublic

Description

Quiz has a load of hard coded CSS in Quiz.class.php in the parseQuiz() function

It's got some variablised direction code stuff:

$start = $wgContLang->isRTL() ? 'right' : 'left';
$end = $wgContLang->isRTL() ? 'left' : 'right';

I've moved the fully hard coded lines out to an RL css file in https://gerrit.wikimedia.org/r/15576

This then leave 2 lines that use Quiz::getColor (I'm guessing the colours can be changed asa form of settings...) and 5 lines that use $start and $end


Version: unspecified
Severity: enhancement

Event Timeline

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

Please I would like to work on this task, but I do not get the description clearly. Does it require moving all the other hard coded CSS to an RL CSS file ?.

@Mvolz I'm interested to work on this task as microtask for https://phabricator.wikimedia.org/T148969.
@Reedy
I can see that Quiz.class.php has $mColors array which contains static colors defined for correction, right, wrong etc.
Quiz::getColor is used inside parseQuiz() function to get correction color.
Also I can understand that $start and $end are used as variables for storing the output from $wgContLang while it should be handled by ResourceLoader which automatically flips using CSSJanus.
As the css module is already registered with ResourceLoader can we simply remove $start and $end?
How should I approach to add color as a setting ?(shouldn't it be a feature then ?)

How should I approach to add color as a setting ?(shouldn't it be a feature then ?)

I don't know why the colour is abstracted like it is, to be honest. It's not like it's made user configurable via LocalSettings...

Where the getColor() function calls are, to directly build CSS, just replace the colour verbatim into the string, and export it to ext.quiz.css

For the RL stuff.. I don't know if you can just remove $start and $end, presumably we need to set a value so that RL know's what to change...

Change 320064 had a related patch set uploaded (by Harjotsingh):
Removing Hardcoded Css and $wgContLang from parseQuiz() function.

https://gerrit.wikimedia.org/r/320064

Change 320064 merged by jenkins-bot:
Removing Hardcoded Css and $wgContLang from parseQuiz() function.

https://gerrit.wikimedia.org/r/320064