Agora/Engineering

Munaf, spage, and Trevor talked about Agora, CSS, Userlogin and VE in November 2012, and again in 2013.

What is Agora?
Everyone so far has rolled their own blue buttons: AFT, VE, and E3.

Trevor has mostly focused on the button look, but Agora encompasses the cleaner forms and different typography that Munaf has developed for E3.

Approach
If a page element has new style mw-ui-button, then it gets the new-look button appearance; "mix-in" styles constructive and destructive make the button green and red. But no buttons have these styles yet. There is a patch to add them to core buttons.

Similarly, if a form or div has new style mw-ui-vform, then labels and input fields in divs within it are styled in a compact vertical stack.

Agora is decoupled from the user's skin; code can opt-in to the Agora styles and it'll sort-of work in other styles besides Vector. The Resource Loader module uses skinStyles to send either 'mediawiki.ui.vector.css' or 'mediawiki.ui.default.css' to the client.

How mw-ui-vform affects existing CSS and HTML
Labels and input fields in the new "compact vertical stacked form" automatically get a certain styling (gray small label text, full-width input fields, etc.) due to selectors such as. If you have elements in a vform to which you don't want these styles applied, you can move them one level down; for example nest them inside a  tag.

Account creation user experience/Engineering suggest how wikis can adapt to changes specific to the new login and create account forms.

Agora extension
Extension:Agora,

This sends CSS and JS to the client. It's not shipped or enabled on any wiki yet.

Agora in core
E3 has a patch that copies the Agora CSS from the extension into core (resources/mediawiki.ui ) and changes the Log in form to use Agora mw-ui-buttons and mw-ui-vform.

Changing HTMLForm
spage has a change on top of Tyler Romeo's  that changes HTMLForm. Clients like SpecialNewUserlogin.php can simply:

This builds off the 'div' displayFormat (form elements in divs, not table rows). It
 * adds the Agora class 'mw-ui-vform' to the form
 * form gets 290px wide, input fields go wide, 'error' class gets Agora styling
 * adds 'mw-ui-button mw-ui-big mw-ui-block mw-ui-primary' to the form's default submit button

HTMLForm issues
To get the new login form design:


 * when a checkbox or radio button is in a vform, need to detect and output the inverted label within check.  patch coming


 * the vform display format should turn off the form display border for you (perhaps only when using Vector?) patch coming


 * don't output an empty div for checkbox labels. Patch coming changes HTMLFormField::getLabelHTML so that if the item returns false for needsLabel, then no label HTML is output.


 * HTMLForm divs are crazily nested, so the margin-bottom on .mw-ui-vform > div to space each div out doesn't fire.
 * Hack in upcoming patch adds a .mw-ui-vform-div selector to Agora and applies the class to divs in vform.


 * Meanwhile the submit button is NOT in a div, so that doesn't get space after.


 * how to cleanly do labels with a right-aligned link? e.g. "Password   _Forgotten your login details?_" probably supply raw HTML in the 'label' property.


 * HTMLForm does default form field validation in PHP on the server (see screenshot).
 * Alignment off
 * We'd prefer a single error message above the form contents, and a red highlight on the erroneous field(s)
 * On form error, HTMLForm adds .mw-htmlform-invalid-input to the td, there's a style for '.mw-htmlform-invalid-input td.mw-input input' that makes the input field's border red. May be broken in div layout.


 * the language links shouldn't be part of the form, unclear how a special form can output stuff outside the form area.


 * how to add the "[Join Wiki]" CTA? probably use an 'info' field and supply its raw HTML, or insert in the footer.

rollout
Trevor was thinking of rolling Agora extension out in the new year, due to him working on VE stuff in his real job.

To actually see the new buttons across all MediaWiki pages there would be a monster platform commit that applies the style to buttons everywhere. .

E3's Userlogin enhancement will depend on this extension If E3 deploys the extension, then VE will require it as well instead of their own CSS

E3 wants to roll out new Userlogin form with button changes to every wiki.

If/when we're confident it does the right thing we can change all existing styles.
 * the Agora extension could add a .agora style to the &lt;body> tag of all pages, thereby changing all pages where the Agora CSS changes existing styles.
 * or we simply remove .agora from CSS selectors in agora.css, thereby changeing all pages.

The extension could make its addition of the .agora style to pages dependent on a user pref, so that users can opt out of it. Trevor thinks this is easy to do, he's done it before.

Organizing the CSS
Munaf wants to use less. Fine, use a Makefile to build CSS. RL one day could do this for us less or sass? sass has better PHP integration so maybe that.

2013-03: We're using Compass, running make and checking in resulting CSS

Changing core forms
Could choose different templates in the special page, rather than having a conditional in the template itself.

2013-03: Implemented in 

PHP implementation
Userlogin and Usercreate don't use HTMLForm, they're just QuickTemplate. HTMLForm is better.

2013-03: We're evaluating HTMLForm, See section above.

Trevor suggestion: Modify the template to optimize for Agora but have a mode where CSS changes make it look like the old version.
 * this would be hard, have to add spans and divs within the &lt;li> elements and then table-ize them.

CSS naming
Munaf leans towards the latter. It makes it possible to transition site over to new style and/or eventually remove the .agora
 * Should the new Userlogin/Usercreate form layouts add meaningful mw-form-stacked, etc. class names similar to Trevor's Agora mw-ui-button class, and when Agora is loaded these trigger the new appearance?
 * Or should the Userlogin/Usercreate form layouts just apply .agora style to an enclosing div, so that when Agora extension is loaded everything picks up Agora styling?

2013-03 update: Agora adds mw-ui-vform that triggers vertical (block, width:100%) layout for its contents; the core forms also use a 'mw-ui-content' area and have selectors within that to turn off Vector's h2 underline, remove Vector's border on forms, etc.''

Reviewers
Reedy or Chad on platform should review, or Timo/Krinkle. Need to socialize

Examples

 * Buttons and form fields
 * Modal dialogs