Просмотр файла resources/views/photos/index.blade.php

Размер файла: 3.5Kb
  1. @extends('layout')
  2.  
  3. @section('title', __('index.photos') . ' (' . __('main.page_num', ['page' => $photos->currentPage()]) .')')
  4.  
  5. @section('header')
  6. <div class="float-end">
  7. @if (getUser())
  8. <a class="btn btn-success" href="/photos/create">{{ __('main.add') }}</a>
  9.  
  10. @if (isAdmin())
  11. <a class="btn btn-light" href="/admin/photos?page={{ $photos->currentPage() }}"><i class="fas fa-wrench"></i></a>
  12. @endif
  13. @endif
  14. </div>
  15.  
  16. <h1>{{ __('index.photos') }}</h1>
  17. @stop
  18.  
  19. @section('breadcrumb')
  20. <nav>
  21. <ol class="breadcrumb">
  22. <li class="breadcrumb-item"><a href="/"><i class="fas fa-home"></i></a></li>
  23. <li class="breadcrumb-item active">{{ __('index.photos') }}</li>
  24. </ol>
  25. </nav>
  26. @stop
  27.  
  28. @section('content')
  29. @if (getUser())
  30. {{ __('main.my') }}:
  31. <a href="/photos/albums/{{ getUser('login') }}">{{ __('photos.photos') }}</a>,
  32. <a href="/photos/comments/active/{{ getUser('login') }}">{{ __('main.comments') }}</a> /
  33. @endif
  34.  
  35. {{ __('main.all') }}:
  36. <a href="/photos/albums">{{ __('photos.albums') }}</a>,
  37. <a href="/photos/comments">{{ __('main.comments') }}</a> /
  38. <a href="/photos/top">{{ __('photos.top_photos') }}</a>
  39. <hr>
  40.  
  41. @if ($photos->isNotEmpty())
  42. @foreach ($photos as $photo)
  43. <div class="section mb-3 shadow">
  44. <div class="section-header d-flex align-items-center">
  45. <div class="flex-grow-1">
  46. <div class="section-title">
  47. <i class="fa fa-image"></i>
  48. <a href="/photos/{{ $photo->id }}">{{ $photo->title }}</a>
  49. </div>
  50. </div>
  51.  
  52. <div class="text-end js-rating">
  53. @if (getUser() && getUser('id') !== $photo->user_id)
  54. <a class="post-rating-down<?= $photo->vote === '-' ? ' active' : '' ?>" href="#" onclick="return changeRating(this);" data-id="{{ $photo->id }}" data-type="{{ $photo->getMorphClass() }}" data-vote="-" data-token="{{ csrf_token() }}"><i class="fa fa-arrow-down"></i></a>
  55. @endif
  56. <b>{{ formatNum($photo->rating) }}</b>
  57. @if (getUser() && getUser('id') !== $photo->user_id)
  58. <a class="post-rating-up<?= $photo->vote === '+' ? ' active' : '' ?>" href="#" onclick="return changeRating(this);" data-id="{{ $photo->id }}" data-type="{{ $photo->getMorphClass() }}" data-vote="+" data-token="{{ csrf_token() }}"><i class="fa fa-arrow-up"></i></a>
  59. @endif
  60. </div>
  61. </div>
  62.  
  63. <div class="section-content">
  64. @include('app/_carousel', ['model' => $photo])
  65.  
  66. @if ($photo->text)
  67. {{ bbCode($photo->text) }}<br>
  68. @endif
  69.  
  70. {{ __('main.added') }}: {{ $photo->user->getProfile() }} ({{ dateFixed($photo->created_at) }})<br>
  71. <a href="/photos/comments/{{ $photo->id }}">{{ __('main.comments') }}</a> ({{ $photo->count_comments }})
  72. <a href="/photos/end/{{ $photo->id }}">&raquo;</a>
  73. </div>
  74. </div>
  75. @endforeach
  76.  
  77. {{ $photos->links() }}
  78.  
  79. <div class="mb-3">
  80. {{ __('photos.total_photos') }}: <b>{{ $photos->total() }}</b>
  81. </div>
  82. @else
  83. {{ showError(__('photos.empty_photos')) }}
  84. @endif
  85. @stop