-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for tags #527
Add support for tags #527
Changes from all commits
08d00d7
f722c0a
4078d4a
b16c437
53b0e44
d3d8220
9a21343
5e60913
03178fe
a1ac70e
03ad214
f0ece8e
6d31186
e2e6c05
649a3fa
2310d3e
3e25458
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,11 @@ public function execute( $par ): void { | |
|
||
$this->checkPermissions(); | ||
|
||
$this->getOutput()->addModules( [ 'ext.createwiki.oouiform.wikiTags' ] ); | ||
$this->getOutput()->addJsConfigVars( [ | ||
'wgCreateWikiAvailableTags' => $this->getConfig()->get( ConfigNames::AvailableTags ), | ||
] ); | ||
|
||
$form = $this->getForm(); | ||
if ( $form->show() ) { | ||
$this->onSuccess(); | ||
|
@@ -100,6 +105,15 @@ protected function getFormFields(): array { | |
]; | ||
} | ||
|
||
if ( $this->getConfig()->get( ConfigNames::AvailableTags ) { | ||
$formDescriptor['wikitags'] = [ | ||
'type' => 'text', | ||
'label-message' => 'createwiki-label-wiki-tags', | ||
'cssclass' => 'createwiki-wikitags', | ||
'disabled' => true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You may be right. This still has a lot of work like also passing to cw_requests also |
||
]; | ||
} | ||
|
||
if ( $this->getConfig()->get( ConfigNames::UsePrivateWikis ) ) { | ||
$formDescriptor['private'] = [ | ||
'type' => 'check', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
( function () { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really need two IIFEs? |
||
$( function () { | ||
var $fallbackLayout = $( '.createwiki-wikitags.oo-ui-layout' ); | ||
var $fallbackInput = $( '#mw-input-wpwikitags' ); | ||
|
||
var infusedFallbackLayout = OO.ui.infuse( $fallbackLayout ); | ||
var infusedFallbackInput = OO.ui.infuse( $fallbackInput ); | ||
|
||
infusedFallbackLayout.$element.css( 'display', 'none' ); | ||
|
||
var tags = []; | ||
for ( var key in mw.config.get( 'wgCreateWikiAvailableTags' ) ) { | ||
tags.push( { | ||
data: key, | ||
label: mw.config.get( 'wgCreateWikiAvailableTags' )[ key ] | ||
} ); | ||
} | ||
|
||
var multiTagSelect = new OO.ui.MenuTagMultiselectWidget( { | ||
options: tags, | ||
tagLimit: 5 | ||
} ); | ||
|
||
var multiTagSelectLayout = new OO.ui.FieldLayout( multiTagSelect, { | ||
label: mw.msg( 'createwiki-label-wiki-tags' ), | ||
align: 'top' | ||
} ); | ||
|
||
multiTagSelect.on( 'change', function ( items ) { | ||
// Map selection changes back to the fallback input so that it is included in form submit | ||
infusedFallbackInput.setValue( items.map( function ( val ) { | ||
return val.data; | ||
} ).join( ',' ) ); | ||
} ); | ||
|
||
infusedFallbackLayout.$element.before( multiTagSelectLayout.$element ); | ||
} ); | ||
}() ); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE /*$wgDBprefix*/cw_wikis | ||
ADD COLUMN wiki_tags VARCHAR(128) NOT NULL DEFAULT '' AFTER wiki_category; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens when someone requests more than five tags?