Separate last events page.
This commit is contained in:
parent
5778404813
commit
27754e9134
|
@ -26,6 +26,7 @@
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
<li><a href="{{ path('index') }}"><span class="glyphicon glyphicon-home"></span> {{ 'Main'|trans }}</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'|trans }}</a></li>
|
<li><a href="{{ path('users_top') }}"><span class="glyphicon glyphicon-stats"></span> {{ 'Top'|trans }}</a></li>
|
||||||
|
<li><a href="{{ path('events_last') }}"><span class="glyphicon glyphicon-th-list"></span> {{ 'Last'|trans }}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="nav navbar-nav navbar-right">
|
||||||
<li><a href="https://bitbucket.org/skobkin/point-tools/issues?status=new&status=open" target="_blank"><span class="glyphicon glyphicon-envelope"></span> {{ 'Report a bug'|trans }}</a></li>
|
<li><a href="https://bitbucket.org/skobkin/point-tools/issues?status=new&status=open" target="_blank"><span class="glyphicon glyphicon-envelope"></span> {{ 'Report a bug'|trans }}</a></li>
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Skobkin\Bundle\PointToolsBundle\Controller;
|
||||||
|
|
||||||
|
use Doctrine\ORM\EntityManager;
|
||||||
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
|
|
||||||
|
class EventsController extends Controller
|
||||||
|
{
|
||||||
|
public function lastAction()
|
||||||
|
{
|
||||||
|
/** @var EntityManager $em */
|
||||||
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
return $this->render('SkobkinPointToolsBundle:Events:last.html.twig', [
|
||||||
|
'last_events' => $em->getRepository('SkobkinPointToolsBundle:SubscriptionEvent')->getLastSubscriptionEvents(20),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,3 +16,7 @@ user_show:
|
||||||
users_top:
|
users_top:
|
||||||
path: /top
|
path: /top
|
||||||
defaults: { _controller: SkobkinPointToolsBundle:User:top }
|
defaults: { _controller: SkobkinPointToolsBundle:User:top }
|
||||||
|
|
||||||
|
events_last:
|
||||||
|
path: /last
|
||||||
|
defaults: { _controller: SkobkinPointToolsBundle:Events:last }
|
|
@ -5,6 +5,7 @@ Toggle navigation: Переключить навигацию
|
||||||
Main: Главная
|
Main: Главная
|
||||||
Top: Топ
|
Top: Топ
|
||||||
Report a bug: Сообщить об ошибке
|
Report a bug: Сообщить об ошибке
|
||||||
|
Last: Последнее
|
||||||
|
|
||||||
# Подвал
|
# Подвал
|
||||||
Source code: Исходный код
|
Source code: Исходный код
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
{% extends "::base.html.twig" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{# TODO classes #}
|
||||||
|
<div class="last-subscriptions-log">
|
||||||
|
{% if last_events|length > 0 %}
|
||||||
|
<div class="panel-group" id="accordion-log">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading" id="heading-subscriptions-log">
|
||||||
|
<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> {{ 'Last events'|trans }}
|
||||||
|
</a>
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
<div id="collapse-log" class="panel-collapse collapse in" aria-labelledby="heading-subscriptions-log">
|
||||||
|
<div class="panel-body">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td>{{ 'Subscriber'|trans }}</td>
|
||||||
|
<td>{{ 'Author'|trans }}</td>
|
||||||
|
<td>{{ 'Action'|trans }}</td>
|
||||||
|
<td>{{ 'Date'|trans }}</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for event in last_events %}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="{{ url('user_show', {login: event.subscriber.login}) }}">@{{ event.subscriber.login }}</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="{{ url('user_show', {login: event.author.login}) }}">@{{ event.author.login }}</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span class="glyphicon {% if event.action == 'subscribe' %}glyphicon-plus{% elseif event.action == 'unsubscribe' %}glyphicon-minus{% endif %}"></span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{# Use DateTime helper: https://sonata-project.org/bundles/intl/master/doc/reference/datetime.html #}
|
||||||
|
{{ event.date|date('d F Y H:i:s') }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<div class="alert alert-warning" role="alert">{{ 'No log data found'|trans }}</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
|
@ -15,58 +15,6 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{# TODO classes #}
|
|
||||||
<div class="last-subscriptions-log">
|
|
||||||
{% if last_events|length > 0 %}
|
|
||||||
<div class="panel-group" id="accordion-log">
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading" id="heading-subscriptions-log">
|
|
||||||
<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> {{ 'Last events'|trans }}
|
|
||||||
</a>
|
|
||||||
</h4>
|
|
||||||
</div>
|
|
||||||
<div id="collapse-log" class="panel-collapse collapse in" aria-labelledby="heading-subscriptions-log">
|
|
||||||
<div class="panel-body">
|
|
||||||
<table class="table table-striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<td>{{ 'Subscriber'|trans }}</td>
|
|
||||||
<td>{{ 'Author'|trans }}</td>
|
|
||||||
<td>{{ 'Action'|trans }}</td>
|
|
||||||
<td>{{ 'Date'|trans }}</td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for event in last_events %}
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a href="{{ url('user_show', {login: event.subscriber.login}) }}">@{{ event.subscriber.login }}</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="{{ url('user_show', {login: event.author.login}) }}">@{{ event.author.login }}</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<span class="glyphicon {% if event.action == 'subscribe' %}glyphicon-plus{% elseif event.action == 'unsubscribe' %}glyphicon-minus{% endif %}"></span>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{# Use DateTime helper: https://sonata-project.org/bundles/intl/master/doc/reference/datetime.html #}
|
|
||||||
{{ event.date|date('d F Y H:i:s') }}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% else %}
|
|
||||||
<div class="alert alert-warning" role="alert">{{ 'No log data found'|trans }}</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container service-stats">
|
<div class="container service-stats">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-8 col-sm-3"><span class="glyphicon glyphicon-user"></span> {{ 'All users'|trans }}</div>
|
<div class="col-xs-8 col-sm-3"><span class="glyphicon glyphicon-user"></span> {{ 'All users'|trans }}</div>
|
||||||
|
|
Loading…
Reference in a new issue