From 3a69565ecb07bee62db7b12f48d2367e990f6786 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Fri, 18 Aug 2023 18:56:17 +0300 Subject: [PATCH] Fixing posts web controllers, templates and entities. --- composer.json | 2 + composer.lock | 482 +++++++++++++++++- .../views/Post/comment_list.html.twig | 3 - .../views/Post/comments_list.html.twig | 5 - .../views/Post/comments_tree.html.twig | 5 - .../Resources/views/Post/show.html.twig | 7 - src/Controller/PostController.php | 8 +- src/Controller/PublicFeedController.php | 4 +- src/Entity/Blog/Post.php | 6 +- src/Entity/User.php | 5 + .../Web}/Post/base_feed.html.twig | 2 +- templates/Web/Post/comment_list.html.twig | 3 + .../Web}/Post/comment_tree.html.twig | 2 +- templates/Web/Post/comments_list.html.twig | 5 + templates/Web/Post/comments_tree.html.twig | 5 + .../Web}/Post/feed.html.twig | 6 +- .../Web}/Post/post.html.twig | 12 +- templates/Web/Post/show.html.twig | 7 + 18 files changed, 526 insertions(+), 43 deletions(-) delete mode 100644 old/src/PointToolsBundle/Resources/views/Post/comment_list.html.twig delete mode 100644 old/src/PointToolsBundle/Resources/views/Post/comments_list.html.twig delete mode 100644 old/src/PointToolsBundle/Resources/views/Post/comments_tree.html.twig delete mode 100644 old/src/PointToolsBundle/Resources/views/Post/show.html.twig rename {old/src/PointToolsBundle/Resources/views => templates/Web}/Post/base_feed.html.twig (89%) create mode 100644 templates/Web/Post/comment_list.html.twig rename {old/src/PointToolsBundle/Resources/views => templates/Web}/Post/comment_tree.html.twig (95%) create mode 100644 templates/Web/Post/comments_list.html.twig create mode 100644 templates/Web/Post/comments_tree.html.twig rename {old/src/PointToolsBundle/Resources/views => templates/Web}/Post/feed.html.twig (70%) rename {old/src/PointToolsBundle/Resources/views => templates/Web}/Post/post.html.twig (77%) create mode 100644 templates/Web/Post/show.html.twig diff --git a/composer.json b/composer.json index 92655e1..45649a3 100644 --- a/composer.json +++ b/composer.json @@ -15,6 +15,7 @@ "doctrine/orm": "^2.14", "jms/serializer-bundle": "^5.2", "knplabs/knp-paginator-bundle": "^6.2", + "league/commonmark": "^2.4", "phpdocumentor/reflection-docblock": "^5.3", "phpstan/phpdoc-parser": "^1.16", "sensio/framework-extra-bundle": "^6.1", @@ -39,6 +40,7 @@ "symfony/yaml": "6.3.*", "telegram-bot/api": "^2.3", "twig/extra-bundle": "^2.12|^3.0", + "twig/markdown-extra": "^3.7", "twig/twig": "^2.12|^3.0" }, "config": { diff --git a/composer.lock b/composer.lock index c299085..950d51c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,83 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "79648732c4eb68062e080a5c4e5c25b7", + "content-hash": "6088d0629768085da296aa5598445c4f", "packages": [ + { + "name": "dflydev/dot-access-data", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/dflydev/dflydev-dot-access-data.git", + "reference": "f41715465d65213d644d3141a6a93081be5d3549" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-data/zipball/f41715465d65213d644d3141a6a93081be5d3549", + "reference": "f41715465d65213d644d3141a6a93081be5d3549", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^0.12.42", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.3", + "scrutinizer/ocular": "1.6.0", + "squizlabs/php_codesniffer": "^3.5", + "vimeo/psalm": "^4.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Dflydev\\DotAccessData\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dragonfly Development Inc.", + "email": "info@dflydev.com", + "homepage": "http://dflydev.com" + }, + { + "name": "Beau Simensen", + "email": "beau@dflydev.com", + "homepage": "http://beausimensen.com" + }, + { + "name": "Carlos Frutos", + "email": "carlos@kiwing.it", + "homepage": "https://github.com/cfrutos" + }, + { + "name": "Colin O'Dell", + "email": "colinodell@gmail.com", + "homepage": "https://www.colinodell.com" + } + ], + "description": "Given a deep data structure, access data by dot notation.", + "homepage": "https://github.com/dflydev/dflydev-dot-access-data", + "keywords": [ + "access", + "data", + "dot", + "notation" + ], + "support": { + "issues": "https://github.com/dflydev/dflydev-dot-access-data/issues", + "source": "https://github.com/dflydev/dflydev-dot-access-data/tree/v3.0.2" + }, + "time": "2022-10-27T11:44:00+00:00" + }, { "name": "doctrine/annotations", "version": "2.0.1", @@ -1967,6 +2042,194 @@ }, "time": "2023-03-25T06:51:40+00:00" }, + { + "name": "league/commonmark", + "version": "2.4.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/commonmark.git", + "reference": "d44a24690f16b8c1808bf13b1bd54ae4c63ea048" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/d44a24690f16b8c1808bf13b1bd54ae4c63ea048", + "reference": "d44a24690f16b8c1808bf13b1bd54ae4c63ea048", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "league/config": "^1.1.1", + "php": "^7.4 || ^8.0", + "psr/event-dispatcher": "^1.0", + "symfony/deprecation-contracts": "^2.1 || ^3.0", + "symfony/polyfill-php80": "^1.16" + }, + "require-dev": { + "cebe/markdown": "^1.0", + "commonmark/cmark": "0.30.0", + "commonmark/commonmark.js": "0.30.0", + "composer/package-versions-deprecated": "^1.8", + "embed/embed": "^4.4", + "erusev/parsedown": "^1.0", + "ext-json": "*", + "github/gfm": "0.29.0", + "michelf/php-markdown": "^1.4 || ^2.0", + "nyholm/psr7": "^1.5", + "phpstan/phpstan": "^1.8.2", + "phpunit/phpunit": "^9.5.21", + "scrutinizer/ocular": "^1.8.1", + "symfony/finder": "^5.3 | ^6.0", + "symfony/yaml": "^2.3 | ^3.0 | ^4.0 | ^5.0 | ^6.0", + "unleashedtech/php-coding-standard": "^3.1.1", + "vimeo/psalm": "^4.24.0 || ^5.0.0" + }, + "suggest": { + "symfony/yaml": "v2.3+ required if using the Front Matter extension" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + } + }, + "autoload": { + "psr-4": { + "League\\CommonMark\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Colin O'Dell", + "email": "colinodell@gmail.com", + "homepage": "https://www.colinodell.com", + "role": "Lead Developer" + } + ], + "description": "Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)", + "homepage": "https://commonmark.thephpleague.com", + "keywords": [ + "commonmark", + "flavored", + "gfm", + "github", + "github-flavored", + "markdown", + "md", + "parser" + ], + "support": { + "docs": "https://commonmark.thephpleague.com/", + "forum": "https://github.com/thephpleague/commonmark/discussions", + "issues": "https://github.com/thephpleague/commonmark/issues", + "rss": "https://github.com/thephpleague/commonmark/releases.atom", + "source": "https://github.com/thephpleague/commonmark" + }, + "funding": [ + { + "url": "https://www.colinodell.com/sponsor", + "type": "custom" + }, + { + "url": "https://www.paypal.me/colinpodell/10.00", + "type": "custom" + }, + { + "url": "https://github.com/colinodell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/league/commonmark", + "type": "tidelift" + } + ], + "time": "2023-03-24T15:16:10+00:00" + }, + { + "name": "league/config", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/config.git", + "reference": "754b3604fb2984c71f4af4a9cbe7b57f346ec1f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/config/zipball/754b3604fb2984c71f4af4a9cbe7b57f346ec1f3", + "reference": "754b3604fb2984c71f4af4a9cbe7b57f346ec1f3", + "shasum": "" + }, + "require": { + "dflydev/dot-access-data": "^3.0.1", + "nette/schema": "^1.2", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.8.2", + "phpunit/phpunit": "^9.5.5", + "scrutinizer/ocular": "^1.8.1", + "unleashedtech/php-coding-standard": "^3.1", + "vimeo/psalm": "^4.7.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.2-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Config\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Colin O'Dell", + "email": "colinodell@gmail.com", + "homepage": "https://www.colinodell.com", + "role": "Lead Developer" + } + ], + "description": "Define configuration arrays with strict schemas and access values with dot notation", + "homepage": "https://config.thephpleague.com", + "keywords": [ + "array", + "config", + "configuration", + "dot", + "dot-access", + "nested", + "schema" + ], + "support": { + "docs": "https://config.thephpleague.com/", + "issues": "https://github.com/thephpleague/config/issues", + "rss": "https://github.com/thephpleague/config/releases.atom", + "source": "https://github.com/thephpleague/config" + }, + "funding": [ + { + "url": "https://www.colinodell.com/sponsor", + "type": "custom" + }, + { + "url": "https://www.paypal.me/colinpodell/10.00", + "type": "custom" + }, + { + "url": "https://github.com/colinodell", + "type": "github" + } + ], + "time": "2022-12-11T20:36:23+00:00" + }, { "name": "monolog/monolog", "version": "3.4.0", @@ -2068,6 +2331,155 @@ ], "time": "2023-06-21T08:46:11+00:00" }, + { + "name": "nette/schema", + "version": "v1.2.4", + "source": { + "type": "git", + "url": "https://github.com/nette/schema.git", + "reference": "c9ff517a53903b3d4e29ec547fb20feecb05b8ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/schema/zipball/c9ff517a53903b3d4e29ec547fb20feecb05b8ab", + "reference": "c9ff517a53903b3d4e29ec547fb20feecb05b8ab", + "shasum": "" + }, + "require": { + "nette/utils": "^2.5.7 || ^3.1.5 || ^4.0", + "php": "7.1 - 8.3" + }, + "require-dev": { + "nette/tester": "^2.3 || ^2.4", + "phpstan/phpstan-nette": "^1.0", + "tracy/tracy": "^2.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0-only", + "GPL-3.0-only" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "📐 Nette Schema: validating data structures against a given Schema.", + "homepage": "https://nette.org", + "keywords": [ + "config", + "nette" + ], + "support": { + "issues": "https://github.com/nette/schema/issues", + "source": "https://github.com/nette/schema/tree/v1.2.4" + }, + "time": "2023-08-05T18:56:25+00:00" + }, + { + "name": "nette/utils", + "version": "v4.0.1", + "source": { + "type": "git", + "url": "https://github.com/nette/utils.git", + "reference": "9124157137da01b1f5a5a22d6486cb975f26db7e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/utils/zipball/9124157137da01b1f5a5a22d6486cb975f26db7e", + "reference": "9124157137da01b1f5a5a22d6486cb975f26db7e", + "shasum": "" + }, + "require": { + "php": ">=8.0 <8.4" + }, + "conflict": { + "nette/finder": "<3", + "nette/schema": "<1.2.2" + }, + "require-dev": { + "jetbrains/phpstorm-attributes": "dev-master", + "nette/tester": "^2.5", + "phpstan/phpstan": "^1.0", + "tracy/tracy": "^2.9" + }, + "suggest": { + "ext-gd": "to use Image", + "ext-iconv": "to use Strings::webalize(), toAscii(), chr() and reverse()", + "ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()", + "ext-json": "to use Nette\\Utils\\Json", + "ext-mbstring": "to use Strings::lower() etc...", + "ext-tokenizer": "to use Nette\\Utils\\Reflection::getUseStatements()", + "ext-xml": "to use Strings::length() etc. when mbstring is not available" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0-only", + "GPL-3.0-only" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", + "homepage": "https://nette.org", + "keywords": [ + "array", + "core", + "datetime", + "images", + "json", + "nette", + "paginator", + "password", + "slugify", + "string", + "unicode", + "utf-8", + "utility", + "validation" + ], + "support": { + "issues": "https://github.com/nette/utils/issues", + "source": "https://github.com/nette/utils/tree/v4.0.1" + }, + "time": "2023-07-30T15:42:21+00:00" + }, { "name": "phpdocumentor/reflection-common", "version": "2.2.0", @@ -7030,6 +7442,74 @@ ], "time": "2023-05-06T11:11:46+00:00" }, + { + "name": "twig/markdown-extra", + "version": "v3.7.0", + "source": { + "type": "git", + "url": "https://github.com/twigphp/markdown-extra.git", + "reference": "8f1179e279cea6ef14066a4560b859df58acd5d8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/markdown-extra/zipball/8f1179e279cea6ef14066a4560b859df58acd5d8", + "reference": "8f1179e279cea6ef14066a4560b859df58acd5d8", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "twig/twig": "^2.7|^3.0" + }, + "require-dev": { + "erusev/parsedown": "^1.7", + "league/commonmark": "^1.0|^2.0", + "league/html-to-markdown": "^4.8|^5.0", + "michelf/php-markdown": "^1.8|^2.0", + "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Twig\\Extra\\Markdown\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + } + ], + "description": "A Twig extension for Markdown", + "homepage": "https://twig.symfony.com", + "keywords": [ + "html", + "markdown", + "twig" + ], + "support": { + "source": "https://github.com/twigphp/markdown-extra/tree/v3.7.0" + }, + "funding": [ + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/twig/twig", + "type": "tidelift" + } + ], + "time": "2023-02-09T06:45:16+00:00" + }, { "name": "twig/twig", "version": "v3.7.0", diff --git a/old/src/PointToolsBundle/Resources/views/Post/comment_list.html.twig b/old/src/PointToolsBundle/Resources/views/Post/comment_list.html.twig deleted file mode 100644 index 0187aed..0000000 --- a/old/src/PointToolsBundle/Resources/views/Post/comment_list.html.twig +++ /dev/null @@ -1,3 +0,0 @@ -{% extends '@SkobkinPointTools/Post/comment_tree.html.twig' %} - -{% block comment_children %}{% endblock %} \ No newline at end of file diff --git a/old/src/PointToolsBundle/Resources/views/Post/comments_list.html.twig b/old/src/PointToolsBundle/Resources/views/Post/comments_list.html.twig deleted file mode 100644 index 962b54d..0000000 --- a/old/src/PointToolsBundle/Resources/views/Post/comments_list.html.twig +++ /dev/null @@ -1,5 +0,0 @@ -{% 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/old/src/PointToolsBundle/Resources/views/Post/comments_tree.html.twig b/old/src/PointToolsBundle/Resources/views/Post/comments_tree.html.twig deleted file mode 100644 index b011791..0000000 --- a/old/src/PointToolsBundle/Resources/views/Post/comments_tree.html.twig +++ /dev/null @@ -1,5 +0,0 @@ -{% 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/old/src/PointToolsBundle/Resources/views/Post/show.html.twig b/old/src/PointToolsBundle/Resources/views/Post/show.html.twig deleted file mode 100644 index 23fc3e8..0000000 --- a/old/src/PointToolsBundle/Resources/views/Post/show.html.twig +++ /dev/null @@ -1,7 +0,0 @@ -{% extends 'SkobkinPointToolsBundle:Post:base_feed.html.twig' %} - -{% block header_title %}#{{ post.id }} @ Point Tools{% endblock %} - -{% block content %} - {% include 'SkobkinPointToolsBundle:Post:post.html.twig' with {'post': post} %} -{% endblock %} diff --git a/src/Controller/PostController.php b/src/Controller/PostController.php index dd58c86..7b5b3c6 100644 --- a/src/Controller/PostController.php +++ b/src/Controller/PostController.php @@ -3,7 +3,6 @@ declare(strict_types=1); namespace App\Controller; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use App\Entity\Blog\Post; use App\Repository\Blog\PostRepository; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -11,12 +10,9 @@ use Symfony\Component\HttpFoundation\Response; class PostController extends AbstractController { - /** - * @ParamConverter("post", class="SkobkinPointToolsBundle:Blogs\Post") - */ public function show(Post $post, PostRepository $postRepository): Response { - if ((!$post->getAuthor()->isPublic()) || $post->getAuthor()->isWhitelistOnly()) { + if ($post->getAuthor()->isPrivate()) { /** * Throwing 404 instead of 403 because of * @see \Symfony\Component\Security\Http\Firewall\ExceptionListener::handleAccessDeniedException() @@ -26,7 +22,7 @@ class PostController extends AbstractController //throw $this->createAccessDeniedException('Author\'s blog is private.'); } - return $this->render('SkobkinPointToolsBundle:Post:show.html.twig', [ + return $this->render('Web/Post/show.html.twig', [ 'post' => $postRepository->getPostWithComments($post->getId()), ]); } diff --git a/src/Controller/PublicFeedController.php b/src/Controller/PublicFeedController.php index 5ee067d..7407612 100644 --- a/src/Controller/PublicFeedController.php +++ b/src/Controller/PublicFeedController.php @@ -21,10 +21,8 @@ class PublicFeedController extends AbstractController ); return $this->render( - 'SkobkinPointToolsBundle:Post:feed.html.twig', + 'Web/Post/feed.html.twig', [ - // @todo Move to translation - 'feed_title' => 'Public feed', 'posts' => $postsPagination, // Special feed mark (to not show comments and other) 'is_feed' => true, diff --git a/src/Entity/Blog/Post.php b/src/Entity/Blog/Post.php index b1f8037..6d54704 100644 --- a/src/Entity/Blog/Post.php +++ b/src/Entity/Blog/Post.php @@ -5,13 +5,13 @@ namespace App\Entity\Blog; use App\Entity\User; use App\Enum\Blog\PostTypeEnum; -use App\Repository\Blog\TagRepository; +use App\Repository\Blog\PostRepository; use Doctrine\Common\Collections\{ArrayCollection, Collection}; use Doctrine\ORM\Mapping as ORM; -#[ORM\Entity(repositoryClass: TagRepository::class)] +#[ORM\Entity(repositoryClass: PostRepository::class)] #[ORM\HasLifecycleCallbacks] -#[ORM\Table(name: 'tags', schema: 'posts')] +#[ORM\Table(name: 'posts', schema: 'posts')] class Post { #[ORM\Id] diff --git a/src/Entity/User.php b/src/Entity/User.php index 2d72bee..019923c 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -155,6 +155,11 @@ class User return $this->public; } + public function isPrivate(): bool + { + return !$this->public || $this->whitelistOnly; + } + public function isWhitelistOnly(): bool { return $this->whitelistOnly; diff --git a/old/src/PointToolsBundle/Resources/views/Post/base_feed.html.twig b/templates/Web/Post/base_feed.html.twig similarity index 89% rename from old/src/PointToolsBundle/Resources/views/Post/base_feed.html.twig rename to templates/Web/Post/base_feed.html.twig index 09d59c3..8d3c54c 100644 --- a/old/src/PointToolsBundle/Resources/views/Post/base_feed.html.twig +++ b/templates/Web/Post/base_feed.html.twig @@ -1,4 +1,4 @@ -{% extends "::base.html.twig" %} +{% extends 'Web/base.html.twig' %} {% block css %} {{ parent() }} diff --git a/templates/Web/Post/comment_list.html.twig b/templates/Web/Post/comment_list.html.twig new file mode 100644 index 0000000..8679052 --- /dev/null +++ b/templates/Web/Post/comment_list.html.twig @@ -0,0 +1,3 @@ +{% extends 'Web/Post/comment_tree.html.twig' %} + +{% block comment_children %}{% endblock %} \ No newline at end of file diff --git a/old/src/PointToolsBundle/Resources/views/Post/comment_tree.html.twig b/templates/Web/Post/comment_tree.html.twig similarity index 95% rename from old/src/PointToolsBundle/Resources/views/Post/comment_tree.html.twig rename to templates/Web/Post/comment_tree.html.twig index 390b36d..ca748b5 100644 --- a/old/src/PointToolsBundle/Resources/views/Post/comment_tree.html.twig +++ b/templates/Web/Post/comment_tree.html.twig @@ -39,7 +39,7 @@ {% block comment_children %} {% if comment.children|length > 0 %}
- {% include '@SkobkinPointTools/Post/comments_tree.html.twig' with { + {% include 'Web/Post/comments_tree.html.twig' with { 'comments': comment.children } only %}
diff --git a/templates/Web/Post/comments_list.html.twig b/templates/Web/Post/comments_list.html.twig new file mode 100644 index 0000000..528864e --- /dev/null +++ b/templates/Web/Post/comments_list.html.twig @@ -0,0 +1,5 @@ +{% if comments|length > 0 %} + {% for comment in comments %} + {% include 'Web/Post/comment_list.html.twig' with {'comment': comment} only %} + {% endfor %} +{% endif %} \ No newline at end of file diff --git a/templates/Web/Post/comments_tree.html.twig b/templates/Web/Post/comments_tree.html.twig new file mode 100644 index 0000000..58c90a3 --- /dev/null +++ b/templates/Web/Post/comments_tree.html.twig @@ -0,0 +1,5 @@ +{% if comments|length > 0 %} + {% for comment in comments %} + {% include 'Web/Post/comment_tree.html.twig' with {'comment': comment} only %} + {% endfor %} +{% endif %} \ No newline at end of file diff --git a/old/src/PointToolsBundle/Resources/views/Post/feed.html.twig b/templates/Web/Post/feed.html.twig similarity index 70% rename from old/src/PointToolsBundle/Resources/views/Post/feed.html.twig rename to templates/Web/Post/feed.html.twig index a9da234..2c2cf2d 100644 --- a/old/src/PointToolsBundle/Resources/views/Post/feed.html.twig +++ b/templates/Web/Post/feed.html.twig @@ -1,6 +1,6 @@ -{% extends 'SkobkinPointToolsBundle:Post:base_feed.html.twig' %} +{% extends 'Web/Post/base_feed.html.twig' %} -{% block header_title %}{{ feed_title|trans }} @ Point Tools{% endblock %} +{% block header_title %}{{ 'Public feed' | trans }} @ Point Tools{% endblock %} {% block content %} {% if is_feed is defined %} @@ -11,7 +11,7 @@ {% for post in posts %}
- {% include 'SkobkinPointToolsBundle:Post:post.html.twig' with { + {% include 'Web/Post/post.html.twig' with { 'post': post, 'is_feed': is_feed } %} diff --git a/old/src/PointToolsBundle/Resources/views/Post/post.html.twig b/templates/Web/Post/post.html.twig similarity index 77% rename from old/src/PointToolsBundle/Resources/views/Post/post.html.twig rename to templates/Web/Post/post.html.twig index 9c46955..cddf82c 100644 --- a/old/src/PointToolsBundle/Resources/views/Post/post.html.twig +++ b/templates/Web/Post/post.html.twig @@ -15,7 +15,9 @@
- {{ post.text|markdown('app.point.markdown_parser') }} + {# Until Point native Markdown parser is ported, use Twig's parser #} + {# {{ post.text|markdown('app.point.markdown_parser') }}#} + {{ post.text | markdown_to_html }}
@@ -33,13 +35,13 @@ {% if is_feed is not defined and post.comments|length > 0 %}
- {# - {% include '@SkobkinPointTools/Post/comments_tree.html.twig' with { + {# + {% include 'Web/Post/comments_tree.html.twig' with { 'comments': post.firstLevelComments } only %} - #} + #} - {% include 'SkobkinPointToolsBundle:Post:comments_list.html.twig' with { + {% include 'Web/Post/comments_list.html.twig' with { 'comments': post.comments } %}
diff --git a/templates/Web/Post/show.html.twig b/templates/Web/Post/show.html.twig new file mode 100644 index 0000000..bbd1e2e --- /dev/null +++ b/templates/Web/Post/show.html.twig @@ -0,0 +1,7 @@ +{% extends 'Web/Post/base_feed.html.twig' %} + +{% block header_title %}#{{ post.id }} @ Point Tools{% endblock %} + +{% block content %} + {% include 'Web/Post/post.html.twig' with {'post': post} %} +{% endblock %}