kekrozsak/src/KekRozsak/FrontBundle/Resources/views/Forum/topicGroupList.html.twig

78 lines
2.7 KiB
Twig

{# vim: ft=htmljinja
#}
{% extends 'KekRozsakFrontBundle:Default:main_template.html.twig' %}
{% form_theme newTopicGroupForm 'KekRozsakFrontBundle:Form:user_form.html.twig' %}
{% block title %} - Fórum{% endblock %}
{% block content %}
<h3>Fórum</h3>
{% if is_granted('ROLE_ADMIN') %}
<span class="gomb" id="new-topic-group-button">[Új témakör]</span><br />
<div id="new-topic-group">
{# TODO: make this an AJAX form #}
<form method="post" action="{{ path('KekRozsakFrontBundle_forumTopicGroupList') }}">
<table>
{{ form_widget(newTopicGroupForm) }}
</table>
<button type="submit">Mentés</button>
</form>
</div>
{#
{% else %}
<span class="gomb">[Új témakör kérése]</span>
#}
{% endif %}
{% for topicGroup in topicGroups %}
<table class="forum-lista">
<thead>
<tr>
<td colspan="2"><a href="{{ path('KekRozsakFrontBundle_forumTopicList', {slug: topicGroup.slug}) }}">{{ topicGroup.title }}</a></td>
<td>Hozzászólások száma</td>
<td>Utolsó hozzászólás</td>
</tr>
</thead>
<tbody>
{% if topicGroup.topics|length > 0 %}
{% for topic in topicGroup.topics %}
<tr class="{{ cycle(['odd', 'even'], loop.index0) }}">
<td>
[ikon]
{% if app.user.userData and app.user.userData.isFavouriteForumTopic(topic) %}
<span class="unfavourite-topic-button topicgroup-{{ topic.topicGroup.slug }}" id="unfavourite-topic-button-{{ topic.slug }}"><img src="{{ asset('bundles/kekrozsakfront/images/penta-yellow-24.png') }}" alt="[Kedvenc]" /></span>
{% else %}
<span class="favourite-topic-button topicgroup-{{ topic.topicGroup.slug }}" id="favourite-topic-button-{{ topic.slug }}"><img src="{{ asset('bundles/kekrozsakfront/images/penta-blue-24.png') }}" alt="[Nem kedvenc]" /></span>
{% endif %}
</td>
<td><a href="{{ path('KekRozsakFrontBundle_forumPostList', {topicGroupSlug: topicGroup.slug, topicSlug: topic.slug}) }}">{{ topic.title }}</a></td>
<td></td>
<td>
{% if topic.lastPost %}
{{ topic.lastPost.createdBy|userdataspan }}<br />
{{ topic.lastPost.createdAt|date('Y-m-d H:i') }}
{% else %}
&nbsp;<br />&nbsp;
{% endif %}
</td>
</tr>
{% endfor %}
{% else %}
<tr>
<td colspan="4">Ebben a kategóriában nincsenek témák</td>
</tr>
{% endif %}
</tbody>
</table>
{% endfor %}
{% endblock content %}
{% block bottomscripts %}
<script type="text/javascript">
$(document).ready(function() {
$('#new-topic-group-button').click(function() {
alert('Juj!');
});
});
</script>
{% endblock bottomscripts %}