Skip to content

Commit 6b3792d

Browse files
authored
test options for custom icons and labels (#4981)
* options for custom icons and labels * add checkbox help * fix choice label text position --------- Co-authored-by: Harouna Traoré <haroun@users.noreply.github.com>
1 parent cc5531f commit 6b3792d

5 files changed

Lines changed: 43 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Implemented GET /api/v1/@apostrophecms/login/whoami route such that it returns the details of the currently logged in user; added the route to the login module.
88
Thanks to [sombitganguly](https://github.com/sombitganguly) for this contribution.
99
* Adds keyboard shortcuts for manipulating widgets in areas. Includes Cut, Copy, Paste, Delete, and Duplicate.
10+
* Automatic translation now supports a disclaimer and an help text for the checkbox. You can now set the disclaimer by setting `automaticTranslationDisclaimer` `i18n` key and the help text by setting `automaticTranslationCheckboxHelp` `i18n` key.
1011
* Adds dynamic choices working with piece manager filters.
1112
* Allow `import.imageTags` (array of image tag IDs) to be passed to the rich text widget when importing (see https://docs.apostrophecms.org/reference/api/rich-text.html#importing-inline-images).
1213
* Adds a new way to make `GET` requests with a large query string. It can become a `POST` request containing the key `__aposGetWithQuery` in its body.

modules/@apostrophecms/i18n/i18n/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
"at": "at",
4747
"attachment": "Attachment",
4848
"automaticTranslationCheckbox": "Translate text content",
49+
"automaticTranslationCheckboxHelp": "",
50+
"automaticTranslationDisclaimer": "",
4951
"automaticTranslationErrMsg": "An error happened while getting available languages for translation. Translation will be skipped.",
5052
"automaticTranslationErrorNoProvider": "Translation provider not found. Page \"{{ title }}\" was not translated.",
5153
"automaticTranslationErrorTargets": "Badly formatted translation targets.",

modules/@apostrophecms/i18n/ui/apos/components/AposI18nLocalize.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,19 @@
231231
{{ $t('apostrophe:automaticTranslationSettings') }}
232232
</span>
233233
</p>
234+
<p
235+
v-if="automaticTranslationDisclaimer"
236+
class="apos-wizard__translation-disclaimer"
237+
>
238+
{{ automaticTranslationDisclaimer }}
239+
</p>
234240
<AposCheckbox
235241
v-model="wizard.values.translateContent.data"
236242
:field="{ name: 'translate' }"
237243
:choice="{
238244
value: wizard.values.translateContent.data,
239-
label: $t('apostrophe:automaticTranslationCheckbox')
245+
label: $t('apostrophe:automaticTranslationCheckbox'),
246+
htmlHelp: $t('apostrophe:automaticTranslationCheckboxHelp')
240247
}"
241248
data-apos-test="localizationTranslationCheck"
242249
/>
@@ -449,7 +456,8 @@ export default {
449456
translationEnabled: apos.modules['@apostrophecms/translation'].enabled,
450457
translationErrMsg: null,
451458
translationShowRetry: false,
452-
translationShowLoader: false
459+
translationShowLoader: false,
460+
automaticTranslationDisclaimer: this.$t('apostrophe:automaticTranslationDisclaimer')
453461
};
454462
},
455463
computed: {

modules/@apostrophecms/submitted-draft/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ module.exports = {
7979
},
8080
modal: {
8181
default: {
82-
'@apostrophecms/command-menu:taskbar-manager': {
82+
'@apostrophecms/command-menu:taskbar': {
8383
label: 'apostrophe:commandMenuTaskbar',
8484
commands: [
8585
`${self.__meta.name}:taskbar-manager`

modules/@apostrophecms/ui/ui/apos/components/AposCheckbox.vue

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,21 @@
3030
:size="10"
3131
/>
3232
</span>
33-
<span
33+
<div
3434
v-if="choice.label"
3535
:class="{'apos-sr-only': field.hideLabel }"
3636
class="apos-choice-label-text"
3737
>
38-
{{ $t(choice.label) }}
39-
</span>
38+
<span>
39+
{{ $t(choice.label) }}
40+
</span>
41+
<!-- eslint-disable vue/no-v-html -->
42+
<p
43+
v-if="(choice.help || choice.htmlHelp)"
44+
class="apos-choice-label-text--help apos-field__help"
45+
v-html="$t(choice.help || choice.htmlHelp)"
46+
/>
47+
</div>
4048
</label>
4149
</template>
4250

@@ -104,7 +112,23 @@ export default {
104112
</script>
105113

106114
<style lang="scss" scoped>
107-
.apos-input-indicator {
108-
border-radius: 3px;
115+
.apos-input-indicator {
116+
border-radius: 3px;
117+
}
118+
119+
.apos-choice-label-text {
120+
display: inline-flex;
121+
flex-direction: column;
122+
align-items: baseline;
123+
}
124+
125+
.apos-field__help {
126+
@include type-base;
127+
128+
& {
129+
margin: 0 0 $spacing-base;
130+
line-height: var(--a-line-tall);
131+
color: var(--a-base-3);
109132
}
133+
}
110134
</style>

0 commit comments

Comments
 (0)