mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Contain post/contribution form to limit width
- enforce 1.25:1 aspect ratio to be as close to possible with the 1:1 aspect ratio on our root path where we have 3 columns of 300px and a max-height of 300px
This commit is contained in:
parent
db48e522cf
commit
3beddf1f69
@ -1,73 +1,75 @@
|
|||||||
<template>
|
<template>
|
||||||
<ds-form ref="contributionForm" v-model="form" :schema="formSchema">
|
<ds-container width="medium">
|
||||||
<template slot-scope="{ errors }">
|
<ds-form ref="contributionForm" v-model="form" :schema="formSchema">
|
||||||
<hc-teaser-image :contribution="contribution" @addTeaserImage="addTeaserImage">
|
<template slot-scope="{ errors }">
|
||||||
<img
|
<hc-teaser-image :contribution="contribution" @addTeaserImage="addTeaserImage">
|
||||||
v-if="contribution"
|
<img
|
||||||
class="contribution-image"
|
v-if="contribution"
|
||||||
:src="contribution.image | proxyApiUrl"
|
class="contribution-image"
|
||||||
/>
|
:src="contribution.image | proxyApiUrl"
|
||||||
</hc-teaser-image>
|
|
||||||
<ds-card>
|
|
||||||
<ds-space />
|
|
||||||
<hc-user :user="currentUser" :trunc="35" />
|
|
||||||
<ds-space />
|
|
||||||
<ds-input model="title" class="post-title" placeholder="Title" name="title" autofocus />
|
|
||||||
<small class="smallTag">{{ form.title.length }}/{{ formSchema.title.max }}</small>
|
|
||||||
<client-only>
|
|
||||||
<hc-editor
|
|
||||||
:users="users"
|
|
||||||
:value="form.content"
|
|
||||||
:hashtags="hashtags"
|
|
||||||
@input="updateEditorContent"
|
|
||||||
/>
|
/>
|
||||||
<small class="smallTag">{{ form.contentLength }}</small>
|
</hc-teaser-image>
|
||||||
</client-only>
|
<ds-card>
|
||||||
<ds-space margin-bottom="small" />
|
<ds-space />
|
||||||
<hc-categories-select
|
<hc-user :user="currentUser" :trunc="35" />
|
||||||
model="categoryIds"
|
<ds-space />
|
||||||
@updateCategories="updateCategories"
|
<ds-input model="title" class="post-title" placeholder="Title" name="title" autofocus />
|
||||||
:existingCategoryIds="form.categoryIds"
|
<small class="smallTag">{{ form.title.length }}/{{ formSchema.title.max }}</small>
|
||||||
/>
|
<client-only>
|
||||||
<ds-flex class="contribution-form-footer">
|
<hc-editor
|
||||||
<ds-flex-item :width="{ base: '10%', sm: '10%', md: '10%', lg: '15%' }" />
|
:users="users"
|
||||||
<ds-flex-item :width="{ base: '80%', sm: '30%', md: '30%', lg: '20%' }">
|
:value="form.content"
|
||||||
<ds-space margin-bottom="small" />
|
:hashtags="hashtags"
|
||||||
<ds-select
|
@input="updateEditorContent"
|
||||||
model="language"
|
|
||||||
:options="form.languageOptions"
|
|
||||||
icon="globe"
|
|
||||||
:placeholder="locale"
|
|
||||||
:label="$t('contribution.languageSelectLabel')"
|
|
||||||
/>
|
/>
|
||||||
</ds-flex-item>
|
<small class="smallTag">{{ form.contentLength }}</small>
|
||||||
</ds-flex>
|
</client-only>
|
||||||
<ds-space />
|
<ds-space margin-bottom="small" />
|
||||||
<div slot="footer" style="text-align: right">
|
<hc-categories-select
|
||||||
<ds-button
|
model="categoryIds"
|
||||||
class="cancel-button"
|
@updateCategories="updateCategories"
|
||||||
:disabled="loading"
|
:existingCategoryIds="form.categoryIds"
|
||||||
ghost
|
/>
|
||||||
@click.prevent="$router.back()"
|
<ds-flex class="contribution-form-footer">
|
||||||
>
|
<ds-flex-item :width="{ base: '10%', sm: '10%', md: '10%', lg: '15%' }" />
|
||||||
{{ $t('actions.cancel') }}
|
<ds-flex-item :width="{ base: '80%', sm: '30%', md: '30%', lg: '20%' }">
|
||||||
</ds-button>
|
<ds-space margin-bottom="small" />
|
||||||
<ds-button
|
<ds-select
|
||||||
class="submit-button-for-test"
|
model="language"
|
||||||
type="submit"
|
:options="form.languageOptions"
|
||||||
icon="check"
|
icon="globe"
|
||||||
:loading="loading"
|
:placeholder="locale"
|
||||||
:disabled="failsValidations || errors"
|
:label="$t('contribution.languageSelectLabel')"
|
||||||
primary
|
/>
|
||||||
@click.prevent="submit"
|
</ds-flex-item>
|
||||||
>
|
</ds-flex>
|
||||||
{{ $t('actions.save') }}
|
<ds-space />
|
||||||
</ds-button>
|
<div slot="footer" style="text-align: right">
|
||||||
</div>
|
<ds-button
|
||||||
<ds-space margin-bottom="large" />
|
class="cancel-button"
|
||||||
</ds-card>
|
:disabled="loading"
|
||||||
</template>
|
ghost
|
||||||
</ds-form>
|
@click.prevent="$router.back()"
|
||||||
|
>
|
||||||
|
{{ $t('actions.cancel') }}
|
||||||
|
</ds-button>
|
||||||
|
<ds-button
|
||||||
|
class="submit-button-for-test"
|
||||||
|
type="submit"
|
||||||
|
icon="check"
|
||||||
|
:loading="loading"
|
||||||
|
:disabled="failsValidations || errors"
|
||||||
|
primary
|
||||||
|
@click.prevent="submit"
|
||||||
|
>
|
||||||
|
{{ $t('actions.save') }}
|
||||||
|
</ds-button>
|
||||||
|
</div>
|
||||||
|
<ds-space margin-bottom="large" />
|
||||||
|
</ds-card>
|
||||||
|
</template>
|
||||||
|
</ds-form>
|
||||||
|
</ds-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -262,7 +264,7 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
.smallTag {
|
.smallTag {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
@ -94,12 +94,7 @@ export default {
|
|||||||
confirm.textContent = this.$t('contribution.teaserImage.cropperConfirm')
|
confirm.textContent = this.$t('contribution.teaserImage.cropperConfirm')
|
||||||
confirm.addEventListener('click', () => {
|
confirm.addEventListener('click', () => {
|
||||||
// Get the canvas with image data from Cropper.js
|
// Get the canvas with image data from Cropper.js
|
||||||
let canvas = cropper.getCroppedCanvas({
|
let canvas = cropper.getCroppedCanvas()
|
||||||
minWidth: 256,
|
|
||||||
minHeight: 256,
|
|
||||||
maxWidth: 550,
|
|
||||||
maxHeight: 550,
|
|
||||||
})
|
|
||||||
canvas.toBlob(blob => {
|
canvas.toBlob(blob => {
|
||||||
this.$refs.el.manuallyAddFile(blob, canvas.toDataURL(), null, null, {
|
this.$refs.el.manuallyAddFile(blob, canvas.toDataURL(), null, null, {
|
||||||
dontSubstractMaxFiles: false,
|
dontSubstractMaxFiles: false,
|
||||||
@ -121,7 +116,7 @@ export default {
|
|||||||
image.src = URL.createObjectURL(file)
|
image.src = URL.createObjectURL(file)
|
||||||
editor.appendChild(image)
|
editor.appendChild(image)
|
||||||
// Create Cropper.js and pass image
|
// Create Cropper.js and pass image
|
||||||
let cropper = new Cropper(image, { aspectRatio: 16 / 9 })
|
let cropper = new Cropper(image, { aspectRatio: 1.25 / 1 })
|
||||||
},
|
},
|
||||||
dropzoneDrop() {
|
dropzoneDrop() {
|
||||||
let cropOverlay = document.querySelectorAll('.crop-overlay')[0]
|
let cropOverlay = document.querySelectorAll('.crop-overlay')[0]
|
||||||
@ -213,11 +208,11 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.contribution-image {
|
.contribution-image {
|
||||||
max-height: 471px;
|
max-height: 620px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.crop-overlay {
|
.crop-overlay {
|
||||||
max-height: 471px;
|
max-height: 620px;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
// height: 100%;
|
// height: 100%;
|
||||||
@ -232,6 +227,6 @@ export default {
|
|||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
}
|
}
|
||||||
.thumbnail-preview {
|
.thumbnail-preview {
|
||||||
max-height: 471px;
|
max-height: 620px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user