{% extends 'base.html.twig' %}
{% block body %}
<div class="row">
<div class="col-12">
<div class="my-3 p-3 bg-white">
{% if safeMode and photo.isAdult %}
<div class="text-center alert alert-info" role="alert">
<a href="#" id="safe-mode-off" data-responder="{{ path('core_safe_mode') }}">
{{ 'Turn Safe Mode off to view the picture'|trans({}, 'media_portfolio') }}
</a>
</div>
{% endif %}
<div class="col-12 text-center" id="photo-container">
{% if prev %}
{% set prevType = prev.type %}
{% if album %}
{% set route = path('portfolio_' ~ prevType, {slug: prev.profile.slug, media: prev.hash, album: album.id}) %}
{% elseif type %}
{% set route = path('portfolio_' ~ prevType, {slug: prev.profile.slug, media: prev.hash, type: type}|merge(routeParams)) %}
{% endif %}
<a href="{{ route }}" class="btn btn-primary btn-sm" id="prev-photo" role="button">
{{ 'Previous'|trans({}, 'core') }}
</a>
{% endif %}
<img src="{{ get_media(photo) }}" class="img-fluid" alt="{{ photo.title }}">
{% if next %}
{% set nextType = next.type %}
{% if album %}
{% set route = path('portfolio_' ~ nextType, {slug: prev.profile.slug, media: next.hash, album: album.id}) %}
{% elseif type %}
{% set route = path('portfolio_' ~ nextType, {slug: prev.profile.slug, media: next.hash, type: type}|merge(routeParams)) %}
{% endif %}
<a href="{{ route }}" class="btn btn-primary btn-sm" id="next-photo" role="button">
{{ 'Next'|trans({}, 'core') }}
</a>
{% endif %}
</div>
<div class="col-12 text-center">
{% if photo.title %}
<h4 id="photo-title">{{ photo.title }}</h4>
{% endif %}
{% if photo.description %}
<p id="photo-description">{{ photo.description }}</p>
{% endif %}
</div>
<div class="col-12 text-center py-3">
{% include 'media/portfolio/partials/social-buttons.html.twig' %}
</div>
</div>
</div>
<div class="col-12 col-md-6">
<div class="my-3 p-3 bg-white rounded">
{% if photo.convertedCredits|length %}
{% for credit in photo.convertedCredits %}
<p id="photo-credit-{{ credit.info.id }}">
<span class="font-weight-bold">{{ credit.info.name }}:</span>
{% for user in credit.users %}
{% if user.profile %}
<a href="{{ path('profile', {slug: user.profile.slug}) }}">
{{ user.profile.name }}
</a>
{% else %}{{ user.name }}{% endif %}{% if loop.last == false %}, {% endif %}
{% endfor %}
</p>
{% endfor %}
{% endif %}
</div>
</div>
<div class="col-12 col-md-6">
<div class="my-3 p-3 bg-white rounded">
{% if photo.tags|length %}
<p id="photo-tags">
<span class="font-weight-bold">{{ 'Hashtags:'|trans({}, 'media_portfolio') }}</span>
{% for tag in photo.tags %}
<a href="{{ path('media_tag', {tag: tag.slug}) }}">#{{tag.name}}</a>
{% endfor %}
</p>
{% endif %}
</div>
<div class="my-3 p-3 bg-white rounded">
<p class="font-italic">
{{ 'Uploaded by <a href="{link}">{name}</a> on {date}'|trans({'{link}': path('profile', {slug: photo.profile.slug}) , '{name}': photo.profile.name, '{date}': photo.createdAt|format_date() }, 'media_portfolio')|raw }}
</p>
{% if owner %}
<a href="{{ path('portfolio_photo_edit', {slug: photo.profile.slug, photo: photo.id}) }}" class="text-left btn btn-sm btn-link btn-block" btn-sm role="button">
{{ 'Edit photo'|trans({}, 'media_portfolio') }}
</a>
<a href="{{ path('portfolio_photo_cover', {slug: photo.profile.slug, photo: photo.id}) }}" class="text-left btn btn-sm btn-link btn-block" btn-sm role="button">
{{ 'Set as cover'|trans({}, 'media_portfolio') }}
</a>
<a data-toggle="confirmation" href="{{ path('portfolio_photo_delete', {slug: photo.profile.slug, photo: photo.id}) }}" class="text-left btn btn-link btn-block btn-sm" role="button">
{{ 'Delete photo'|trans({}, 'media_portfolio') }}
</a>
{% endif %}
</div>
{% if credited %}
{% for profile in credited %}
{% if photo.profile != profile %}
<div class="my-3 p-3 bg-white rounded">
<a href="{{ path('portfolio_photo_credited', {slug: profile.slug, photo: photo.id}) }}" class="text-left btn btn-sm btn-link btn-block" btn-sm role="button">
{{ 'Add it to my portfolio or albums'|trans({}, 'media_portfolio') }}
</a>
<a href="{{ path('portfolio_photo_cover', {slug: profile.slug, photo: photo.id}) }}" class="text-left btn btn-sm btn-link btn-block" btn-sm role="button">
{{ 'Set as cover'|trans({}, 'media_portfolio') }}
</a>
<a data-toggle="confirmation" href="{{ path('portfolio_photo_credited_delete', {slug: profile.slug, photo: photo.id}) }}" class="text-left btn btn-link btn-block btn-sm" role="button">
{{ 'Remove the credits'|trans({}, 'media_portfolio') }}
</a>
</div>
{% endif %}
{% endfor %}
{% endif %}
</div>
<a href="{{ path('profile', {slug: profile.slug}) }}" class="btn btn-sm btn-primary btn-block" role="button">
{{ 'Back to portfolio'|trans({}, 'media_portfolio') }}
</a>
</div>
{% endblock %}
{% block javascripts %}
{{ parent() }}
{{ encore_entry_script_tags('media_portfolio') }}
{% endblock %}
{% block stylesheets %}
{{ parent() }}
{{ encore_entry_link_tags('media_portfolio') }}
{% endblock %}