Index: branches/RL2/extensions/Gadgets/Gadgets.i18n.php |
— | — | @@ -90,6 +90,7 @@ |
91 | 91 | 'gadgetmanager-prop-dependencies' => 'Dependencies', |
92 | 92 | 'gadgetmanager-prop-messages' => 'Messages', |
93 | 93 | 'gadgetmanager-prop-category' => 'Category', |
| 94 | + 'gadgetmanager-prop-category-new' => 'New category...', |
94 | 95 | 'gadgetmanager-prop-rights' => 'Required user rights', |
95 | 96 | 'gadgetmanager-prop-default' => 'Enable by default', |
96 | 97 | 'gadgetmanager-prop-hidden' => 'Hide gadget', |
— | — | @@ -219,7 +220,12 @@ |
220 | 221 | # For the ext.gadgets.gadgetmanager module |
221 | 222 | 'gadgets-gadget-create' => 'Identical to core: |
222 | 223 | * {{mw-msg|vector-view-create}} |
223 | | -* {{mw-msg|create}}', |
| 224 | +* {{mw-msg|create}} |
| 225 | + |
| 226 | +{{Output|plain}}', |
| 227 | + 'gadgetmanager-prop-category-new' => 'Special option in the "Category" drop down menu. When selected an input field appears allowing the user to create a new (custom) category. Should and in ellipsis ("...") or something like it appropiate for the target language. |
| 228 | + |
| 229 | +{{Output|plain}}', |
224 | 230 | 'gadgetmanager-comment-modify' => 'Edit summary used when modifying gadget definition pages through AJAX on [[Special:Gadgets]].', |
225 | 231 | 'gadgetmanager-comment-create' => 'Edit summary used when creating gadget definition pages through AJAX on [[Special:Gadgets]].', |
226 | 232 | |
Index: branches/RL2/extensions/Gadgets/Gadgets.php |
— | — | @@ -232,6 +232,7 @@ |
233 | 233 | 'gadgetmanager-prop-dependencies', |
234 | 234 | 'gadgetmanager-prop-messages', |
235 | 235 | 'gadgetmanager-prop-category', |
| 236 | + 'gadgetmanager-prop-category-new', |
236 | 237 | 'gadgetmanager-prop-rights', |
237 | 238 | 'gadgetmanager-prop-default', |
238 | 239 | 'gadgetmanager-prop-hidden', |
Index: branches/RL2/extensions/Gadgets/modules/ext.gadgets.gadgetmanager.js |
— | — | @@ -48,7 +48,7 @@ |
49 | 49 | <table>\ |
50 | 50 | <tr>\ |
51 | 51 | <td class="mw-gadgetmanager-label"><label for="mw-gadgetmanager-input-category"><html:msg key="gadgetmanager-prop-category" /></label></td>\ |
52 | | - <td><select id="mw-gadgetmanager-input-category"></select></td>\ |
| 52 | + <td><select id="mw-gadgetmanager-input-category"></select><input type="text" id="mw-gadgetmanager-input-category-new" /></td>\ |
53 | 53 | </tr>\ |
54 | 54 | <tr>\ |
55 | 55 | <td class="mw-gadgetmanager-label"><label for="mw-gadgetmanager-input-rights"><html:msg key="gadgetmanager-prop-rights" /></label></td>\ |
— | — | @@ -340,7 +340,8 @@ |
341 | 341 | var metadata = gadget.metadata, |
342 | 342 | $form = $( tpl.fancyForm ).localize(), |
343 | 343 | $idSpan = $form.find( '.mw-gadgetmanager-id' ), |
344 | | - $idErrMsg = $form.find( '.mw-gadgetmanager-id-errorbox' ); |
| 344 | + $idErrMsg = $form.find( '.mw-gadgetmanager-id-errorbox' ), |
| 345 | + $newCatInput = $form.find( '#mw-gadgetmanager-input-category-new' ); |
345 | 346 | |
346 | 347 | if ( mode === 'create' ) { |
347 | 348 | |
— | — | @@ -556,19 +557,35 @@ |
557 | 558 | var current = metadata.settings.category, |
558 | 559 | opts = '', |
559 | 560 | i = 0, |
| 561 | + catslen = categories.length, |
560 | 562 | cat; |
561 | | - for ( ; i < categories.length; i++ ) { |
| 563 | + for ( ; i < catslen; i++ ) { |
562 | 564 | cat = categories[i]; |
563 | 565 | opts += mw.html.element( 'option', { |
564 | 566 | value: cat.name, |
565 | 567 | selected: cat.name === current |
566 | 568 | }, cat.title ); |
567 | 569 | } |
| 570 | + opts += '<option disabled="disabled">-------</option>' |
| 571 | + + '<option data-gadgets-new-category="true">' + mw.message( 'gadgetmanager-prop-category-new' ).escaped() + '</option>'; |
568 | 572 | return opts; |
569 | | - }).change( function() { |
570 | | - metadata.settings.category = $(this).val(); |
| 573 | + }).bind( 'change', function() { |
| 574 | + if ( $(this).children( ':selected' ).data( 'gadgetsNewCategory' ) === true ) { |
| 575 | + metadata.settings.category = $newCatInput.val(); |
| 576 | + $newCatInput.show().focus(); |
| 577 | + } else { |
| 578 | + metadata.settings.category = $(this).val(); |
| 579 | + $newCatInput.hide(); |
| 580 | + } |
571 | 581 | }); |
572 | 582 | |
| 583 | + $newCatInput |
| 584 | + .hide() |
| 585 | + .prop( 'placeholder', mw.msg( 'gadgetmanager-prop-category-new' ) ) |
| 586 | + .bind( 'blur change', function(){ |
| 587 | + metadata.settings.category = $(this).val(); |
| 588 | + }); |
| 589 | + |
573 | 590 | // Gadget settings: rights |
574 | 591 | $form.find( '#mw-gadgetmanager-input-rights' ).createPropCloud({ |
575 | 592 | props: metadata.settings.rights, |
Index: branches/RL2/extensions/Gadgets/modules/ext.gadgets.specialgadgets.tabs.js |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | mw.msg( 'gadgets-gadget-create' ), |
19 | 19 | 'ca-create', // Use whatever core has for pages ? Or use gadget-create ? |
20 | 20 | mw.msg( 'gadgets-gadget-create-tooltip' ), |
21 | | - 'e' // Same as core for ca-edit |
| 21 | + 'e' // Same as core for ca-edit/ca-create |
22 | 22 | ); |
23 | 23 | $( createTab ).click( function( e ) { |
24 | 24 | e.preventDefault(); |