mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-29 09:43:16 +00:00
Update status embed, allow photo albums. Fixes #2374
This commit is contained in:
parent
3b7ff030f2
commit
d11fac0dfb
2 changed files with 30 additions and 30 deletions
|
@ -68,7 +68,8 @@ class StatusController extends Controller
|
||||||
|
|
||||||
public function shortcodeRedirect(Request $request, $id)
|
public function shortcodeRedirect(Request $request, $id)
|
||||||
{
|
{
|
||||||
if(strlen($id) < 5 || !Auth::check()) {
|
abort_if(strlen($id) < 5, 404);
|
||||||
|
if(!Auth::check()) {
|
||||||
return redirect('/login?next='.urlencode('/' . $request->path()));
|
return redirect('/login?next='.urlencode('/' . $request->path()));
|
||||||
}
|
}
|
||||||
$id = HashidService::decode($id);
|
$id = HashidService::decode($id);
|
||||||
|
@ -99,7 +100,7 @@ class StatusController extends Controller
|
||||||
->whereNull('uri')
|
->whereNull('uri')
|
||||||
->whereScope('public')
|
->whereScope('public')
|
||||||
->whereIsNsfw(false)
|
->whereIsNsfw(false)
|
||||||
->whereIn('type', ['photo', 'video'])
|
->whereIn('type', ['photo', 'video','photo:album'])
|
||||||
->find($id);
|
->find($id);
|
||||||
if(!$status) {
|
if(!$status) {
|
||||||
$content = view('status.embed-removed');
|
$content = view('status.embed-removed');
|
||||||
|
|
|
@ -63,36 +63,32 @@
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@break
|
@break
|
||||||
@case('album')
|
@case('photo:album')
|
||||||
@if($status->is_nsfw)
|
<div id="photo-carousel-wrapper-{{$status->id}}" class="carousel slide carousel-fade mb-n3 " data-ride="carousel">
|
||||||
|
<ol class="carousel-indicators">
|
||||||
@else
|
@for($i = 0; $i < $status->media_count; $i++)
|
||||||
<div id="photo-carousel-wrapper-{{$status->id}}" class="carousel slide carousel-fade" data-ride="carousel">
|
<li data-target="#photo-carousel-wrapper-{{$status->id}}" data-slide-to="{{$i}}" class="{{$i == 0 ? 'active' : ''}}"></li>
|
||||||
<ol class="carousel-indicators">
|
@endfor
|
||||||
@for($i = 0; $i < $status->media_count; $i++)
|
</ol>
|
||||||
<li data-target="#photo-carousel-wrapper-{{$status->id}}" data-slide-to="{{$i}}" class="{{$i == 0 ? 'active' : ''}}"></li>
|
<div class="carousel-inner">
|
||||||
@endfor
|
@foreach($status->media()->orderBy('order')->get() as $media)
|
||||||
</ol>
|
<div class="carousel-item {{$loop->iteration == 1 ? 'active' : ''}}">
|
||||||
<div class="carousel-inner">
|
<figure class="{{$media->filter_class}}">
|
||||||
@foreach($status->media()->orderBy('order')->get() as $media)
|
<div class="float-right mr-3 badge badge-dark border border-secondary rounded-pill p-2" style="position:absolute;top:8px;right:0;margin-bottom:-20px;">{{$loop->iteration}}/{{$loop->count}}</div>
|
||||||
<div class="carousel-item {{$loop->iteration == 1 ? 'active' : ''}}">
|
<img class="d-block w-100" src="{{$media->url()}}" alt="{{$status->caption}}">
|
||||||
<figure class="{{$media->filter_class}}">
|
</figure>
|
||||||
<span class="float-right mr-3 badge badge-dark" style="position:fixed;top:8px;right:0;margin-bottom:-20px;">{{$loop->iteration}}/{{$loop->count}}</span>
|
|
||||||
<img class="d-block w-100" src="{{$media->url()}}" alt="{{$status->caption}}">
|
|
||||||
</figure>
|
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
</div>
|
||||||
<a class="carousel-control-prev" href="#photo-carousel-wrapper-{{$status->id}}" role="button" data-slide="prev">
|
@endforeach
|
||||||
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
|
|
||||||
<span class="sr-only">Previous</span>
|
|
||||||
</a>
|
|
||||||
<a class="carousel-control-next" href="#photo-carousel-wrapper-{{$status->id}}" role="button" data-slide="next">
|
|
||||||
<span class="carousel-control-next-icon" aria-hidden="true"></span>
|
|
||||||
<span class="sr-only">Next</span>
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
@endif
|
<a class="carousel-control-prev" href="#photo-carousel-wrapper-{{$status->id}}" role="button" data-slide="prev">
|
||||||
|
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
|
||||||
|
<span class="sr-only">Previous</span>
|
||||||
|
</a>
|
||||||
|
<a class="carousel-control-next" href="#photo-carousel-wrapper-{{$status->id}}" role="button" data-slide="next">
|
||||||
|
<span class="carousel-control-next-icon" aria-hidden="true"></span>
|
||||||
|
<span class="sr-only">Next</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
@break
|
@break
|
||||||
@case('video')
|
@case('video')
|
||||||
@if($status->is_nsfw)
|
@if($status->is_nsfw)
|
||||||
|
@ -174,5 +170,8 @@
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">window.addEventListener("message",e=>{const t=e.data||{};window.parent&&"setHeight"===t.type&&window.parent.postMessage({type:"setHeight",id:t.id,height:document.getElementsByTagName("html")[0].scrollHeight},"*")});</script>
|
<script type="text/javascript">window.addEventListener("message",e=>{const t=e.data||{};window.parent&&"setHeight"===t.type&&window.parent.postMessage({type:"setHeight",id:t.id,height:document.getElementsByTagName("html")[0].scrollHeight},"*")});</script>
|
||||||
<script type="text/javascript">document.querySelectorAll('.caption-container a').forEach(function(i) {i.setAttribute('target', '_blank');});</script>
|
<script type="text/javascript">document.querySelectorAll('.caption-container a').forEach(function(i) {i.setAttribute('target', '_blank');});</script>
|
||||||
|
<script type="text/javascript" src="{{ mix('js/manifest.js') }}"></script>
|
||||||
|
<script type="text/javascript" src="{{ mix('js/vendor.js') }}"></script>
|
||||||
|
<script type="text/javascript" src="{{ mix('js/app.js') }}"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue