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

Размер файла: 4.17Kb
  1. @extends('layout')
  2.  
  3. @section('title', $photo->title)
  4.  
  5. @section('breadcrumb')
  6. <nav>
  7. <ol class="breadcrumb">
  8. <li class="breadcrumb-item"><a href="/"><i class="fas fa-home"></i></a></li>
  9. <li class="breadcrumb-item"><a href="/photos">{{ __('index.photos') }}</a></li>
  10. <li class="breadcrumb-item"><a href="/photos/albums/{{ $photo->user->login }}">{{ __('photos.album') }}</a></li>
  11. <li class="breadcrumb-item active">{{ $photo->title }}</li>
  12. </ol>
  13. </nav>
  14. @stop
  15.  
  16. @section('header')
  17. @if (getUser())
  18. @if (isAdmin())
  19. <div class="btn-group float-end">
  20. <button type="button" class="btn btn-light dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  21. <i class="fas fa-wrench"></i>
  22. </button>
  23. <div class="dropdown-menu dropdown-menu-end">
  24. <a class="dropdown-item" href="/admin/photos/edit/{{ $photo->id }}">{{ __('main.edit') }}</a>
  25. <a class="dropdown-item" href="/admin/photos/delete/{{ $photo->id }}?_token={{ csrf_token() }}" onclick="return confirm('{{ __('photos.confirm_delete_photo') }}')">{{ __('main.delete') }}</a>
  26. </div>
  27. </div>
  28. @elseif (getUser('id') === $photo->user->id)
  29. <div class="btn-group float-end">
  30. <button type="button" class="btn btn-light dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  31. <i class="fas fa-wrench"></i>
  32. </button>
  33. <div class="dropdown-menu dropdown-menu-end">
  34. <a class="dropdown-item" href="/photos/edit/{{ $photo->id }}">{{ __('main.edit') }}</a>
  35. <a class="dropdown-item" href="/photos/delete/{{ $photo->id }}?_token={{ csrf_token() }}" onclick="return confirm('{{ __('photos.confirm_delete_photo') }}')">{{ __('main.delete') }}</a>
  36. </div>
  37. </div>
  38. @endif
  39. @endif
  40. <h1>{{ $photo->title }}</h1>
  41. @stop
  42.  
  43. @section('content')
  44. <div class="section mb-3 shadow">
  45. @foreach ($photo->files as $file)
  46. <div class="media-file mb-3">
  47. <a href="{{ $file->hash }}" class="gallery" data-group="{{ $photo->id }}"><img class="img-fluid" src="{{ $file->hash }}" alt="image"></a>
  48. </div>
  49. @endforeach
  50.  
  51. <div class="section-content">
  52. @if ($photo->text)
  53. {{ bbCode($photo->text) }}<br>
  54. @endif
  55.  
  56. <div class="my-2 js-rating">{{ __('main.rating') }}:
  57. @if (getUser() && getUser('id') !== $photo->user_id)
  58. <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>
  59. @endif
  60. <b>{{ formatNum($photo->rating) }}</b>
  61. @if (getUser() && getUser('id') !== $photo->user_id)
  62. <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>
  63. @endif
  64. </div>
  65.  
  66. {{ __('main.added') }}: {{ $photo->user->getProfile() }} ({{ dateFixed($photo->created_at) }})<br>
  67. <a href="/photos/comments/{{ $photo->id }}">{{ __('main.comments') }}</a> ({{ $photo->count_comments }})
  68. <a href="/photos/end/{{ $photo->id }}">&raquo;</a>
  69. </div>
  70. </div>
  71.  
  72. <?php $nav = photoNavigation($photo->id); ?>
  73.  
  74. @if (isset($nav['next']) || isset($nav['prev']))
  75. <div class="section mb-3 shadow text-center fw-bold">
  76. @if ($nav['next'])
  77. <a href="/photos/{{ $nav['next'] }}">&laquo; {{ __('main.previous') }}</a> &nbsp;
  78. @endif
  79.  
  80. @if ($nav['prev'])
  81. &nbsp; <a href="/photos/{{ $nav['prev'] }}">{{ __('main.next') }} &raquo;</a>
  82. @endif
  83. </div>
  84. @endif
  85. @stop