File size: 4.29Kb
@extends('layout')
@section('title')
Галерея (Стр. {{ $page->current }})
@stop
@section('content')
<h1>Галерея</h1>
<nav>
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/"><i class="fas fa-home"></i></a></li>
<li class="breadcrumb-item active">Галерея</li>
@if (isAdmin())
<li class="breadcrumb-item"><a href="/admin/photos?page={{ $page->current }}">Управление</a></li>
@endif
</ol>
</nav>
<div class="photos-top">
@if (getUser())
<span> Мои:
<a href="/photos/albums/{{ getUser('login') }}">фото</a>
<a href="/photos/comments/{{ getUser('login') }}">комментарии</a>
@endif
</span>
<span> Все:
<a href="/photos/albums">альбомы</a>
<a href="/photos/comments">комментарии</a>
<a href="/photos/top">Топ фото</a>
</span>
</div>
@if (getUser())
<div class="dob">
<a class="btn btn-success" href="/photos/create">Добавить фото</a><br>
</div>
@endif
@if ($photos->isNotEmpty())
@foreach ($photos as $photo)
<div class="gallery-block">
<div class="gallery-block-nav">
<a class="gallery-block-link" href="/photos/{{ $photo->id }}"><i class="fa fa-image"></i>{{ $photo->title }}
<span>{!! formatNum($photo->rating) !!}</span></a>
</div>
<div>
<?php $countFiles = $photo->files->count() ?>
<div class="gallery-photos">
<div id="myCarousel{{ $loop->iteration }}" class="carousel slide" data-ride="carousel">
@if ($countFiles > 1)
<ol class="carousel-indicators">
@for ($i = 0; $i < $countFiles; $i++)
<li data-target="#myCarousel{{ $loop->iteration }}" data-slide-to="{{ $i }}"{{ empty($i) ? ' class="active"' : '' }}></li>
@endfor
</ol>
@endif
<div class="carousel-inner">
@foreach ($photo->files as $file)
<div class="carousel-item{{ $loop->first ? ' active' : '' }}">
<a href="/photos/{{ $photo->id }}">{!! resizeImage('/uploads/photos/' . $file->hash, ['alt' => $photo->title, 'class' => 'd-block w-100']) !!}</a>
</div>
@endforeach
</div>
@if ($countFiles > 1)
<a class="carousel-control-prev" href="#myCarousel{{ $loop->iteration }}" 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="#myCarousel{{ $loop->iteration }}" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
@endif
</div>
</div>
<div class="gallery-text">
@if ($photo->text)
{!! bbCode($photo->text) !!}
</div>
@endif
<div class="gallery-bottom">
<span>Добавлено: {!! profile($photo->user) !!} ({{ dateFixed($photo->created_at) }})</span>
<span><a href="/photos/comments/{{ $photo->id }}"><i class="fa fa-comment" aria-hidden="true"> {{ $photo->count_comments }}</i></a>
<!--<a href="/photos/end/{{ $photo->id }}"><i class="fa fa-chevron-circle-right" aria-hidden="true"></i></a>-->
</span>
</div>
</div>
</div>
@endforeach
{!! pagination($page) !!}
<div class="center-text">
<span> Всего фотографий: <b>{{ $page->total }}</b></span>
</div>
@else
{!! showError('Фотографий нет, будь первым!') !!}
@endif
@stop