Hello,
I am trying to register two different window creation functions in OOjs UI but somehow they conflict with one another.
The code is in [1] and you can use it like [2]. If you go to a page with sections (e.g. my talk page) you should see new links in the section heading called "add comment" and "close". The first time you click on each, the respective dialog will be shown. But whichever you click on first will only work once! So for instance, if you first click on "add comment" and then cancel the dialog, then click on "close" and cancel, now only "close" links will work (all of them) and none of the "add comment" links will show a dialog anymore. No error is logged in the console either.
I am pretty sure it has to do with the way I am defining my objects, but I am not able to figure out what I am doing wrong. Please advise.
Thanks,
Huji
[1] https://en.wikipedia.org/wiki/User:Huji/close.js [2] https://en.wikipedia.org/wiki/User:Huji/vector.js
You have to define a .static.name for each window, or provide a name when calling addWindows(). See examples here: https://www.mediawiki.org/wiki/OOjs_UI/Windows/Window_managers
The fact that OOjs UI lets you do this wrong is a bug, though (and we have some documentation pages that provide bad advice). I filed https://phabricator.wikimedia.org/T149807 about it.
Also, you should move your definition of ArchiveSection and CommentInSection classes to top level (they're inside an event handler now). Right now your code actually redefines these functions/classes every time the user clicks the buttons. So after the second time the (for example) "add comment" button is clicked, `commentInSection.constructor` will no longer be equal to `CommentInSection`. This could cause hard-to-debug problems in the future.
Both valid points. And I am glad that my silly mistake revealed an actual bug. :)
On Wed, Nov 2, 2016 at 10:39 AM, Bartosz Dziewoński matma.rex@gmail.com wrote:
You have to define a .static.name for each window, or provide a name when calling addWindows(). See examples here: https://www.mediawiki.org/wiki /OOjs_UI/Windows/Window_managers
The fact that OOjs UI lets you do this wrong is a bug, though (and we have some documentation pages that provide bad advice). I filed https://phabricator.wikimedia.org/T149807 about it.
Also, you should move your definition of ArchiveSection and CommentInSection classes to top level (they're inside an event handler now). Right now your code actually redefines these functions/classes every time the user clicks the buttons. So after the second time the (for example) "add comment" button is clicked, `commentInSection.constructor` will no longer be equal to `CommentInSection`. This could cause hard-to-debug problems in the future.
-- Bartosz Dziewoński
MediaWiki-l mailing list To unsubscribe, go to: https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org