Updates:


On 22 May 2014 08:14, Jon Robson <jrobson@wikimedia.org> wrote:
I've been away from OOUI/VisualEditor codebase for some time and I'm
hitting my head against a wall trying to get anywhere with what seems
like a small task.

Firstly I'm having issues getting citations working at all on my
vagrant instance -
http://imgur.com/WZmEWXj is how they look when I load VE
despite looking like http://imgur.com/dGA3sLw before I hit edit.
(I gave up trying to develop this on my local instance)

This needed Parsoid to be restarted after the configuration had changed.​ Now fixed.


 
That aside,  I figured I could easily add a 'reference' command to the
bottom of the menu that would load the ReferencesDialog which contains
the 'use existing reference' button
​.​
 

I figured it would be good to make this button open the
​ ​
ReferenceDialog 
and then explore a way of refactoring that so that
​ ​
'use existing reference
​'
 
could be used outside it or at the very least
​ ​
a reference dialogue could 
be opened and straight away switched to use
​ ​
existing reference.

​Which menu? The cite menu? Over-riding that seems like an epically bad idea, given that it's meant to be auto-generated. Or is there a different menu I'm missing?

Also, this is directly against the current UX design for the menu​, and though I think it's probably a good idea and merits exploration, was rejected before.

​P.S.: So apparently a story was written with this new design but helpfully wasn't brought up in the Monday meetings so I was totally unaware you were trying to do this. Sorry.


 
With this quest defined, I went into the code to work out how to do this.

I looked at ve.ui.MWReferenceDialog.js and got the command name
'reference' and added it to the list like so:
'include': [ { 'group': 'cite' }, 'reference' ] 
 
Magically a button appeared so i got excited and clicked it, hoping I
would see a reference dialog of some kind.

Sadly this caused things to explode, and I'm unable to debug this in
any coherent fashion to work this out.

​OK. What JS console errors did you get, if any? Can you describe what happened? Did you actually make sure that ​there's a defined action that the button corresponds to?

 
I've now been stuck for the past 2 hours and since I'm on GMT hours
I've been unable to find help on irc. I'm turning to you guys to work
out how I can take this further or if I'm going down the wrong rabbit
hole.

Help needed.
I see Juliusz is on IRC so I'm hoping he'll be able to help.

​I would very strongly advise against trying to do delicate things like this which may well blow up horrible remotely​, and then being surprised that they blow up. :-(

​J.
--
James D. Forrester
Product Manager, VisualEditor
Wikimedia Foundation, Inc.

jforrester@wikimedia.org | @jdforrester