Revised Forum Controller and Templates

Signed-off-by: Polonkai Gergely <polesz@w00d5t0ck.info>
This commit is contained in:
Polonkai Gergely 2012-07-31 10:25:06 +02:00
parent b82eb93bf7
commit aa884ae798
5 changed files with 15 additions and 15 deletions

View File

@ -18,7 +18,7 @@
<dt>Kedvenc Fórum-témáim</dt> <dt>Kedvenc Fórum-témáim</dt>
<dl><a href="{{ path('KekRozsakFrontBundle_forum_main') }}">Fórum</a></dl> <dl><a href="{{ path('KekRozsakFrontBundle_forumTopicGroupList') }}">Fórum</a></dl>
<dt>Üzenetek</dt> <dt>Üzenetek</dt>
</dl> </dl>

View File

@ -18,10 +18,10 @@ use KekRozsak\FrontBundle\Form\Type\ForumPostType;
class ForumController extends Controller class ForumController extends Controller
{ {
/** /**
* @Route("", name="KekRozsakFrontBundle_forum_main") * @Route("", name="KekRozsakFrontBundle_forumTopicGroupList")
* @Template("KekRozsakFrontBundle:Forum:topic_group_list.html.twig") * @Template()
*/ */
public function mainAction() public function topicGroupListAction()
{ {
$groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:ForumTopicGroup'); $groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:ForumTopicGroup');
@ -34,8 +34,8 @@ class ForumController extends Controller
} }
/** /**
* @Route("/{slug}", name="KekRozsakFrontBundle_forum_topic_list") * @Route("/{slug}", name="KekRozsakFrontBundle_forumTopicList")
* @Template("KekRozsakFrontBundle:Forum:topic_list.html.twig") * @Template()
* @ParamConverter("topicGroup") * @ParamConverter("topicGroup")
*/ */
public function topicListAction(ForumTopicgRoup $topicGroup) public function topicListAction(ForumTopicgRoup $topicGroup)
@ -46,8 +46,8 @@ class ForumController extends Controller
} }
/** /**
* @Route("/{topicGroupSlug}/{topicSlug}", name="KekRozsakFrontBundle_forum_post_list") * @Route("/{topicGroupSlug}/{topicSlug}", name="KekRozsakFrontBundle_forumPostList")
* @Template("KekRozsakFrontBundle:Forum:post_list.html.twig") * @Template()
* @ParamConverter("topic", options={"mapping"={"topicGroup"="topicGroup", "topicSlug"="slug"}}) * @ParamConverter("topic", options={"mapping"={"topicGroup"="topicGroup", "topicSlug"="slug"}})
* @ParamConverter("topicGroup", options={"mapping"={"topicGroupSlug"="slug"}}) * @ParamConverter("topicGroup", options={"mapping"={"topicGroupSlug"="slug"}})
*/ */
@ -76,7 +76,7 @@ class ForumController extends Controller
$em->persist($topic); $em->persist($topic);
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl('KekRozsakFrontBundle_forum_post_list', array( return $this->redirect($this->generateUrl('KekRozsakFrontBundle_forumPostList', array(
'topicGroupSlug' => $topicGroup->getSlug(), 'topicGroupSlug' => $topicGroup->getSlug(),
'topicSlug' => $topic->getSlug(), 'topicSlug' => $topic->getSlug(),
))); )));

View File

