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:
@@ -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 ]
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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" }
|
||||
|
@@ -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 %}
|
||||
|
Reference in New Issue
Block a user