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
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.huji@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
You are absolutely right; I really appreciate the time you took to review the code! Thanks, Huji
On Wed, Mar 20, 2019 at 11:25 PM Moriel Schottlender < mschottlender@wikimedia.org> wrote:
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.huji@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
Actually, can I ask for one more thing?
I updated the code such that when you click on that link (which now reads as "تذکر"), it would open a dialog with a StackLayout in it which consists of two FieldLayouts, somehow, the dialog is becoming scrollable, and has very little height, making the contents hard to read. Looking at the documentations for StackLayout I see that the scrollable parameter defaults to false; I even went ahead and hardcoded the value as false, but the problem persists. Can you kindly tell me which other elements need to be modified for this not to occur?
Thanks again,
Huji
On Thu, Mar 21, 2019 at 7:41 AM Huji Lee huji.huji@gmail.com wrote:
You are absolutely right; I really appreciate the time you took to review the code! Thanks, Huji
On Wed, Mar 20, 2019 at 11:25 PM Moriel Schottlender < mschottlender@wikimedia.org> wrote:
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.huji@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
I found out that I had hardcoded the scrollable property in the wrong place. But, interestingly, I also figured out that StackLayou's scrollable parameter defaults to true. Isn't that in contrast with the documentation?
Anyway, setting it to false resolved that issue. Next I need to figure out how to nest a StackLayout inside another StackLayout
On Thu, Mar 21, 2019 at 10:20 PM Huji Lee huji.huji@gmail.com wrote:
Actually, can I ask for one more thing?
I updated the code such that when you click on that link (which now reads as "تذکر"), it would open a dialog with a StackLayout in it which consists of two FieldLayouts, somehow, the dialog is becoming scrollable, and has very little height, making the contents hard to read. Looking at the documentations for StackLayout I see that the scrollable parameter defaults to false; I even went ahead and hardcoded the value as false, but the problem persists. Can you kindly tell me which other elements need to be modified for this not to occur?
Thanks again,
Huji
On Thu, Mar 21, 2019 at 7:41 AM Huji Lee huji.huji@gmail.com wrote:
You are absolutely right; I really appreciate the time you took to review the code! Thanks, Huji
On Wed, Mar 20, 2019 at 11:25 PM Moriel Schottlender < mschottlender@wikimedia.org> wrote:
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.huji@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
wikitech-l@lists.wikimedia.org