@ -3,12 +3,12 @@
{% extends '::main_template.html.twig' %} {% extends '::main_template.html.twig' %}
{% block title %} - Fórum - {{ topicGroup.title }} - {{ topic.title }}{% endblock %} {% block title %} - Fórum - {{ topicGroup.title }} - {{ topic.title }}{% endblock %}
{% block content %} {% block content %}
<h3><a href="{{ path('KekRozsakFrontBundle_forum_main') }}">Fórum</a> - <a href="{{ path('KekRozsakFrontBundle_forum_topic_list', {slug: topicGroup.slug}) }}">{{ topicGroup.title }}</a> - {{ topic.title }}</h3> <h3><a href="{{ path('KekRozsakFrontBundle_forumTopicGroupList') }}">Fórum</a> - <a href="{{ path('KekRozsakFrontBundle_forumTopicList', {slug: topicGroup.slug}) }}">{{ topicGroup.title }}</a> - {{ topic.title }}</h3>
<table class="post-lista"> <table class="post-lista">
<tbody> <tbody>
<tr> <tr>
<td class="uj-post"> <td class="uj-post">
<form method="post" action="{{ path('KekRozsakFrontBundle_forum_post_list', { topicGroupSlug: topicGroup.slug, topicSlug: topic.slug } ) }}"> <form method="post" action="{{ path('KekRozsakFrontBundle_forumPostList', { topicGroupSlug: topicGroup.slug, topicSlug: topic.slug } ) }}">
{{ form_widget(form) }} {{ form_widget(form) }}
<p> <p>
<span class="eszkoztar">Súgó</span><span class="kuldes-gomb" /><button type="submit">Küldés</button> <span class="eszkoztar">Súgó</span><span class="kuldes-gomb" /><button type="submit">Küldés</button>

View File

@ -8,7 +8,7 @@
<table class="forum-lista"> <table class="forum-lista">
<thead> <thead>
<tr> <tr>
<td colspan="2"><a href="{{ path('KekRozsakFrontBundle_forum_topic_list', {slug: topicGroup.slug}) }}">{{ topicGroup.title }}</a></td> <td colspan="2"><a href="{{ path('KekRozsakFrontBundle_forumTopicList', {slug: topicGroup.slug}) }}">{{ topicGroup.title }}</a></td>
<td>Hozzászólások száma</td> <td>Hozzászólások száma</td>
<td>Utolsó hozzászólás</td> <td>Utolsó hozzászólás</td>
</tr> </tr>
@ -18,7 +18,7 @@
{% for topic in topicGroup.topics %} {% for topic in topicGroup.topics %}
<tr class="{{ cycle(['odd', 'even'], loop.index0) }}"> <tr class="{{ cycle(['odd', 'even'], loop.index0) }}">
<td>[ikon]</td> <td>[ikon]</td>
<td><a href="{{ path('KekRozsakFrontBundle_forum_post_list', {topicGroupSlug: topicGroup.slug, topicSlug: topic.slug}) }}">{{ topic.title }}</a></td> <td><a href="{{ path('KekRozsakFrontBundle_forumPostList', {topicGroupSlug: topicGroup.slug, topicSlug: topic.slug}) }}">{{ topic.title }}</a></td>
<td></td> <td></td>
<td> <td>
{% if topic.lastPost %} {% if topic.lastPost %}

View File

@ -3,7 +3,7 @@
{% extends '::main_template.html.twig' %} {% extends '::main_template.html.twig' %}
{% block title %} - Fórum - {{ topicGroup.title }}{% endblock %} {% block title %} - Fórum - {{ topicGroup.title }}{% endblock %}
{% block content %} {% block content %}
<h3><a href="{{ path('KekRozsakFrontBundle_forum_main') }}">Fórum</a> - {{ topicGroup.title }}</h3> <h3><a href="{{ path('KekRozsakFrontBundle_forumTopicGroupList') }}">Fórum</a> - {{ topicGroup.title }}</h3>
{% if topicGroup.topics|length > 0 %} {% if topicGroup.topics|length > 0 %}
<table class="forum-lista"> <table class="forum-lista">
<thead> <thead>
@ -16,7 +16,7 @@
<tbody> <tbody>
{% for topic in topicGroup.topics %} {% for topic in topicGroup.topics %}
<tr class="{{ cycle(['odd', 'even'], loop.index0) }}"> <tr class="{{ cycle(['odd', 'even'], loop.index0) }}">
<td><a href="{{ path('KekRozsakFrontBundle_forum_post_list', { topicGroupSlug: topicGroup.slug, topicSlug: topic.slug }) }}">{{ topic.title }}</a></td> <td><a href="{{ path('KekRozsakFrontBundle_forumPostList', { topicGroupSlug: topicGroup.slug, topicSlug: topic.slug }) }}">{{ topic.title }}</a></td>
<td></td> <td></td>
<td> <td>
{% if topic.lastPost %} {% if topic.lastPost %}