From c880304ef5b3c6cc6b10644358fe49d33751d614 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Tue, 29 Mar 2016 07:13:01 +0300 Subject: [PATCH] Test post comments templates implementation. --- .../Resources/public/css/main.css | 17 +++++++ .../Resources/translations/messages.ru.yml | 3 ++ .../views/Post/comment_list.html.twig | 3 ++ .../views/Post/comment_tree.html.twig | 48 +++++++++++++++++++ .../views/Post/comments_list.html.twig | 5 ++ .../views/Post/comments_tree.html.twig | 5 ++ .../Resources/views/Post/show.html.twig | 18 ++++++- 7 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 src/Skobkin/Bundle/PointToolsBundle/Resources/views/Post/comment_list.html.twig create mode 100644 src/Skobkin/Bundle/PointToolsBundle/Resources/views/Post/comment_tree.html.twig create mode 100644 src/Skobkin/Bundle/PointToolsBundle/Resources/views/Post/comments_list.html.twig create mode 100644 src/Skobkin/Bundle/PointToolsBundle/Resources/views/Post/comments_tree.html.twig diff --git a/src/Skobkin/Bundle/PointToolsBundle/Resources/public/css/main.css b/src/Skobkin/Bundle/PointToolsBundle/Resources/public/css/main.css index a6f42c5..d849ba6 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Resources/public/css/main.css +++ b/src/Skobkin/Bundle/PointToolsBundle/Resources/public/css/main.css @@ -133,4 +133,21 @@ a.tag { a.post { font-weight: bold; +} + +/* Comments */ +.comment { + margin-top: 20px; +} + +.comment .comment-text { + margin-top: 5px; +} + +.comment .comment-footer .comment-number { + margin-top: -8px; +} + +.comments .children .comment { + margin-left: 20px; } \ No newline at end of file diff --git a/src/Skobkin/Bundle/PointToolsBundle/Resources/translations/messages.ru.yml b/src/Skobkin/Bundle/PointToolsBundle/Resources/translations/messages.ru.yml index 8aa3477..7a5f564 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Resources/translations/messages.ru.yml +++ b/src/Skobkin/Bundle/PointToolsBundle/Resources/translations/messages.ru.yml @@ -35,6 +35,9 @@ No subscribers data found: Информация о подписчиках отс No rename log data found: Лог переименований отсутствует No subscribers log data found: Лог подписчиков отсутствует +# Страница поста +in response to: в ответ на + # Топ пользователей Top users: Популярные пользователи Subscribers count: Подписчиков diff --git a/src/Skobkin/Bundle/PointToolsBundle/Resources/views/Post/comment_list.html.twig b/src/Skobkin/Bundle/PointToolsBundle/Resources/views/Post/comment_list.html.twig new file mode 100644 index 0000000..0187aed --- /dev/null +++ b/src/Skobkin/Bundle/PointToolsBundle/Resources/views/Post/comment_list.html.twig @@ -0,0 +1,3 @@ +{% extends '@SkobkinPointTools/Post/comment_tree.html.twig' %} + +{% block comment_children %}{% endblock %} \ No newline at end of file diff --git a/src/Skobkin/Bundle/PointToolsBundle/Resources/views/Post/comment_tree.html.twig b/src/Skobkin/Bundle/PointToolsBundle/Resources/views/Post/comment_tree.html.twig new file mode 100644 index 0000000..7fb3ec5 --- /dev/null +++ b/src/Skobkin/Bundle/PointToolsBundle/Resources/views/Post/comment_tree.html.twig @@ -0,0 +1,48 @@ + +
+
+
+
+
+ {{ comment.author.login }} avatar +
+ +
+
+
+ +
+
+ {{ comment.text|markdown('markdown.parser.point') }} +
+
+ +
+ +
+
+
+ + {% block comment_children %} + {% if comment.children|length > 0 %} +
+ {% include '@SkobkinPointTools/Post/comments_tree.html.twig' with { + 'comments': comment.children + } only %} +
+ {% endif %} + {% endblock %} +
\ No newline at end of file diff --git a/src/Skobkin/Bundle/PointToolsBundle/Resources/views/Post/comments_list.html.twig b/src/Skobkin/Bundle/PointToolsBundle/Resources/views/Post/comments_list.html.twig new file mode 100644 index 0000000..962b54d --- /dev/null +++ b/src/Skobkin/Bundle/PointToolsBundle/Resources/views/Post/comments_list.html.twig @@ -0,0 +1,5 @@ +{% if comments|length > 0 %} + {% for comment in comments %} + {% include '@SkobkinPointTools/Post/comment_list.html.twig' with {'comment': comment} only %} + {% endfor %} +{% endif %} \ No newline at end of file diff --git a/src/Skobkin/Bundle/PointToolsBundle/Resources/views/Post/comments_tree.html.twig b/src/Skobkin/Bundle/PointToolsBundle/Resources/views/Post/comments_tree.html.twig new file mode 100644 index 0000000..b011791 --- /dev/null +++ b/src/Skobkin/Bundle/PointToolsBundle/Resources/views/Post/comments_tree.html.twig @@ -0,0 +1,5 @@ +{% if comments|length > 0 %} + {% for comment in comments %} + {% include '@SkobkinPointTools/Post/comment_tree.html.twig' with {'comment': comment} only %} + {% endfor %} +{% endif %} \ No newline at end of file diff --git a/src/Skobkin/Bundle/PointToolsBundle/Resources/views/Post/show.html.twig b/src/Skobkin/Bundle/PointToolsBundle/Resources/views/Post/show.html.twig index 6884c45..20db784 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Resources/views/Post/show.html.twig +++ b/src/Skobkin/Bundle/PointToolsBundle/Resources/views/Post/show.html.twig @@ -16,7 +16,7 @@
- Avatar + Avatar
@{{ post.author.login }}
@@ -33,7 +33,7 @@ {{ post.text|markdown('markdown.parser.point') }}
-
+
{% for file in post.files %}
@@ -45,5 +45,19 @@ + + {% if post.comments|length > 0 %} +
+ {# + {% include '@SkobkinPointTools/Post/comments_tree.html.twig' with { + 'comments': post.firstLevelComments + } only %} + #} + + {% include '@SkobkinPointTools/Post/comments_list.html.twig' with { + 'comments': post.comments + } %} +
+ {% endif %}
{% endblock %}