summaryrefslogtreecommitdiff
path: root/src/client/app
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-12-08 10:36:26 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-12-08 10:36:26 +0900
commit596f92cfccdc3f7877ac16e5ddfb3dc489eb5fc2 (patch)
tree7e2262ec1da66fd28676bdd9f21e05ff03281ae7 /src/client/app
parentAdd comment (diff)
downloadsharkey-596f92cfccdc3f7877ac16e5ddfb3dc489eb5fc2.tar.gz
sharkey-596f92cfccdc3f7877ac16e5ddfb3dc489eb5fc2.tar.bz2
sharkey-596f92cfccdc3f7877ac16e5ddfb3dc489eb5fc2.zip
[Client] Improve cw-button
Diffstat (limited to 'src/client/app')
-rw-r--r--src/client/app/common/views/components/cw-button.vue25
-rw-r--r--src/client/app/desktop/views/components/note-detail.vue2
-rw-r--r--src/client/app/desktop/views/components/note-preview.vue2
-rw-r--r--src/client/app/desktop/views/components/note.sub.vue2
-rw-r--r--src/client/app/desktop/views/components/note.vue2
-rw-r--r--src/client/app/mobile/views/components/note-detail.vue2
-rw-r--r--src/client/app/mobile/views/components/note-preview.vue2
-rw-r--r--src/client/app/mobile/views/components/note.sub.vue2
-rw-r--r--src/client/app/mobile/views/components/note.vue2
9 files changed, 32 insertions, 9 deletions
diff --git a/src/client/app/common/views/components/cw-button.vue b/src/client/app/common/views/components/cw-button.vue
index bda39f2d48..034848a116 100644
--- a/src/client/app/common/views/components/cw-button.vue
+++ b/src/client/app/common/views/components/cw-button.vue
@@ -1,21 +1,36 @@
<template>
-<button class="nrvgflfuaxwgkxoynpnumyookecqrrvh" @click="toggle">{{ value ? this.$t('hide') : this.$t('show') }}</button>
+<button class="nrvgflfuaxwgkxoynpnumyookecqrrvh" @click="toggle">
+ <b>{{ value ? this.$t('hide') : this.$t('show') }}</b>
+ <span v-if="!value">
+ <span v-if="note.text">{{ this.$t('chars', { count: length(note.text) }) | number }}</span>
+ <span v-if="note.text && note.files && note.files.length > 0"> / </span>
+ <span v-if="note.files && note.files.length > 0">{{ this.$t('files', { count: note.files.length }) }}</span>
+ </span>
+</button>
</template>
<script lang="ts">
import Vue from 'vue';
import i18n from '../../../i18n';
+import { length } from 'stringz';
export default Vue.extend({
i18n: i18n('common/views/components/cw-button.vue'),
+
props: {
value: {
type: Boolean,
required: true
+ },
+ note: {
+ type: Object,
+ required: true
}
},
methods: {
+ length,
+
toggle() {
this.$emit('input', !this.value);
}
@@ -37,4 +52,12 @@ export default Vue.extend({
&:hover
background var(--cwButtonHoverBg)
+ > span
+ margin-left 4px
+
+ &:before
+ content '('
+ &:after
+ content ')'
+
</style>
diff --git a/src/client/app/desktop/views/components/note-detail.vue b/src/client/app/desktop/views/components/note-detail.vue
index 5610c601aa..bb30cd6a20 100644
--- a/src/client/app/desktop/views/components/note-detail.vue
+++ b/src/client/app/desktop/views/components/note-detail.vue
@@ -42,7 +42,7 @@
<div class="body">
<p v-if="appearNote.cw != null" class="cw">
<misskey-flavored-markdown v-if="appearNote.cw != ''" class="text" :text="appearNote.cw" :author="appearNote.user" :i="$store.state.i" :custom-emojis="appearNote.emojis" />
- <mk-cw-button v-model="showContent"/>
+ <mk-cw-button v-model="showContent" :note="appearNote"/>
</p>
<div class="content" v-show="appearNote.cw == null || showContent">
<div class="text">
diff --git a/src/client/app/desktop/views/components/note-preview.vue b/src/client/app/desktop/views/components/note-preview.vue
index ee4068dd3e..253e1e53cf 100644
--- a/src/client/app/desktop/views/components/note-preview.vue
+++ b/src/client/app/desktop/views/components/note-preview.vue
@@ -6,7 +6,7 @@
<div class="body">
<p v-if="note.cw != null" class="cw">
<misskey-flavored-markdown v-if="note.cw != ''" class="text" :text="note.cw" :author="note.user" :i="$store.state.i" :custom-emojis="note.emojis" />
- <mk-cw-button v-model="showContent"/>
+ <mk-cw-button v-model="showContent" :note="note"/>
</p>
<div class="content" v-show="note.cw == null || showContent">
<mk-sub-note-content class="text" :note="note"/>
diff --git a/src/client/app/desktop/views/components/note.sub.vue b/src/client/app/desktop/views/components/note.sub.vue
index 05059f2003..8a31b843b1 100644
--- a/src/client/app/desktop/views/components/note.sub.vue
+++ b/src/client/app/desktop/views/components/note.sub.vue
@@ -6,7 +6,7 @@
<div class="body">
<p v-if="note.cw != null" class="cw">
<misskey-flavored-markdown v-if="note.cw != ''" class="text" :text="note.cw" :author="note.user" :i="$store.state.i" :custom-emojis="note.emojis" />
- <mk-cw-button v-model="showContent"/>
+ <mk-cw-button v-model="showContent" :note="note"/>
</p>
<div class="content" v-show="note.cw == null || showContent">
<mk-sub-note-content class="text" :note="note"/>
diff --git a/src/client/app/desktop/views/components/note.vue b/src/client/app/desktop/views/components/note.vue
index aa201d1854..880d9f8d91 100644
--- a/src/client/app/desktop/views/components/note.vue
+++ b/src/client/app/desktop/views/components/note.vue
@@ -21,7 +21,7 @@
<div class="body" v-if="appearNote.deletedAt == null">
<p v-if="appearNote.cw != null" class="cw">
<misskey-flavored-markdown v-if="appearNote.cw != ''" class="text" :text="appearNote.cw" :author="appearNote.user" :i="$store.state.i" :custom-emojis="appearNote.emojis" />
- <mk-cw-button v-model="showContent"/>
+ <mk-cw-button v-model="showContent" :note="appearNote"/>
</p>
<div class="content" v-show="appearNote.cw == null || showContent">
<div class="text">
diff --git a/src/client/app/mobile/views/components/note-detail.vue b/src/client/app/mobile/views/components/note-detail.vue
index 330684f019..4b062c8f14 100644
--- a/src/client/app/mobile/views/components/note-detail.vue
+++ b/src/client/app/mobile/views/components/note-detail.vue
@@ -27,7 +27,7 @@
<div class="body">
<p v-if="appearNote.cw != null" class="cw">
<misskey-flavored-markdown v-if="appearNote.cw != ''" class="text" :text="appearNote.cw" :author="appearNote.user" :i="$store.state.i" :custom-emojis="appearNote.emojis" />
- <mk-cw-button v-model="showContent"/>
+ <mk-cw-button v-model="showContent" :note="appearNote"/>
</p>
<div class="content" v-show="appearNote.cw == null || showContent">
<div class="text">
diff --git a/src/client/app/mobile/views/components/note-preview.vue b/src/client/app/mobile/views/components/note-preview.vue
index 525f54998e..448d9bc592 100644
--- a/src/client/app/mobile/views/components/note-preview.vue
+++ b/src/client/app/mobile/views/components/note-preview.vue
@@ -6,7 +6,7 @@
<div class="body">
<p v-if="note.cw != null" class="cw">
<span class="text" v-if="note.cw != ''">{{ note.cw }}</span>
- <mk-cw-button v-model="showContent"/>
+ <mk-cw-button v-model="showContent" :note="note"/>
</p>
<div class="content" v-show="note.cw == null || showContent">
<mk-sub-note-content class="text" :note="note"/>
diff --git a/src/client/app/mobile/views/components/note.sub.vue b/src/client/app/mobile/views/components/note.sub.vue
index 37d2879ea3..83ac1c5428 100644
--- a/src/client/app/mobile/views/components/note.sub.vue
+++ b/src/client/app/mobile/views/components/note.sub.vue
@@ -6,7 +6,7 @@
<div class="body">
<p v-if="note.cw != null" class="cw">
<misskey-flavored-markdown v-if="note.cw != ''" class="text" :text="note.cw" :author="note.user" :i="$store.state.i" :custom-emojis="note.emojis" />
- <mk-cw-button v-model="showContent"/>
+ <mk-cw-button v-model="showContent" :note="note"/>
</p>
<div class="content" v-show="note.cw == null || showContent">
<mk-sub-note-content class="text" :note="note"/>
diff --git a/src/client/app/mobile/views/components/note.vue b/src/client/app/mobile/views/components/note.vue
index f9179cd934..1815cff4f3 100644
--- a/src/client/app/mobile/views/components/note.vue
+++ b/src/client/app/mobile/views/components/note.vue
@@ -17,7 +17,7 @@
<div class="body" v-if="appearNote.deletedAt == null">
<p v-if="appearNote.cw != null" class="cw">
<misskey-flavored-markdown v-if="appearNote.cw != ''" class="text" :text="appearNote.cw" :author="appearNote.user" :i="$store.state.i" :custom-emojis="appearNote.emojis" />
- <mk-cw-button v-model="showContent"/>
+ <mk-cw-button v-model="showContent" :note="appearNote"/>
</p>
<div class="content" v-show="appearNote.cw == null || showContent">
<div class="text">