commit: b0f248c48384c888faef8fcf76ee8b3f8abfde8e
parent: 25edb8675dc5def9b2619fa7f958e67d7a90e0eb
Author: lambda <pleromagit@rogerbraun.net>
Date: Fri, 9 Feb 2018 16:13:16 +0000
Merge branch 'feature/post-length-indicator' into 'develop'
Add an indicator for characters left before hitting the limit
See merge request pleroma/pleroma-fe!205
Diffstat:
4 files changed, 32 insertions(+), 5 deletions(-)
diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js
@@ -94,6 +94,18 @@ const PostStatusForm = {
},
customEmoji () {
return this.$store.state.config.customEmoji || []
+ },
+ statusLength () {
+ return this.newStatus.status.length
+ },
+ statusLengthLimit () {
+ return this.$store.state.config.textlimit
+ },
+ hasStatusLengthLimit () {
+ return this.statusLengthLimit > 0
+ },
+ charactersLeft () {
+ return this.statusLengthLimit - this.statusLength
}
},
methods: {
diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue
@@ -18,6 +18,9 @@
</div>
<div class='form-bottom'>
<media-upload @uploading="disableSubmit" @uploaded="addMediaFile" @upload-failed="enableSubmit" :drop-files="dropFiles"></media-upload>
+
+ <p v-if="hasStatusLengthLimit" class="base04">{{ charactersLeft }}</p>
+
<button v-if="posting" disabled class="btn btn-default base05 base02-background">{{$t('post_status.posting')}}</button>
<button v-else :disabled="submitDisabled" type="submit" class="btn btn-default base05 base02-background">{{$t('general.submit')}}</button>
</div>
@@ -67,6 +70,12 @@
button {
width: 10em;
}
+
+ p {
+ margin: 0.35em;
+ padding: 0.35em;
+ display: flex;
+ }
}
.error {
border-radius: 5px;
diff --git a/src/main.js b/src/main.js
@@ -75,15 +75,23 @@ const i18n = new VueI18n({
messages
})
-window.fetch('/static/config.json')
+window.fetch('/api/statusnet/config.json')
.then((res) => res.json())
.then((data) => {
- const {name, theme, background, logo, registrationOpen} = data
+ const {name, closed: registrationClosed, textlimit} = data.site
+
store.dispatch('setOption', { name: 'name', value: name })
+ store.dispatch('setOption', { name: 'registrationOpen', value: (registrationClosed === '0') })
+ store.dispatch('setOption', { name: 'textlimit', value: parseInt(textlimit) })
+ })
+
+window.fetch('/static/config.json')
+ .then((res) => res.json())
+ .then((data) => {
+ const {theme, background, logo} = data
store.dispatch('setOption', { name: 'theme', value: theme })
store.dispatch('setOption', { name: 'background', value: background })
store.dispatch('setOption', { name: 'logo', value: logo })
- store.dispatch('setOption', { name: 'registrationOpen', value: registrationOpen })
if (data['chatDisabled']) {
store.dispatch('disableChat')
}
diff --git a/static/config.json b/static/config.json
@@ -1,9 +1,7 @@
{
- "name": "Pleroma FE",
"theme": "pleroma-dark",
"background": "/static/bg.jpg",
"logo": "/static/logo.png",
- "registrationOpen": false,
"defaultPath": "/main/all",
"chatDisabled": false
}