Browse Source

add namespace title support

master
ghost 9 months ago
parent
commit
3429324188
  1. 39
      src/Controller/MainController.php
  2. 11
      templates/default/main/namespace.html.twig
  3. 11
      templates/default/main/transaction.html.twig

39
src/Controller/MainController.php

@ -89,6 +89,9 @@ class MainController extends AbstractController
], ],
$request->get('part') > 1 ? (int) $request->get('part') * $this->getParameter('app.main.index.limit') : 0, $request->get('part') > 1 ? (int) $request->get('part') * $this->getParameter('app.main.index.limit') : 0,
$this->getParameter('app.main.index.limit') $this->getParameter('app.main.index.limit')
),
'title' => $this->_title(
$request->get('namespace')
) )
] ]
); );
@ -126,14 +129,46 @@ class MainController extends AbstractController
throw $this->createNotFoundException(); throw $this->createNotFoundException();
} }
$record = reset(
$records
);
return $this->render( return $this->render(
'default/main/transaction.html.twig', 'default/main/transaction.html.twig',
[ [
'request' => $request, 'request' => $request,
'record' => reset( 'record' => $record,
$records 'title' => $this->_title(
$record['namespace']
)
]
);
}
private function _title(string $namespace): ?string
{
$index = new \Kvazar\Index\Manticore();
$title = $index->get(
'_KEVA_NS_',
[
'crc32namespace' => crc32(
$namespace
) )
] ]
); );
if ($title)
{
$title = reset(
$title
);
return trim(
$title['value']
);
}
return null;
} }
} }

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

@ -1,4 +1,5 @@
{% extends 'default/layout.html.twig' %} {% extends 'default/layout.html.twig' %}
{% block title %}{% if title %}{{ title }} - {% endif %}{{ app.name }}{% endblock %}
{% block body %} {% block body %}
<div class="t-center px-16 pt-54"> <div class="t-center px-16 pt-54">
<div class="mx-a mw-560 px-16"> <div class="mx-a mw-560 px-16">
@ -8,11 +9,11 @@
<div class="mx-a mw-560 px-16 pb-16"> <div class="mx-a mw-560 px-16 pb-16">
<img class="br-50 shine" src="{{ request.get('namespace') | jIdenticon }}" alt="{{ request.get('namespace') }}" /> <img class="br-50 shine" src="{{ request.get('namespace') | jIdenticon }}" alt="{{ request.get('namespace') }}" />
</div> </div>
{# @TODO current namespace value {% if title %}
<div class="mb-36 c-1"> <div class="mb-36 c-1">
{{ 'Observe Kevacoin Universe' | trans }} {{ title }}
</div> </div>
#} {% endif %}
</div> </div>
</div> </div>
<div class="t-center px-16 pb-36"> <div class="t-center px-16 pb-36">

11
templates/default/main/transaction.html.twig

@ -1,4 +1,5 @@
{% extends 'default/layout.html.twig' %} {% extends 'default/layout.html.twig' %}
{% block title %}{% if title %}{{ title }} - {% endif %}{{ app.name }}{% endblock %}
{% block body %} {% block body %}
<div class="t-center px-16 pt-54"> <div class="t-center px-16 pt-54">
<div class="mx-a mw-560 px-16"> <div class="mx-a mw-560 px-16">
@ -10,11 +11,11 @@
<img class="br-50 shine" src="{{ record.namespace | jIdenticon }}" alt="{{ record.namespace }}" /> <img class="br-50 shine" src="{{ record.namespace | jIdenticon }}" alt="{{ record.namespace }}" />
</a> </a>
</div> </div>
{# @TODO current namespace value {% if title %}
<div class="mb-36 c-1"> <div class="mb-36 c-1">
{{ 'Observe Kevacoin Universe' | trans }} {{ title }}
</div> </div>
#} {% endif %}
</div> </div>
</div> </div>
<div class="t-center px-16 pb-36"> <div class="t-center px-16 pb-36">

Loading…
Cancel
Save