Basic post page implemented.
This commit is contained in:
parent
f919740524
commit
f0ed72aa36
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Skobkin\Bundle\PointToolsBundle\Controller;
|
||||||
|
|
||||||
|
use Skobkin\Bundle\PointToolsBundle\Entity\Blogs\Post;
|
||||||
|
use Skobkin\Bundle\PointToolsBundle\Service\UserApi;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
|
class PostController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @ParamConverter("post", class="SkobkinPointToolsBundle:Blogs\Post")
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function showAction(Post $post)
|
||||||
|
{
|
||||||
|
$userApi = $this->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),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -3,7 +3,7 @@ index:
|
||||||
defaults: { _controller: SkobkinPointToolsBundle:Main:index }
|
defaults: { _controller: SkobkinPointToolsBundle:Main:index }
|
||||||
|
|
||||||
user_search:
|
user_search:
|
||||||
path: /search
|
path: /user/search
|
||||||
defaults: { _controller: SkobkinPointToolsBundle:User:searchUser }
|
defaults: { _controller: SkobkinPointToolsBundle:User:searchUser }
|
||||||
methods: [POST]
|
methods: [POST]
|
||||||
|
|
||||||
|
@ -14,13 +14,19 @@ user_show:
|
||||||
login: "[\w-]+"
|
login: "[\w-]+"
|
||||||
|
|
||||||
users_top:
|
users_top:
|
||||||
path: /top
|
path: /users/top
|
||||||
defaults: { _controller: SkobkinPointToolsBundle:User:top }
|
defaults: { _controller: SkobkinPointToolsBundle:User:top }
|
||||||
|
|
||||||
events_last:
|
events_last:
|
||||||
path: /last
|
path: /events/last
|
||||||
defaults: { _controller: SkobkinPointToolsBundle:Events:last }
|
defaults: { _controller: SkobkinPointToolsBundle:Events:last }
|
||||||
|
|
||||||
|
post_show:
|
||||||
|
path: /{id}
|
||||||
|
defaults: { _controller: SkobkinPointToolsBundle:Post:show }
|
||||||
|
requirements:
|
||||||
|
id: "[a-z]+"
|
||||||
|
|
||||||
api_public:
|
api_public:
|
||||||
resource: "@SkobkinPointToolsBundle/Resources/config/api/public.yml"
|
resource: "@SkobkinPointToolsBundle/Resources/config/api/public.yml"
|
||||||
prefix: /api/v1
|
prefix: /api/v1
|
||||||
|
|
|
@ -103,3 +103,14 @@ ul.users.mosaic li:nth-child(odd) {
|
||||||
content: " *";
|
content: " *";
|
||||||
color: red;
|
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;
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
{% extends "::base.html.twig" %}
|
||||||
|
|
||||||
|
{% block title %}SkobkinPointToolsBundle:Post:show{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-1">
|
||||||
|
<img src="{{ avatar_url }}" alt="Avatar">
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-11">
|
||||||
|
<a href="{{ path('user_show', {'login': post.author.login}) }}">@{{ post.author.login }}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
{{ post.text }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
{% for file in post.files %}
|
||||||
|
<div class="post-attachment">
|
||||||
|
<img src="{{ file.remoteUrl }}" />
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
{% for pt in post.postTags %}
|
||||||
|
<a href="#" class="tag">{{ pt.text }}</a>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12"><a href="https://point.im/{{ post.id }}">#{{ post.id }}</a></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
Loading…
Reference in a new issue