point-tools/templates/Web/index.html.twig

75 lines
3.3 KiB
Twig
Raw Normal View History

{% extends 'Web/base.html.twig' %}
2015-05-30 06:22:06 +00:00
{% block head_js %}
{{ parent() }}
2016-12-11 00:56:14 +00:00
{# https://github.com/bassjobsen/Bootstrap-3-Typeahead #}
<script src="{{ asset('js/lib/bootstrap3-typeahead.min.js') }}"></script>
{% endblock %}
2015-05-31 00:01:48 +00:00
{% block content %}
<div class="well well-lg">
{{ form_start(form, {'attr': {'class': 'form-inline'} }) }}
2015-05-31 00:01:48 +00:00
<div class="form-group">
{{ form_errors(form.login) }}
2016-12-11 00:34:20 +00:00
{{ form_widget(form.login, {
'attr': {
'autocomplete': 'off',
2017-01-09 23:48:57 +00:00
'placeholder': 'Login',
'autofocus': true
2016-12-11 00:34:20 +00:00
}
}) }}
<script type="text/javascript">
$(function() {
$field = $('#{{ form.login.vars.id }}');
$field.typeahead({
minLength: 2,
2016-12-11 00:54:01 +00:00
items: {{ autocomplete_size|e('js') }},
delay: 500,
autoSelect: true,
source: function (query, processCallback) {
$.get('{{ path('user_search_ajax', {'login': ''}) }}' + query, function (data) {
processCallback(data);
});
},
afterSelect: function () {
$field.parents('form').first().submit();
},
displayText: function (item) {
// Crutches to place only login into the field after selecting the item
if (typeof item === 'object') {
return item.login+(item.name ? ' ('+item.name+')' : '');
} else if (typeof item === 'string') {
return item;
}
},
updater: function (item) {
// Crutches to place only login into the field after selecting the item
return item.login;
}
});
});
</script>
<input type="submit" value="{{ 'Search'|trans }}" class="btn btn-default" />
2015-05-31 00:01:48 +00:00
</div>
{{ form_end(form) }}
2015-05-31 00:01:48 +00:00
</div>
2015-05-30 06:22:06 +00:00
2015-05-31 00:01:48 +00:00
<div class="container service-stats">
<div class="row">
2015-06-02 04:33:21 +00:00
<div class="col-xs-8 col-sm-3"><span class="glyphicon glyphicon-user"></span> {{ 'All users'|trans }}</div>
<div class="col-xs-4 col-sm-2">{{ users_count }}</div>
2015-05-31 00:01:48 +00:00
</div>
<div class="row">
2015-06-02 04:33:21 +00:00
<div class="col-xs-8 col-sm-3"><span class="glyphicon glyphicon-user"></span> {{ 'Subscribed users'|trans }}</div>
<div class="col-xs-4 col-sm-2"><a href="{{ url('user_show', {'login': service_login}) }}">{{ subscribers_count }}</a></div>
2015-05-31 00:01:48 +00:00
</div>
<div class="row">
2015-06-02 04:33:21 +00:00
<div class="col-xs-8 col-sm-3"><span class="glyphicon glyphicon-list"></span> {{ '24 hours events'|trans }}</div>
<div class="col-xs-4 col-sm-2"><a href="{{ url('events_last') }}">{{ events_count }}</a></div>
2015-05-31 00:01:48 +00:00
</div>
</div>
2015-05-30 06:22:06 +00:00
{% endblock %}