User page prototype.

This commit is contained in:
Alexey Skobkin 2015-05-31 05:48:12 +03:00
parent af94e84256
commit 24793120ff
5 changed files with 124 additions and 14 deletions

View file

@ -1,6 +1,6 @@
{% extends '::layout.html.twig' %}
{% block header_title %}Point-Tools{% endblock %}
{% block header_title %}Point Tools{% endblock %}
{% block css %}
{{ parent() }}
@ -19,13 +19,13 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{{ path('index') }}">Point-Tools</a>
<a class="navbar-brand" href="{{ path('index') }}">Point Tools</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
{% block header_navbar_menus %}
<ul class="nav navbar-nav">
<li><a href="{{ path('index') }}">{{ 'Main'|trans }}</a></li>
<li><a href="{{ path('users_top') }}">TOP</a></li>
<li><a href="{{ path('index') }}"><span class="glyphicon glyphicon-home"></span> {{ 'Main'|trans }}</a></li>
<li><a href="{{ path('users_top') }}"><span class="glyphicon glyphicon-stats"></span> TOP</a></li>
</ul>
{% endblock %}
</div>
@ -45,7 +45,7 @@
<div class="copyright col-sm-6 col-xs-12">
<p>
&copy; 2015{% if 2015 != 'now'|date('Y') %}-{{ 'now'|date('Y') }}{% endif %}
<a href="https://skobk.in/" target="_blank">Alexey Skobkin</a>
<a href="https://skobk.in/" target="_blank">Alexey Skobkin</a> aka <a href="https://skobkin-ru.point.im/" target="_blank">@skobkin-ru</a>
</p>
</div>
</div>

View file

@ -25,6 +25,11 @@ framework:
fragments: ~
http_method_override: true
sensio_framework_extra:
request:
converters: true
auto_convert: false
# Twig Configuration
twig:
debug: "%kernel.debug%"

View file

@ -4,13 +4,38 @@ namespace Skobkin\Bundle\PointToolsBundle\Controller;
use Doctrine\DBAL\Query\QueryBuilder;
use Doctrine\ORM\EntityManager;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Skobkin\Bundle\PointToolsBundle\Entity\User;
use Skobkin\Bundle\PointToolsBundle\Service\UserApi;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class UserController extends Controller
{
public function showAction($login)
/**
* @param
* @ParamConverter("user", class="SkobkinPointToolsBundle:User", options={"login" = "login"})
*/
public function showAction(User $user)
{
return $this->render('SkobkinPointToolsBundle:User:show.html.twig', []);
$userApi = $this->container->get('skobkin_point_tools.api_user');
/** @var QueryBuilder $qb */
$qb = $this->getDoctrine()->getManager()->getRepository('SkobkinPointToolsBundle:SubscriptionEvent')->createQueryBuilder('se');
$subscriptionsEvents = $qb
->select()
->where('se.author = :author')
->orderBy('se.date', 'desc')
->setMaxResults(30)
->setParameter('author', $user)
->getQuery()->getResult()
;
return $this->render('SkobkinPointToolsBundle:User:show.html.twig', [
'user' => $user,
'log' => $subscriptionsEvents,
'avatar_url' => $userApi->getAvatarUrl($user, UserApi::AVATAR_SIZE_LARGE),
]);
}
public function topAction()

View file

@ -34,6 +34,14 @@ body > .container {
padding: 60px 15px 0;
}
.user-subscribers {
margin-top: 30px;
}
h4.panel-title a {
text-decoration: none;
}
.user:before {
position: relative;
top: 1px;
@ -58,11 +66,18 @@ body > .container {
}
h1.user-login a {
text-decoration: none;
margin-left: 10px;
}
ul.users.mosaic {
list-style: none;
columns: 140px auto;
-webkit-columns: 140px auto;
-moz-columns: 140px auto;
padding-left: 0px;
margin-left: 8px;
}
ul.users.mosaic li {
@ -79,10 +94,6 @@ ul.users.mosaic li:nth-child(odd) {
background-color: #EFEFEF;
}
#travel-client-data-form {
margin-top: 20px;
}
/* Required quick fix */
.required:after {
content: " *";

View file

@ -1,7 +1,76 @@
{% extends "::base.html.twig" %}
{% block title %}SkobkinPointToolsBundle:User:show{% endblock %}
{% block header_title %}{{ user.login }} @ Point Tools{% endblock %}
{% block body %}
<h1>Welcome to the User:show page</h1>
{% block content %}
<h1 class="user-login">
<img src="{{ avatar_url }}">
<a href="//{{ user.login }}.point.im/blog/" target="_blank">{{ user.login }}</a>
</h1>
<div class="user-subscribers">
<div class="panel-group" id="accordion-subscribers">
<div class="panel panel-default">
<div class="panel-heading"id="headingOne">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion-subscribers" aria-expanded="true" href="#collapse-subscribers">
<span class="glyphicon glyphicon-collapse-down"></span> {{ 'Subscribers'|trans }}
</a>
</h4>
</div>
<div id="collapse-subscribers" class="panel-collapse collapse in">
<div class="panel-body">
<ul class="users mosaic">
{% for sub in user.subscribers %}
<li><a href="{{ url('user_show', {login: sub.subscriber.login}) }}" {# class="user" #}>@{{ sub.subscriber.login }}</a></li>
{% endfor %}
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="user-subscribers">
<div class="panel-group" id="accordion-log">
<div class="panel panel-default">
<div class="panel-heading" id="headingOne">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion-log" aria-expanded="true" href="#collapse-log">
<span class="glyphicon glyphicon-collapse-down"></span> {{ 'Subscriptions log'|trans }}
</a>
</h4>
</div>
<div id="collapse-log" class="panel-collapse collapse in">
<div class="panel-body">
<table class="table table-striped">
<thead>
<tr>
<td>{{ 'User'|trans }}</td>
<td>{{ 'Action'|trans }}</td>
<td>{{ 'Date'|trans }}</td>
</tr>
</thead>
<tbody>
{% for event in log %}
<tr>
<td>
<a href="{{ url('user_show', {login: event.subscriber.login}) }}" {# class="user" #}>@{{ event.subscriber.login }}</a>
</td>
<td>
<span class="glyphicon glyphicon-plus"></span>
</td>
<td>
{# Use DateTime helper: https://sonata-project.org/bundles/intl/master/doc/reference/datetime.html #}
{{ event.date|date('H:i:s d F Y') }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
{% endblock %}