forked from GNUsocial/gnu-social
[ATTACHMENTS] Add controller and templates for the attachment show page, which shows extra info about an attachment, such as related notes and tags
This commit is contained in:
@@ -10,16 +10,30 @@
|
||||
media="screen and (max-width: 750px)">
|
||||
{% endblock %}
|
||||
|
||||
{# {% block header %} #}
|
||||
{# {{ parent() }} #}
|
||||
{# {% endblock %} #}
|
||||
|
||||
{# {% block left %} #}
|
||||
{# {{ parent() }} #}
|
||||
{# {% endblock %} #}
|
||||
|
||||
{% block body %}
|
||||
<div class="content">
|
||||
yooo
|
||||
<div style="display: block">
|
||||
<p> {{ title | escape }} </p>
|
||||
<a href="{{download}}"> {{ 'Download link' | trans }}</a>
|
||||
{% include '/attachments/view.html.twig' with {'attachment': attachment} only %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock body %}
|
||||
|
||||
{% block right %}
|
||||
<div id="related-notes">
|
||||
{{ 'Notes where this attachment appears' | trans }}
|
||||
{% for note in related_notes %}
|
||||
{% include '/note/view.html.twig' with {'note' : note, 'hide_attachments': true} only %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div id="related-tags">
|
||||
{{ 'Tags for this attachment' | trans }}
|
||||
<br/>
|
||||
{% for tag in related_tags %}
|
||||
<i>#{{tag['tag']}}</i>
|
||||
{% else %}
|
||||
{{ 'No tags' | trans }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock right %}
|
||||
|
||||
25
templates/attachments/view.html.twig
Normal file
25
templates/attachments/view.html.twig
Normal file
@@ -0,0 +1,25 @@
|
||||
{% set thumbnail_parameters = {'id': attachment.getId(), 'w': config('thumbnail','width'), 'h': config('thumbnail','height')} %}
|
||||
{% if attachment.mimetype starts with 'image/' %}
|
||||
<div>
|
||||
<figure>
|
||||
<img src="{{ path('attachment_thumbnail', thumbnail_parameters) }}" alt="{{ attachment.getTitle() }}">
|
||||
<figcaption> <a href="{{ path('attachment_show', {'id': attachment.getId()}) }}">{{ attachment.getTitle() }}</a> </figcaption>
|
||||
</figure>
|
||||
</div>
|
||||
{% elseif attachment.mimetype starts with 'video/' %}
|
||||
<div>
|
||||
<video src="{{ path('attachment_view', {'id': attachment.getId()}) }}" controls poster="{{ path('attachment_thumbnail') }}, thumbnail_parameters">
|
||||
<i> <a href="{{ path('attachment_show', {'id': attachment.getId()}) }}">{{ attachment.getTitle() }}</a> </i>
|
||||
</video>
|
||||
</div>
|
||||
{% else %}
|
||||
{% for show in handle_event('ShowAttachment', attachment) %}
|
||||
<div>
|
||||
{{ show | raw }}
|
||||
</div>
|
||||
{% else %}
|
||||
<div>
|
||||
<i> <a href="{{ path('attachment_show', {'id': attachment.getId()}) }}">{{ attachment.getTitle() }}</a> </i>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
@@ -40,15 +40,19 @@
|
||||
</a>
|
||||
</nav>
|
||||
<div id="right-panel">
|
||||
<input type="checkbox" id="toggle-right" class="larger">
|
||||
<div class="arrow right">
|
||||
<label for="toggle-right" id='right-panel'></label>
|
||||
</div>
|
||||
<div class='rss'>
|
||||
<div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="checkbox" id="toggle-right" class="larger">
|
||||
<div class="arrow right">
|
||||
<label for="toggle-right" id='right-panel'></label>
|
||||
</div>
|
||||
<div class='rss'>
|
||||
<div> </div>
|
||||
</div>
|
||||
<div>
|
||||
{% block right %}
|
||||
{% endblock right %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endblock header%}
|
||||
@@ -59,3 +63,4 @@
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -21,42 +21,20 @@
|
||||
{% include '/'~ other.name ~ '/view.html.twig' with {'vars': other.vars} only %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="note-attachments">
|
||||
{% for attachment in note.getAttachments() %}
|
||||
{% set thumbnail_parameters = {'id': attachment.getId(), 'w': config('thumbnail','width'), 'h': config('thumbnail','height')} %}
|
||||
{% if attachment.mimetype starts with 'image/' %}
|
||||
<div>
|
||||
<figure>
|
||||
<img src="{{ path('attachment_thumbnail', thumbnail_parameters) }}" alt="{{ attachment.getTitle() }}">
|
||||
<figcaption> <a href="{{ path('attachment_show', {'id': attachment.getId()}) }}">{{ attachment.getTitle() }}</a> </figcaption>
|
||||
</figure>
|
||||
</div>
|
||||
{% elseif attachment.mimetype starts with 'video/' %}
|
||||
<div>
|
||||
<video src="{{ path('attachment_view', {'id': attachment.getId()}) }}" controls poster="{{ path('attachment_thumbnail') }}, thumbnail_parameters">
|
||||
<i> <a href="{{ path('attachment_show', {'id': attachment.getId()}) }}">{{ attachment.getTitle() }}</a> </i>
|
||||
</video>
|
||||
</div>
|
||||
{% else %}
|
||||
{% for show in handle_event('ShowAttachment', attachment) %}
|
||||
<div>
|
||||
{{ show | raw }}
|
||||
</div>
|
||||
{% else %}
|
||||
<div>
|
||||
<i> <a href="{{ path('attachment_show', {'id': attachment.getId()}) }}">{{ attachment.getTitle() }}</a> </i>
|
||||
</div>
|
||||
{% if hide_attachments is not defined and hide_attachments != true %}
|
||||
<div class="note-attachments">
|
||||
{% for attachment in note.getAttachments() %}
|
||||
{% include '/attachments/view.html.twig' with {'attachment': attachment} %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="note-actions">
|
||||
{% if have_user %}
|
||||
{#{% for act in get_note_actions(note) %}#}
|
||||
{#{{ form(act) }}#}
|
||||
{#{% endfor %}#}
|
||||
{% endif %}
|
||||
{# {% if have_user %} #}
|
||||
{# {\#{% for act in get_note_actions(note) %}#\} #}
|
||||
{# {\#{{ form(act) }}#\} #}
|
||||
{# {\#{% endfor %}#\} #}
|
||||
{# {% endif %} #}
|
||||
</div>
|
||||
{% if replies is defined %}
|
||||
<div class="replies">
|
||||
|
||||
Reference in New Issue
Block a user