There's a good chance that there's a huge amount of categories on a wiki, having autocompletion for adding such a thing would help. :)
Description
| Status | Subtype | Assigned | Task | ||
|---|---|---|---|---|---|
| Stalled | Filip | T146000 Convert instances of the social tools TagCloud class in FanBoxes and BlogPage to use CapsuleMultiselectWidget | |||
| Open | None | T152267 Convert BlogPage Special:CreateBlogPost to OOUI HTMLForm |
Event Timeline
A proof-of-concept is now live on the development wiki (currently only for the MonoBook skin because it's implemented via MediaWiki:Monobook.js instead of in the extension). Please try it out and let me know if it's what you wanted and we can then merge it into the codebase or alternatively tweak it some more.
This could use the available OOJS-UI CapsuleMiniWidget also (I'm not sure if this works for textarea elements, however). There's no way to permalink to widgets on the OOJS UI demo page, but it's on here (just Ctrl+F the element):
https://doc.wikimedia.org/oojs-ui/master/demos/#widgets-mediawiki-ltr
@FilipGCI It looks like it backfired after skimming through it, I'm still not quite sure why though?
I'm sure it could work, there's also jquery.ui.autocomplete as well :) (see https://jqueryui.com/autocomplete/) @ashley implemented jquery.ui.autocomplete in a script and showed it to me a while ago which I tested and found that it worked, I forgot why it wasn't uploaded as a patch though. Before you think of submitting a patch with that, you should probably wait for her response.
Note: You might also be interested in looking at T154855, which (indirectly) considers using OOUI CapsuleMultiselectWidget as an option
$( function() { if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'CreateBlogPost' ) { // temp mw.loader.using( 'jquery.ui.autocomplete', function() { // more temp crap $( '#pageCtg' ).autocomplete( { minLength: 3, source: function( request, response ) { $.ajax( { type: 'GET', dataType: 'json', url: mw.util.wikiScript( 'api' ), data: { action: 'query', list: 'allcategories', acprefix: request.term, format: 'json' }, } ).done( function( data ) { response( data.query.allcategories.map( function ( c ) { return c['*']; } ) ); } ).fail( function() {} ); }, select: function( value, data ) { if ( typeof data === 'undefined' ) { $( '#pageCtg' ).val( value ); } else { $( '#pageCtg' ).val( data.item.value ); } } } ); } ); // temp } // temp } );
@FilipGCI I meant to mention T131492 in the past as well since it uses chips, I was considering that BlogPage could perhaps implement a similar solution?
@SamanthaNguyen @ashley: Working on solution using 'CapsuleMultiselectWidget'. If we're converting this extension to OOjsUI, this will be better solution.
Found the ticket: T135340: Create a PHP-only pendant for TagMultiselectWidget
Also posting relevant IRC convo (took out unrelated messages):
[16:58:07] <rlot> MatmaRex: Hmm, is there way to directly create CapsuleMultiselectWidget in PHP? [16:58:21] <rlot> new OOUI\CapsuleMultiSelectWidget(); [17:00:43] <MatmaRex> rlot: no. there's a task for it somewhere [17:01:21] <MatmaRex> rlot: it's impossible to implement it without any JS, though. so i'm not really sure what that would do, myself [17:01:53] <rlot> MatmaRex: Hmm, what if I want to add this widget to my specialpage? [17:02:12] <rlot> I need to append it via JS script to output? [17:02:26] <rlot> Or in some holder [17:07:28] <MatmaRex> rlot_: yeah :/ [17:07:54] <MatmaRex> rlot_: if you're using HTMLForm, it was some fallback to a list of checkboxes. (or you could implement something like that yourself) [17:07:58] <MatmaRex> it has* [17:10:23] <rlot_> MatmaRex: Hmm. Is there any better widget for autocompletion/adding tags/etc? [17:11:31] <SamanthaNguyen> MatmaRex: If you're interested, the tickets directly related to rlot's questions are T146000 and T154855 (you might already be aware of that, though) [17:11:31] <stashbot> T146000: FeatureRequest: BlogPage's Special:CreateBlogPost should have autocompletion for adding categories - https://phabricator.wikimedia.org/T146000 [17:11:32] <stashbot> T154855: Impossible to remove a category after adding one with the social tools TagCloud function (e.g in Special:CreateBlogPost) - https://phabricator.wikimedia.org/T154855
This ticket is basically blocked by T152267 unless if we're only going to convert half of the form to OOUI but that seems kinda weird, doesn't it?
@SamanthaNguyen: Yes, we will wait with this. We don't want to have mixed pure html/ooui interface.
Stalled until T152267: Convert BlogPage Special:CreateBlogPost to OOUI HTMLForm is resolved