From f5c088dc1a7ef1df935b15cc310378c1a2686087 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Fri, 4 Oct 2019 00:45:21 +0300 Subject: [PATCH] Add ability to display media attachments, polls and statuses with hidden content --- src/views/status/Status.vue | 169 ++++++++++++++++++++++++------------ src/views/users/show.vue | 34 ++------ 2 files changed, 118 insertions(+), 85 deletions(-) diff --git a/src/views/status/Status.vue b/src/views/status/Status.vue index 74bb3881..e79b5a80 100644 --- a/src/views/status/Status.vue +++ b/src/views/status/Status.vue @@ -54,7 +54,40 @@
- +
+ {{ status.spoiler_text }} + Show more + Show less +
+ +
+
    +
  • + {{ option.title }} + +
  • +
+
+
+ +
+
+ +
+
+ +
+
    +
  • + {{ option.title }} + +
  • +
+
+
+ +
+
@@ -66,13 +99,18 @@ import moment from 'moment' export default { - name: 'Statuses', + name: 'Status', props: { status: { type: Object, required: true } }, + data() { + return { + showHiddenStatus: false + } + }, methods: { capitalizeFirstLetter(str) { return str.charAt(0).toUpperCase() + str.slice(1) @@ -98,6 +136,13 @@ export default { }) }) }, + optionPercent(poll, pollOption) { + const allVotes = poll.options.reduce((acc, option) => (acc + option.votes_count), 0) + if (allVotes === 0) { + return 0 + } + return +(pollOption.votes_count / allVotes * 100).toFixed(1) + }, parseTimestamp(timestamp) { return moment(timestamp).format('YYYY-MM-DD HH:mm') } @@ -106,66 +151,78 @@ export default { diff --git a/src/views/users/show.vue b/src/views/users/show.vue index 049ae02f..829f7ebd 100644 --- a/src/views/users/show.vue +++ b/src/views/users/show.vue @@ -70,22 +70,8 @@ - - - {{ status.spoiler_text }} -

-

-
    -
  • - {{ option.title }} - -
  • -
-
-
- -
-
+ +
@@ -94,8 +80,11 @@