commit d95406c4078e4cdc37862ebcb67688529720b48c
parent dbbe307a03fc795c8ec7834dcc3a81cfe1df424b
Author: St John Karp <stjohn@fuzzjunket.com>
Date: Sun, 19 Aug 2018 10:30:15 -0700
Hide statuses if they have spoiler text
Hide statuses behind an HTML details element if they have
spoiler text.
Diffstat:
2 files changed, 28 insertions(+), 17 deletions(-)
diff --git a/resources/views/status.blade.php b/resources/views/status.blade.php
@@ -18,24 +18,15 @@
@endif
{{ $created_at->diffForHumans(null, false, true) }}
</time>
- @if ($status['reblog'] === null)
- <p>{!! $status['content'] !!}</p>
- @foreach ($status['media_attachments'] as $attachment)
- @if ($attachment['type'] === 'image')
- <p>
- <img
- src="{{
- $attachment['remote_url'] === null
- ? $attachment['url']
- : $attachment['remote_url']
- }}"
- alt="{{ $attachment['description'] }}"
- />
- </p>
- @endif
- @endforeach
+ @if ($status['spoiler_text'] !== '')
+ <details>
+ <summary>{{ $status['spoiler_text'] }}</summary>
+
+ @component('status_content', ['status' => $status])
+ @endcomponent
+ </details>
@else
- @component('status', ['status' => $status['reblog']])
+ @component('status_content', ['status' => $status])
@endcomponent
@endif
diff --git a/resources/views/status_content.blade.php b/resources/views/status_content.blade.php
@@ -0,0 +1,20 @@
+@if ($status['reblog'] === null)
+ <p>{!! $status['content'] !!}</p>
+ @foreach ($status['media_attachments'] as $attachment)
+ @if ($attachment['type'] === 'image')
+ <p>
+ <img
+ src="{{
+ $attachment['remote_url'] === null
+ ? $attachment['url']
+ : $attachment['remote_url']
+ }}"
+ alt="{{ $attachment['description'] }}"
+ />
+ </p>
+ @endif
+ @endforeach
+@else
+ @component('status', ['status' => $status['reblog']])
+ @endcomponent
+@endif