This commit is contained in:
syuilo 2018-05-29 01:44:15 +09:00
parent 016386b350
commit 8f79f862b9
4 changed files with 70 additions and 13 deletions

View file

@ -39,6 +39,13 @@ common:
confused: "こまこまのこまり" confused: "こまこまのこまり"
pudding: "Pudding" pudding: "Pudding"
note-placeholders:
a: "今どうしてる?"
b: "何かありましたか?"
c: "言いたいことは?"
d: "ここに書いてください"
e: "あなたが書くのを待っています..."
delete: "削除" delete: "削除"
loading: "読み込み中" loading: "読み込み中"
ok: "わかった" ok: "わかった"
@ -393,10 +400,9 @@ desktop/views/components/notifications.vue:
empty: "ありません!" empty: "ありません!"
desktop/views/components/post-form.vue: desktop/views/components/post-form.vue:
note-placeholder: "いまどうしてる?"
reply-placeholder: "この投稿への返信..." reply-placeholder: "この投稿への返信..."
quote-placeholder: "この投稿を引用..." quote-placeholder: "この投稿を引用..."
note: "投稿" submit: "投稿"
reply: "返信" reply: "返信"
renote: "Renote" renote: "Renote"
posted: "投稿しました!" posted: "投稿しました!"
@ -718,7 +724,6 @@ desktop/views/widgets/polls.vue:
desktop/views/widgets/post-form.vue: desktop/views/widgets/post-form.vue:
title: "投稿" title: "投稿"
note: "投稿" note: "投稿"
placeholder: "いまどうしてる?"
desktop/views/widgets/profile.vue: desktop/views/widgets/profile.vue:
update-banner: "クリックでバナー編集" update-banner: "クリックでバナー編集"
@ -819,7 +824,6 @@ mobile/views/components/post-form.vue:
renote: "Renote" renote: "Renote"
renote-placeholder: "この投稿を引用... (オプション)" renote-placeholder: "この投稿を引用... (オプション)"
reply-placeholder: "この投稿への返信..." reply-placeholder: "この投稿への返信..."
note-placeholder: "いまどうしてる?"
cw-placeholder: "内容への注釈 (オプション)" cw-placeholder: "内容への注釈 (オプション)"
location-alert: "お使いの端末は位置情報に対応していません" location-alert: "お使いの端末は位置情報に対応していません"
error: "エラー" error: "エラー"

View file

