Browse Source

implement namespace page

master
ghost 10 months ago
parent
commit
b94e016a26
  1. 39
      src/Controller/MainController.php
  2. 2
      templates/default/main/index.html.twig
  3. 64
      templates/default/main/namespace.html.twig

39
src/Controller/MainController.php

@ -42,6 +42,45 @@ class MainController extends AbstractController @@ -42,6 +42,45 @@ class MainController extends AbstractController
);
}
#[Route(
'/{namespace}',
name: 'main_namespace',
requirements:
[
'transaction' => '^N[A-z0-9]{33}$',
],
methods:
[
'GET'
]
)]
public function namespace(
?Request $request
): Response
{
$index = new \Kvazar\Index\Manticore();
return $this->render(
'default/main/namespace.html.twig',
[
'request' => $request,
'records' => $index->get(
$request->get('search') ? (string) $request->get('search') : '',
[
'crc32namespace' => crc32(
$request->get('namespace')
)
],
[
'time' => 'desc'
],
$request->get('part') > 1 ? (int) $request->get('part') * $this->getParameter('app.main.index.limit') : 0,
$this->getParameter('app.main.index.limit')
)
]
);
}
#[Route(
'/{transaction}',
name: 'main_transaction',

2
templates/default/main/index.html.twig

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
<div class="t-center px-16">
<div class="mx-a mw-560 px-16">
<div class="mx-a mw-560 mb-16">
<a href="{{ path('main_index',{'namespace':record.namespace}) }}">
<a href="{{ path('main_namespace',{'namespace':record.namespace}) }}">
<img class="br-50" src="{{ record.namespace | jIdenticon }}" alt="{{ record.namespace }}" />
</a>
</div>

64
templates/default/main/namespace.html.twig

@ -0,0 +1,64 @@ @@ -0,0 +1,64 @@
{% extends 'default/layout.html.twig' %}
{% block body %}
<div class="t-center px-16 pt-54">
<div class="mx-a mw-560 px-16">
<div class="mb-20">
<a class="logo f-s-20 c-0" href="{{ path('main_index') }}">{{ app.name }}</a>
</div>
<div class="mx-a mw-560 px-16 pb-16">
<img class="br-50 shine" src="{{ request.get('namespace') | jIdenticon }}" alt="{{ request.get('namespace') }}" />
</div>
{# @TODO current namespace value
<div class="mb-36 c-1">
{{ 'Observe Kevacoin Universe' | trans }}
</div>
#}
</div>
</div>
<div class="t-center px-16 pb-36">
<div class="b-g"></div>
</div>
{% for record in records %}
<div class="t-center px-16">
<div class="mx-a mw-560 px-16">
<a class="d-block" href="{{ path('main_transaction',{'transaction':record.transaction}) }}">
<div class="f-s-16 mb-16 of-a">
{{ record.key }}
</div>
<div class="mb-20 of-a">
{{ record.value | nl2br }}
</div>
<div class="f-s-12">
{{ record.time | format_date }} {{ 'in' | trans }} {{ record.block }}
</div>
</a>
</div>
</div>
<div class="t-center px-16 py-27">
<div class="b-g"></div>
</div>
{% endfor %}
<div class="t-center pt-16 pb-27">
{% if request.get('part') %}
<a rel="nofollow" href="{{
path(
'main_namespace',
{
'part':request.get('part') - 1,
'search':request.get('search'),
'namespace':request.get('namespace')
}
) }}">{{ 'older' | trans }}</a>
|
{% endif %}
<a rel="nofollow" href="{{
path(
'main_namespace',
{
'part':(request.get('part') ? request.get('part') : 1) + 1,
'search':request.get('search'),
'namespace':request.get('namespace')
}
) }}">{{ 'newer' | trans }}</a>
</div>
{% endblock %}
Loading…
Cancel
Save