Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
app/Resources/FOSCommentBundle/views/Thread/comment.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{% set view = view|default('tree') %} | ||
{% set depth = depth|default(0) %} | ||
|
||
<article id="comment-{{ comment.id }}" class="fos_comment_comment_show depth_{{ depth }}"{% if parentId is defined %} data-parent="{{ parentId }}"{% endif %}> | ||
<div class="fos_comment_comment_metas"> | ||
<span class="byline author vcard">Posted by <span class="fn">{{ comment.authorName }}</span></span> | ||
<time datetime="{{ comment.createdAt | date('c') }}" pubdate="" data-updated="true">{{ comment.createdAt | date('F jS, Y H:i') }}</time> | ||
</div> | ||
|
||
<div class="fos_comment_comment_body"> | ||
{% if comment is fos_comment_raw %} | ||
{{ comment.rawBody | raw }} | ||
{% else %} | ||
{{ comment.body | nl2br }} | ||
{% endif %} | ||
</div> | ||
|
||
{% if view is not sameas('flat') %} | ||
<div class="fos_comment_comment_replies"> | ||
<div class="fos_comment_comment_reply"> | ||
<button data-url="{{ url('fos_comment_new_thread_comments', {"id": comment.thread.id}) }}" data-name="{{ comment.authorName }}" data-parent-id="{{ comment.id }}" class="fos_comment_comment_reply_show_form">{% trans from 'FOSCommentBundle' %}fos_comment_comment_show_reply{% endtrans %}</button> | ||
</div> | ||
|
||
{% if children is defined %} | ||
{% include "FOSCommentBundle:Thread:comments.html.twig" with { "comments": children, "depth": depth + 1, "parentId": comment.id, "view": view } %} | ||
{% endif %} | ||
</div> | ||
{% endif %} | ||
</article> | ||
|
||
{% if view is sameas('flat') and children is defined %} | ||
{% include "FOSCommentBundle:Thread:comments.html.twig" with { "comments": children, "depth": depth + 1, "parentId": comment.id, "view": view } %} | ||
{% endif %} |
48 changes: 48 additions & 0 deletions
48
app/Resources/FOSCommentBundle/views/Thread/comment_new.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{% set first = first|default(false) %} | ||
|
||
{% set url_parameters = {'id': id } %} | ||
{% if parent is not null %} | ||
{% set url_parameters = url_parameters|merge({'parentId': parent.id}) %} | ||
{% endif %} | ||
|
||
{% block fos_comment_comment_form_holder %} | ||
<div class="fos_comment_comment_form_holder"> | ||
{% block fos_comment_comment_new_form %} | ||
{% block fos_comment_form_title %} | ||
{% if first %} | ||
<h3>{% trans from 'FOSCommentBundle' %}fos_comment_comment_new_headline_first{% endtrans %}</h3> | ||
{% elseif parent is not null %} | ||
<h3>{% trans with {"%name%": parent.authorName } from 'FOSCommentBundle' %}fos_comment_comment_reply_reply_to{% endtrans %}</h3> | ||
{% else %} | ||
<h3>{% trans from 'FOSCommentBundle' %}fos_comment_comment_new_headline{% endtrans %}</h3> | ||
{% endif %} | ||
{% endblock %} | ||
|
||
<form class="fos_comment_comment_new_form" action="{{ url('fos_comment_post_thread_comments', url_parameters) }}" data-parent="{{ parent.id|default() }}" method="POST"> | ||
|
||
{% block fos_comment_form_fields %} | ||
<div class="fos_comment_form_errors"> | ||
{{ form_errors(form) }} | ||
</div> | ||
<div class="fos_comment_form_errors"> | ||
{{ form_errors(form.body) }} | ||
</div> | ||
{{ form_widget(form.body) }} | ||
|
||
{{ form_rest(form) }} | ||
{% endblock %} | ||
|
||
<div class="fos_comment_submit"> | ||
{% block fos_comment_form_submit %} | ||
{% if parent is not null %} | ||
<input type="button" value="{% trans from 'FOSCommentBundle' %}fos_comment_comment_reply_cancel{% endtrans %}" class="fos_comment_comment_reply_cancel" /> | ||
{% endif %} | ||
<input type="submit" value="{% trans from 'FOSCommentBundle' %}fos_comment_comment_new_submit{% endtrans %}" /> | ||
{% endblock %} | ||
</div> | ||
|
||
</form> | ||
{% endblock fos_comment_comment_new_form %} | ||
|
||
</div> | ||
{% endblock fos_comment_comment_form_holder %} |
21 changes: 21 additions & 0 deletions
21
app/Resources/FOSCommentBundle/views/Thread/comments.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{# | ||
This file is part of the FOSCommentBundle package. | ||
(c) FriendsOfSymfony <http://friendsofsymfony.github.com/> | ||
This source file is subject to the MIT license that is bundled | ||
with this source code in the file LICENSE. | ||
#} | ||
|
||
{% set depth = depth|default(0) %} | ||
{% set view = view|default('tree') %} | ||
|
||
{% if depth == 0 and fos_comment_can_comment_thread(thread) %} | ||
{% render "FOSCommentBundle:Thread:newThreadComments" with {"id": thread.id} %} | ||
{% endif %} | ||
|
||
{% for commentinfo in comments %} | ||
{% include "FOSCommentBundle:Thread:comment.html.twig" with { "children": commentinfo.children, "comment": commentinfo.comment, "depth": depth, "view": view } %} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{# | ||
This file is part of the FOSCommentBundle package. | ||
(c) FriendsOfSymfony <http://friendsofsymfony.github.com/> | ||
This source file is subject to the MIT license that is bundled | ||
with this source code in the file LICENSE. | ||
#} | ||
|
||
<form class="fos_comment_comment_form" action="{{ url('fos_comment_post_threads') }}" method="POST"> | ||
|
||
{% block fos_comment_form_fields %} | ||
{{ form_errors(form) }} | ||
{{ form_errors(form.id) }} | ||
{{ form_widget(form.id) }} | ||
{{ form_errors(form.permalink) }} | ||
{{ form_widget(form.permalink) }} | ||
|
||
{{ form_rest(form) }} | ||
{% endblock %} | ||
|
||
<div class="fos_comment_submit"> | ||
{% block fos_comment_form_submit %} | ||
<input type="submit" value="{% trans from 'FOSCommentBundle' %}fos_comment_comment_new_submit{% endtrans %}" /> | ||
{% endblock %} | ||
</div> | ||
|
||
</form> |