From f0ed72aa366c9319a2ae9596af5a20a5102131ce Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Fri, 25 Mar 2016 01:10:10 +0300 Subject: [PATCH] Basic post page implemented. --- .../Controller/PostController.php | 28 +++++++++++++ .../Resources/config/routing.yml | 14 +++++-- .../Resources/public/css/main.css | 11 +++++ .../Resources/views/Post/show.html.twig | 40 +++++++++++++++++++ 4 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 src/Skobkin/Bundle/PointToolsBundle/Controller/PostController.php create mode 100644 src/Skobkin/Bundle/PointToolsBundle/Resources/views/Post/show.html.twig diff --git a/src/Skobkin/Bundle/PointToolsBundle/Controller/PostController.php b/src/Skobkin/Bundle/PointToolsBundle/Controller/PostController.php new file mode 100644 index 0000000..4ce4266 --- /dev/null +++ b/src/Skobkin/Bundle/PointToolsBundle/Controller/PostController.php @@ -0,0 +1,28 @@ +container->get('skobkin_point_tools.api_user'); + + return $this->render('SkobkinPointToolsBundle:Post:show.html.twig', [ + 'post' => $post, + 'avatar_url' => $userApi->getAvatarUrl($post->getAuthor(), UserApi::AVATAR_SIZE_LARGE), + ]); + } + +} diff --git a/src/Skobkin/Bundle/PointToolsBundle/Resources/config/routing.yml b/src/Skobkin/Bundle/PointToolsBundle/Resources/config/routing.yml index 7010723..a5c24e8 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Resources/config/routing.yml +++ b/src/Skobkin/Bundle/PointToolsBundle/Resources/config/routing.yml @@ -3,7 +3,7 @@ index: defaults: { _controller: SkobkinPointToolsBundle:Main:index } user_search: - path: /search + path: /user/search defaults: { _controller: SkobkinPointToolsBundle:User:searchUser } methods: [POST] @@ -14,17 +14,23 @@ user_show: login: "[\w-]+" users_top: - path: /top + path: /users/top defaults: { _controller: SkobkinPointToolsBundle:User:top } events_last: - path: /last + path: /events/last defaults: { _controller: SkobkinPointToolsBundle:Events:last } +post_show: + path: /{id} + defaults: { _controller: SkobkinPointToolsBundle:Post:show } + requirements: + id: "[a-z]+" + api_public: resource: "@SkobkinPointToolsBundle/Resources/config/api/public.yml" prefix: /api/v1 api_crawler: resource: "@SkobkinPointToolsBundle/Resources/config/api/crawler.yml" - prefix: /api/crawler \ No newline at end of file + prefix: /api/crawler diff --git a/src/Skobkin/Bundle/PointToolsBundle/Resources/public/css/main.css b/src/Skobkin/Bundle/PointToolsBundle/Resources/public/css/main.css index 167a190..dd8cc37 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Resources/public/css/main.css +++ b/src/Skobkin/Bundle/PointToolsBundle/Resources/public/css/main.css @@ -103,3 +103,14 @@ ul.users.mosaic li:nth-child(odd) { content: " *"; color: red; } + +a.tag { + position: relative; + display: inline-block; + margin: .8em .8em 0 0; + padding: .25em .5em; + background: #ebeef2; + /* font-size: .85em; */ + color: #35587c; + text-decoration: none; +} \ 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 new file mode 100644 index 0000000..9594c6e --- /dev/null +++ b/src/Skobkin/Bundle/PointToolsBundle/Resources/views/Post/show.html.twig @@ -0,0 +1,40 @@ +{% extends "::base.html.twig" %} + +{% block title %}SkobkinPointToolsBundle:Post:show{% endblock %} + +{% block content %} +
+
+
+ Avatar +
+ +
+
+
+ {{ post.text }} +
+
+
+
+ {% for file in post.files %} +
+ +
+ {% endfor %} +
+
+
+
+ {% for pt in post.postTags %} + {{ pt.text }} + {% endfor %} +
+
+ +
+{% endblock %}