Localisation updates from https://translatewiki.net.
[mediawiki.git] / resources / src / mediawiki.special.block / components / BlockDetailsField.vue
blob9a9f7cf9dd432a06c444d8233f18d1d5b0bccfa3
1 <template>
2         <cdx-field :is-fieldset="true">
3                 <cdx-checkbox
4                         v-model="createAccount"
5                         input-value="wpCreateAccount"
6                 >
7                         {{ $i18n( 'ipbcreateaccount' ) }}
8                 </cdx-checkbox>
9                 <cdx-checkbox
10                         v-if="disableEmailVisible"
11                         v-model="disableEmail"
12                         input-value="wpDisableEmail"
13                 >
14                         {{ $i18n( 'ipbemailban' ) }}
15                 </cdx-checkbox>
16                 <cdx-checkbox
17                         v-if="disableUTEditVisible"
18                         v-model="disableUTEdit"
19                         input-value="wpDisableUTEdit"
20                 >
21                         {{ $i18n( 'ipb-disableusertalk' ) }}
22                 </cdx-checkbox>
23                 <template #label>
24                         {{ $i18n( 'block-details' ).text() }}
25                         <span class="cdx-label__label__optional-flag">
26                                 {{ $i18n( 'htmlform-optional-flag' ).text() }}
27                         </span>
28                 </template>
29                 <template #description>
30                         {{ $i18n( 'block-details-description' ).text() }}
31                 </template>
32         </cdx-field>
33 </template>
35 <script>
36 const { computed, defineComponent } = require( 'vue' );
37 const { storeToRefs } = require( 'pinia' );
38 const { CdxCheckbox, CdxField } = require( '@wikimedia/codex' );
39 const useBlockStore = require( '../stores/block.js' );
41 module.exports = exports = defineComponent( {
42         name: 'BlockDetailsField',
43         components: { CdxCheckbox, CdxField },
44         setup() {
45                 const store = useBlockStore();
46                 const { createAccount, disableEmail, disableUTEdit } = storeToRefs( store );
47                 const disableEmailVisible = mw.config.get( 'blockDisableEmailVisible' ) || false;
48                 const disableUTEditVisible = computed( () => {
49                         const isVisible = mw.config.get( 'blockDisableUTEditVisible' ) || false;
50                         const isPartial = store.type === 'partial';
51                         const blocksUT = store.namespaces.indexOf( mw.config.get( 'wgNamespaceIds' ).user_talk ) !== -1;
52                         return isVisible && ( !isPartial || ( isPartial && blocksUT ) );
53                 } );
55                 return {
56                         createAccount,
57                         disableEmail,
58                         disableEmailVisible,
59                         disableUTEdit,
60                         disableUTEditVisible
61                 };
62         }
63 } );
64 </script>