Add hint text to create and edit a post of a group

This commit is contained in:
Wolfgang Huß 2023-03-09 18:06:14 +01:00
parent 5911831c6a
commit fd62a03820
5 changed files with 51 additions and 18 deletions

View File

@ -41,7 +41,7 @@
{{ formData.title.length }}/{{ formSchema.title.max }} {{ formData.title.length }}/{{ formSchema.title.max }}
<base-icon v-if="errors && errors.title" name="warning" /> <base-icon v-if="errors && errors.title" name="warning" />
</ds-chip> </ds-chip>
<hc-editor <editor
:users="users" :users="users"
:value="formData.content" :value="formData.content"
:hashtags="hashtags" :hashtags="hashtags"
@ -64,14 +64,33 @@
{{ formData.categoryIds.length }} / 3 {{ formData.categoryIds.length }} / 3
<base-icon v-if="errors && errors.categoryIds" name="warning" /> <base-icon v-if="errors && errors.categoryIds" name="warning" />
</ds-chip> </ds-chip>
<div class="buttons"> <ds-flex class="buttons-footer" gutter="xxx-small">
<base-button data-test="cancel-button" :disabled="loading" @click="$router.back()" danger> <ds-flex-item width="3.5">
{{ $t('actions.cancel') }} <!-- eslint-disable vue/no-v-text-v-html-on-component -->
</base-button> <ds-text
<base-button type="submit" icon="check" :loading="loading" :disabled="errors" filled> v-if="groupId"
{{ $t('actions.save') }} class="info-text"
</base-button> v-html="$t('contribution.visibleOnlyForMembersOfGroup', { name: groupName })"
</div> />
<!-- eslint-enable vue/no-v-text-v-html-on-component -->
</ds-flex-item>
<ds-flex-item width="0.25" />
<ds-flex-item style="align-self: flex-end">
<base-button
data-test="cancel-button"
:disabled="loading"
@click="$router.back()"
danger
>
{{ $t('actions.cancel') }}
</base-button>
</ds-flex-item>
<ds-flex-item style="align-self: flex-end">
<base-button type="submit" icon="check" :loading="loading" :disabled="errors" filled>
{{ $t('actions.save') }}
</base-button>
</ds-flex-item>
</ds-flex>
</base-card> </base-card>
</template> </template>
</ds-form> </ds-form>
@ -80,7 +99,7 @@
<script> <script>
import gql from 'graphql-tag' import gql from 'graphql-tag'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import HcEditor from '~/components/Editor/Editor' import Editor from '~/components/Editor/Editor'
import PostMutations from '~/graphql/PostMutations.js' import PostMutations from '~/graphql/PostMutations.js'
import CategoriesSelect from '~/components/CategoriesSelect/CategoriesSelect' import CategoriesSelect from '~/components/CategoriesSelect/CategoriesSelect'
import ImageUploader from '~/components/Uploader/ImageUploader' import ImageUploader from '~/components/Uploader/ImageUploader'
@ -89,7 +108,7 @@ import PageParamsLink from '~/components/_new/features/PageParamsLink/PageParams
export default { export default {
components: { components: {
HcEditor, Editor,
ImageUploader, ImageUploader,
PageParamsLink, PageParamsLink,
CategoriesSelect, CategoriesSelect,
@ -99,8 +118,8 @@ export default {
type: Object, type: Object,
default: () => ({}), default: () => ({}),
}, },
groupId: { group: {
type: String, type: Object,
default: () => null, default: () => null,
}, },
}, },
@ -152,6 +171,12 @@ export default {
contentLength() { contentLength() {
return this.$filters.removeHtml(this.formData.content).length return this.$filters.removeHtml(this.formData.content).length
}, },
groupId() {
return this.group && this.group.id
},
groupName() {
return this.group && this.group.name
},
}, },
methods: { methods: {
submit() { submit() {
@ -284,8 +309,9 @@ export default {
align-self: flex-end; align-self: flex-end;
} }
> .buttons { > .buttons-footer {
align-self: flex-end; align-self: flex-end;
width: 85%;
margin-top: $space-base; margin-top: $space-base;
} }
@ -297,5 +323,10 @@ export default {
display: block; display: block;
} }
} }
.info-text {
display: inline;
vertical-align: middle;
}
} }
</style> </style>

View File

@ -289,7 +289,8 @@
}, },
"supportedFormats": "Füge ein Bild im Dateiformat JPG, PNG oder GIF ein" "supportedFormats": "Füge ein Bild im Dateiformat JPG, PNG oder GIF ein"
}, },
"title": "Titel" "title": "Titel",
"visibleOnlyForMembersOfGroup": "Dieser Beitrag wird nur für Mitglieder der Gruppe „<b>{name}</b>“ sichtbar sein."
}, },
"delete": { "delete": {
"cancel": "Abbrechen", "cancel": "Abbrechen",

View File

@ -289,7 +289,8 @@
}, },
"supportedFormats": "Insert a picture of file format JPG, PNG or GIF" "supportedFormats": "Insert a picture of file format JPG, PNG or GIF"
}, },
"title": "Title" "title": "Title",
"visibleOnlyForMembersOfGroup": "This post will only be visible to members of the “<b>{name}</b>” group."
}, },
"delete": { "delete": {
"cancel": "Cancel", "cancel": "Cancel",

View File

@ -9,7 +9,7 @@
<ds-space margin="large" /> <ds-space margin="large" />
<ds-flex :width="{ base: '100%' }" gutter="base"> <ds-flex :width="{ base: '100%' }" gutter="base">
<ds-flex-item :width="{ base: '100%', md: 5 }"> <ds-flex-item :width="{ base: '100%', md: 5 }">
<contribution-form :groupId="groupId" /> <contribution-form :group="group" />
</ds-flex-item> </ds-flex-item>
<ds-flex-item :width="{ base: '100%', md: 1 }">&nbsp;</ds-flex-item> <ds-flex-item :width="{ base: '100%', md: 1 }">&nbsp;</ds-flex-item>
</ds-flex> </ds-flex>

View File

@ -9,7 +9,7 @@
<ds-space margin="large" /> <ds-space margin="large" />
<ds-flex :width="{ base: '100%' }" gutter="base"> <ds-flex :width="{ base: '100%' }" gutter="base">
<ds-flex-item :width="{ base: '100%', md: 3 }"> <ds-flex-item :width="{ base: '100%', md: 3 }">
<contribution-form :contribution="contribution" /> <contribution-form :contribution="contribution" :group="contribution.group" />
</ds-flex-item> </ds-flex-item>
<ds-flex-item :width="{ base: '100%', md: 1 }">&nbsp;</ds-flex-item> <ds-flex-item :width="{ base: '100%', md: 1 }">&nbsp;</ds-flex-item>
</ds-flex> </ds-flex>