2 <cdx-field :is-fieldset="true">
4 {{ $i18n( 'block-reason' ).text() }}
7 {{ $i18n( 'block-reason-help' ).text() }}
8 <div class="mw-block-reason-edit">
9 <a :href="reasonEditUrl">
10 {{ $i18n( 'ipb-edit-dropdown' ) }}
16 v-model:selected="wrappedSelected"
17 :menu-items="reasonOptions"
22 v-model="wrappedOther"
23 :placeholder="$i18n( 'block-reason-other' ).text()"
24 :maxlength="reasonMaxLength"
31 const { defineComponent, toRef } = require( 'vue' );
32 const { CdxSelect, CdxField, CdxTextInput, useModelWrapper } = require( '@wikimedia/codex' );
34 module.exports = exports = defineComponent( {
36 components: { CdxSelect, CdxField, CdxTextInput },
38 // eslint-disable-next-line vue/no-unused-properties
39 selected: { type: [ String, Number, null ], default: 'other' },
40 // eslint-disable-next-line vue/no-unused-properties
41 other: { type: String, default: '' }
47 setup( props, { emit } ) {
48 const reasonOptions = mw.config.get( 'blockReasonOptions' );
49 const wrappedSelected = useModelWrapper( toRef( props, 'selected' ), emit, 'update:selected' );
50 const wrappedOther = useModelWrapper( toRef( props, 'other' ), emit, 'update:other' );
51 const reasonPreset = mw.config.get( 'blockReasonPreset' );
52 const reasonEditUrl = mw.util.getUrl( 'MediaWiki:Ipbreason-dropdown', { action: 'edit' } );
54 if ( reasonPreset !== 'other' && reasonOptions.some( ( option ) => option.value === reasonPreset ) ) {
55 emit( 'update:selected', reasonPreset );
60 reasonMaxLength: mw.config.get( 'blockReasonMaxLength' ),
70 @import 'mediawiki.skin.variables.less';
73 margin-bottom: @spacing-50;
77 .mw-block-reason-edit {