Made forum posting possible.

It has some limitations, though, as
ForumTopic.last_post and ForumTopicGroup.last_post is not updated
automagically...
This commit is contained in:
Polonkai Gergely
2012-07-07 20:25:54 +02:00
parent adba578db8
commit 301db68281
11 changed files with 333 additions and 5 deletions

View File

@@ -40,6 +40,12 @@ KekRozsak\FrontBundle\Entity\ForumTopic:
targetEntity: ForumTopicGroup
inversedBy: topics
nullable: false
oneToOne:
last_post:
targetEntity: ForumPost
nullable: true
default: null
cascade: [ persist ]
uniqueConstraint:
uniqueSlugByGroup:
columns: [ topic_group, slug ]

View File

@@ -32,6 +32,12 @@ KekRozsak\FrontBundle\Entity\ForumTopicGroup:
targetEntity: User
nullable: true
default: null
oneToOne:
last_post:
targetEntity: ForumPost
nullable: true
default: null
cascade: [ persist ]
oneToMany:
topics:
targetEntity: ForumTopic

View File

@@ -22,3 +22,12 @@ KekRozsakFrontBundle_forum_post_list:
pattern: /forum/{topicGroupSlug}/{topicSlug}
defaults:
_controller: KekRozsakFrontBundle:Forum:postList
requirements:
_method: GET
KekRozsakFrontBundle_forum_new_post:
pattern: /forum/{topicGroupSlug}/{topicSlug}/post
defaults:
_controller: KekRozsakFrontBundle:Forum:postList
requirements:
_method: POST

View File

@@ -15,3 +15,9 @@ services:
class: KekRozsak\FrontBundle\Form\Extension\HelpMessageTypeExtension
tags:
- { name: "form.type_extension", alias: "field" }
bb.twig.extension:
class: KekRozsak\FrontBundle\Extension\TwigBBExtension
arguments:
- @service_container
tags:
- { name: "twig.extension" }

View File

@@ -5,14 +5,38 @@
{% if topic.posts|length > 0 %}
<table class="post-lista">
<tbody>
{% for post in topic.posts %}
<tr>
<td class="szoveg"><div>{{ post.text|raw }}</div></td>
<td class="uj-post">
<form method="post" action="{{ path('KekRozsakFrontBundle_forum_new_post', { topicGroupSlug: topicGroup.slug, topicSlug: topic.slug } ) }}">
{{ form_widget(form) }}
<p>
<span class="eszkoztar">Súgó</span><span class="kuldes-gomb" /><button type="submit">Küldés</button>
</p>
</form>
</td>
<td class="felado">
<br />
<br />
[avatar]<br />
{{ app.user.displayName }}<br />
Saját szint<br />
<br />
Tagság kezdete:<br />
{{ app.user.registeredAt|date('Y-m-d') }}
</td>
</tr>
{% for post in posts %}
<tr>
<td class="szoveg"><div>{{ post.text|bbdecode }}</div></td>
<td class="felado">
{{ post.createdAt|date('Y-m-d') }}<br />
{{ post.createdAt|date('H:i') }}<br />
[avatar]<br />
{{ post.createdBy.displayName }}<br />
{{ post.createdAt|date('Y-m-d H:i') }}<br />
Szint<br />
Tagság kezdete: {{ post.createdBy.RegisteredAt|date('Y-m-d') }}
<br />
Tagság kezdete:<br />
{{ post.createdBy.RegisteredAt|date('Y-m-d') }}
</td>
</tr>
{% endfor %}