From e2248bcf4fc57b7dbac9585a41b0578201394d88 Mon Sep 17 00:00:00 2001 From: dtluna Date: Fri, 9 Feb 2018 16:02:26 +0300 Subject: [PATCH 1/4] Use `name` and `closed` from the backend --- src/main.js | 13 ++++++++++--- static/config.json | 2 -- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main.js b/src/main.js index a14ca7c8..8d598d78 100644 --- a/src/main.js +++ b/src/main.js @@ -75,15 +75,22 @@ const i18n = new VueI18n({ messages }) +window.fetch('/api/statusnet/config.json') + .then((res) => res.json()) + .then((data) => { + const {name, closed: registrationClosed, textlimit} = data + store.dispatch('setOption', { name: 'name', value: name }) + store.dispatch('setOption', { name: 'registrationOpen', value: !registrationClosed }) + store.dispatch('setOption', { name: 'textlimit', value: parseInt(textlimit) }) + }) + window.fetch('/static/config.json') .then((res) => res.json()) .then((data) => { - const {name, theme, background, logo, registrationOpen} = data - store.dispatch('setOption', { name: 'name', value: name }) + 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 index 880efca8..8e4b21ca 100644 --- 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 } From e49cf7b67a3d1532ff19091697c4d2487e14d257 Mon Sep 17 00:00:00 2001 From: dtluna Date: Fri, 9 Feb 2018 16:37:32 +0300 Subject: [PATCH 2/4] Add textlimit --- src/main.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.js b/src/main.js index 8d598d78..7fb9a047 100644 --- a/src/main.js +++ b/src/main.js @@ -78,9 +78,10 @@ const i18n = new VueI18n({ window.fetch('/api/statusnet/config.json') .then((res) => res.json()) .then((data) => { - const {name, closed: registrationClosed, textlimit} = data + const {name, closed: registrationClosed, textlimit} = data.site + store.dispatch('setOption', { name: 'name', value: name }) - store.dispatch('setOption', { name: 'registrationOpen', value: !registrationClosed }) + store.dispatch('setOption', { name: 'registrationOpen', value: (registrationClosed === '0') }) store.dispatch('setOption', { name: 'textlimit', value: parseInt(textlimit) }) }) From 6c424c355c7faa70c84614b9c518ee116b42dd53 Mon Sep 17 00:00:00 2001 From: dtluna Date: Fri, 9 Feb 2018 17:51:04 +0300 Subject: [PATCH 3/4] Add characters left being displayed --- src/components/post_status_form/post_status_form.js | 12 ++++++++++++ src/components/post_status_form/post_status_form.vue | 3 +++ 2 files changed, 15 insertions(+) diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 1f63de25..c1213fa9 100644 --- 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 index 8e436428..86458f0d 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -18,6 +18,9 @@
+ +

{{ charactersLeft }}

+
From dcbbd7c53e921eddf542b082a06d8eb4999550c7 Mon Sep 17 00:00:00 2001 From: dtluna Date: Fri, 9 Feb 2018 18:22:29 +0300 Subject: [PATCH 4/4] Add styles on the characters left indicator --- src/components/post_status_form/post_status_form.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 86458f0d..a759bb53 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -19,7 +19,7 @@
-

{{ charactersLeft }}

+

{{ charactersLeft }}

@@ -70,6 +70,12 @@ button { width: 10em; } + + p { + margin: 0.35em; + padding: 0.35em; + display: flex; + } } .error { border-radius: 5px;