Hi Huji,

I took a look, and it seems you're missing the command to actually open the
dialog. Your code builds the dialog correctly, and then attaches the
windowManager and adds the dialog to the window, but there's no command
telling the manager to open the dialog on click.

I tried to debug your code, so I copied it over and looked and I found that
if I changed this, it worked:

$(mw.util.addPortletLink( 'p-cactions', '#', 'تذکر', 'ca-warn',
'فرستادن سریع یک پیام یا تذکر مبتنی بر الگو', '*')).click(function(e)
{
          mw.loader.using(['oojs-ui-core', 'oojs-ui-widgets',
'oojs-ui-windows', 'mediawiki.api'])
                .then(UMOptions.createWindow)
                .then( function () {
                                windowManager.openWindow( UM );
                } );

(notice the second 'then')
Basically, I tell the code that on click, after it is certain to have
created the dialog, it should open it :)

See documentation here: https://www.mediawiki.org/wiki/OOUI/Windows/Dialogs

I hope this helps!

Moriel

On Wed, Mar 20, 2019 at 7:22 PM Huji Lee <huji.h...@gmail.com> wrote:

> Hi everyone!
>
> I am pretty sure I am missing something obvious here, but I cannot spot it
> and I would appreciate a fresh set of eyes looking at it.
>
> The script at https://fa.wikipedia.org/wiki/User:Huji/UserMessages.js is
> the backbone of a OOUI-based tool. I have made quite a few of a these tools
> in the past with no problem. For now, this tool is only supposed to do two
> things: add a link to the "More" dropdown on the top of the page (only if
> it is a user talk page), and open a OOUI dialog once the link is clicked.
>
> The first part works and I have verified that the *createWindow* method is
> called when you click the link, but the dialog is not shown. Can someone
> kindly look at my code and tell me what I am missing?
>
> Thanks,
>
> Huji
> _______________________________________________
> Wikitech-l mailing list
> Wikitech-l@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l



-- 
Moriel Schottlender (she/her)
Senior Software Engineer
Tech Lead | Community Tech and Anti Harassment Tools
Wikimedia Foundation https://wikimediafoundation.org/
_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to