@ -86,11 +86,19 @@ export default Vue.extend({
}, },
placeholder(): string { placeholder(): string {
const x = [
'%i18n:common.note-placeholders.a%',
'%i18n:common.note-placeholders.b%',
'%i18n:common.note-placeholders.c%',
'%i18n:common.note-placeholders.d%',
'%i18n:common.note-placeholders.e%'
][Math.floor(Math.random() * 5)];
return this.renote return this.renote
? '%i18n:@quote-placeholder%' ? '%i18n:@quote-placeholder%'
: this.reply : this.reply
? '%i18n:@reply-placeholder%' ? '%i18n:@reply-placeholder%'
: '%i18n:@note-placeholder%'; : x;
}, },
submitText(): string { submitText(): string {
@ -98,7 +106,7 @@ export default Vue.extend({
? '%i18n:@renote%' ? '%i18n:@renote%'
: this.reply : this.reply
? '%i18n:@reply%' ? '%i18n:@reply%'
: '%i18n:@note%'; : '%i18n:@submit%';
}, },
canPost(): boolean { canPost(): boolean {

View file

@ -3,7 +3,7 @@
<template v-if="props.design == 0"> <template v-if="props.design == 0">
<p class="title">%fa:pencil-alt%%i18n:@title%</p> <p class="title">%fa:pencil-alt%%i18n:@title%</p>
</template> </template>
<textarea :disabled="posting" v-model="text" @keydown="onKeydown" placeholder="%i18n:@placeholder%"></textarea> <textarea :disabled="posting" v-model="text" @keydown="onKeydown" :placeholder="placeholder"></textarea>
<button @click="post" :disabled="posting">%i18n:@note%</button> <button @click="post" :disabled="posting">%i18n:@note%</button>
</div> </div>
</template> </template>
@ -22,6 +22,17 @@ export default define({
text: '' text: ''
}; };
}, },
computed: {
placeholder(): string {
return [
'%i18n:common.note-placeholders.a%',
'%i18n:common.note-placeholders.b%',
'%i18n:common.note-placeholders.c%',
'%i18n:common.note-placeholders.d%',
'%i18n:common.note-placeholders.e%'
][Math.floor(Math.random() * 5)];
}
},
methods: { methods: {
func() { func() {
if (this.props.design == 1) { if (this.props.design == 1) {

View file

@ -5,11 +5,7 @@
<div> <div>
<span class="text-count" :class="{ over: text.length > 1000 }">{{ 1000 - text.length }}</span> <span class="text-count" :class="{ over: text.length > 1000 }">{{ 1000 - text.length }}</span>
<span class="geo" v-if="geo">%fa:map-marker-alt%</span> <span class="geo" v-if="geo">%fa:map-marker-alt%</span>
<button class="submit" :disabled="posting" @click="post"> <button class="submit" :disabled="posting" @click="post">{{ submitText }}</button>
<template v-if="reply">%i18n:@reply%</template>
<template v-else-if="renote">%i18n:@renote%</template>
<template v-else>%i18n:@submit%</template>
</button>
</div> </div>
</header> </header>
<div class="form"> <div class="form">
@ -20,7 +16,7 @@
<a @click="addVisibleUser">+%i18n:@add-visible-user%</a> <a @click="addVisibleUser">+%i18n:@add-visible-user%</a>
</div> </div>
<input v-show="useCw" v-model="cw" placeholder="%i18n:@cw-placeholder%"> <input v-show="useCw" v-model="cw" placeholder="%i18n:@cw-placeholder%">
<textarea v-model="text" ref="text" :disabled="posting" :placeholder="reply ? '%i18n:@reply-placeholder%' : renote ? '%i18n:@renote-placeholder%' : '%i18n:@note-placeholder%'"></textarea> <textarea v-model="text" ref="text" :disabled="posting" :placeholder="placeholder"></textarea>
<div class="attaches" v-show="files.length != 0"> <div class="attaches" v-show="files.length != 0">
<x-draggable class="files" :list="files" :options="{ animation: 150 }"> <x-draggable class="files" :list="files" :options="{ animation: 150 }">
<div class="file" v-for="file in files" :key="file.id"> <div class="file" v-for="file in files" :key="file.id">
@ -74,6 +70,44 @@ export default Vue.extend({
}; };
}, },
computed: {
draftId(): string {
return this.renote
? 'renote:' + this.renote.id
: this.reply
? 'reply:' + this.reply.id
: 'note';
},
placeholder(): string {
const x = [
'%i18n:common.note-placeholders.a%',
'%i18n:common.note-placeholders.b%',
'%i18n:common.note-placeholders.c%',
'%i18n:common.note-placeholders.d%',
'%i18n:common.note-placeholders.e%'
][Math.floor(Math.random() * 5)];
return this.renote
? '%i18n:@quote-placeholder%'
: this.reply
? '%i18n:@reply-placeholder%'
: x;
},
submitText(): string {
return this.renote
? '%i18n:@renote%'
: this.reply
? '%i18n:@reply%'
: '%i18n:@submit%';
},
canPost(): boolean {
return !this.posting && (this.text.length != 0 || this.files.length != 0 || this.poll || this.renote);
}
},
mounted() { mounted() {
if (this.reply && this.reply.user.host != null) { if (this.reply && this.reply.user.host != null) {
this.text = `@${this.reply.user.username}@${this.reply.user.host} `; this.text = `@${this.reply.user.username}@${this.reply.user.host} `;