2012-07-31 07:52:24 +00:00
|
|
|
{# vim: ft=htmljinja
|
|
|
|
#}
|
2012-08-15 10:31:02 +00:00
|
|
|
{% extends 'KekRozsakFrontBundle:Default:main_template.html.twig' %}
|
2012-08-23 15:32:52 +00:00
|
|
|
{% form_theme newTopicForm 'KekRozsakFrontBundle:Form:user_form.html.twig' %}
|
|
|
|
|
2012-07-03 12:11:18 +00:00
|
|
|
{% block title %} - Fórum - {{ topicGroup.title }}{% endblock %}
|
2012-08-23 15:32:52 +00:00
|
|
|
|
2012-07-03 12:11:18 +00:00
|
|
|
{% block content %}
|
2012-07-31 08:25:06 +00:00
|
|
|
<h3><a href="{{ path('KekRozsakFrontBundle_forumTopicGroupList') }}">Fórum</a> - {{ topicGroup.title }}</h3>
|
2012-08-23 15:32:52 +00:00
|
|
|
<span class="gomb" id="new-topic-button">[Új téma]</span><br />
|
|
|
|
<form method="post" action="{{ path('KekRozsakFrontBundle_forumTopicList', { slug: topicGroup.slug }) }}">
|
|
|
|
<table>
|
|
|
|
{{ form_widget(newTopicForm) }}
|
|
|
|
</table>
|
|
|
|
<button type="submit">Mentés</button>
|
|
|
|
</form>
|
2012-07-03 12:11:18 +00:00
|
|
|
{% if topicGroup.topics|length > 0 %}
|
2012-07-07 10:12:33 +00:00
|
|
|
<table class="forum-lista">
|
2012-08-16 13:52:41 +00:00
|
|
|
<thead>
|
|
|
|
<tr>
|
2012-08-23 17:06:26 +00:00
|
|
|
<td colspan="2"></td>
|
2012-08-16 13:52:41 +00:00
|
|
|
<td>Hozzászólások száma</td>
|
|
|
|
<td>Utolsó hozzászólás</td>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2012-07-03 12:11:18 +00:00
|
|
|
{% for topic in topicGroup.topics %}
|
2012-08-16 13:52:41 +00:00
|
|
|
<tr class="{{ cycle(['odd', 'even'], loop.index0) }}">
|
2012-08-23 17:06:26 +00:00
|
|
|
<td>
|
|
|
|
{% if app.user.userData and app.user.userData.isFavouriteForumTopic(topic) %}
|
|
|
|
<span class="gomb unfavourite-topic-button" id="unfavourite-topic-button-{{ topic.slug }}">[Kedvenc ikon]</span>
|
|
|
|
{% else %}
|
|
|
|
<span class="gomb favourite-topic-button" id="favourite-topic-button-{{ topic.slug }}">[Nem kedvenc ikon]</span>
|
|
|
|
{% endif %}
|
|
|
|
</td>
|
2012-08-16 13:52:41 +00:00
|
|
|
<td><a href="{{ path('KekRozsakFrontBundle_forumPostList', { topicGroupSlug: topicGroup.slug, topicSlug: topic.slug }) }}">{{ topic.title }}</a></td>
|
|
|
|
<td></td>
|
|
|
|
<td>
|
2012-07-31 08:14:26 +00:00
|
|
|
{% if topic.lastPost %}
|
2012-08-16 13:52:41 +00:00
|
|
|
{{ topic.lastPost.createdBy|userdataspan }}<br />
|
|
|
|
{{ topic.lastPost.createdAt|date('Y-m-d H:i') }}
|
2012-07-31 08:14:26 +00:00
|
|
|
{% else %}
|
2012-08-16 13:52:41 +00:00
|
|
|
<br />
|
2012-07-31 08:14:26 +00:00
|
|
|
{% endif %}
|
2012-08-16 13:52:41 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
2012-07-03 12:11:18 +00:00
|
|
|
{% endfor %}
|
2012-08-16 13:52:41 +00:00
|
|
|
</tbody>
|
2012-07-03 12:11:18 +00:00
|
|
|
</table>
|
|
|
|
{% else %}
|
|
|
|
Ebben a témakörben nincsenek témák.
|
|
|
|
{% endif %}
|
|
|
|
{% endblock content %}
|
2012-08-23 17:06:26 +00:00
|
|
|
|
|
|
|
{% block bottomscripts %}
|
|
|
|
<script type="text/javascript">
|
|
|
|
{# TODO: The following two functions should also update the top-left profile
|
|
|
|
# box
|
|
|
|
#}
|
|
|
|
function favouriteOn()
|
|
|
|
{
|
|
|
|
var self = $(this)
|
|
|
|
var topicSlug = self.attr('id').replace(/^favourite-topic-button-/, '');
|
|
|
|
url = Routing.generate('KekRozsakFrontBundle_forumFavouriteTopic', {
|
|
|
|
topicGroupSlug: '{{ topicGroup.slug }}',
|
|
|
|
topicSlug: topicSlug
|
|
|
|
});
|
|
|
|
$.ajax({
|
|
|
|
type: 'GET',
|
|
|
|
url: url
|
|
|
|
}).done(function() {
|
|
|
|
self.html('[Kedvenc ikon]');
|
|
|
|
self.removeClass('favourite-topic-button');
|
|
|
|
self.addClass('unfavourite-topic-button');
|
|
|
|
self.attr('id', 'unfavourite-topic-button-' + topicSlug);
|
|
|
|
self.off('click.updateFav');
|
|
|
|
self.on('click.updateFav', favouriteOff);
|
|
|
|
}).error(function() {
|
|
|
|
alert('Nem siker!');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function favouriteOff()
|
|
|
|
{
|
|
|
|
var self = $(this)
|
|
|
|
var topicSlug = self.attr('id').replace(/^unfavourite-topic-button-/, '');
|
|
|
|
url = Routing.generate('KekRozsakFrontBundle_forumUnfavouriteTopic', {
|
|
|
|
topicGroupSlug: '{{ topicGroup.slug }}',
|
|
|
|
topicSlug: topicSlug
|
|
|
|
});
|
|
|
|
$.ajax({
|
|
|
|
type: 'GET',
|
|
|
|
url: url
|
|
|
|
}).done(function() {
|
|
|
|
self.html('[Nem kedvenc ikon]');
|
|
|
|
self.removeClass('unfavourite-topic-button');
|
|
|
|
self.addClass('favourite-topic-button');
|
|
|
|
self.attr('id', 'favourite-topic-button-' + topicSlug);
|
|
|
|
self.off('click.updateFav');
|
|
|
|
self.on('click.updateFav', favouriteOn);
|
|
|
|
}).error(function() {
|
|
|
|
alert('Nem siker!');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function setupFavButtons()
|
|
|
|
{
|
|
|
|
$('.favourite-topic-button').on('click.updateFav', favouriteOn);
|
|
|
|
$('.unfavourite-topic-button').on('click.updateFav', favouriteOff);
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(setupFavButtons);
|
|
|
|
</script>
|
|
|
|
{% endblock bottomscripts %}
|