Browse Source

add namespace title support

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

39
src/Controller/MainController.php

@ -89,6 +89,9 @@ class MainController extends AbstractController @@ -89,6 +89,9 @@ class MainController extends AbstractController
],
$request->get('part') > 1 ? (int) $request->get('part') * $this->getParameter('app.main.index.limit') : 0,
$this->getParameter('app.main.index.limit')
),
'title' => $this->_title(
$request->get('namespace')
)
]
);
@ -126,14 +129,46 @@ class MainController extends AbstractController @@ -126,14 +129,46 @@ class MainController extends AbstractController
throw $this->createNotFoundException();
}
$record = reset(
$records
);
return $this->render(
'default/main/transaction.html.twig',
[
'request' => $request,
'record' => reset(
$records
'record' => $record,
'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;
}
}

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

@ -1,4 +1,5 @@ @@ -1,4 +1,5 @@
{% extends 'default/layout.html.twig' %}
{% block title %}{% if title %}{{ title }} - {% endif %}{{ app.name }}{% endblock %}
{% block body %}
<div class="t-center px-16 pt-54">
<div class="mx-a mw-560 px-16">
@ -8,11 +9,11 @@ @@ -8,11 +9,11 @@
<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
{% if title %}
<div class="mb-36 c-1">
{{ 'Observe Kevacoin Universe' | trans }}
{{ title }}
</div>
#}
{% endif %}
</div>
</div>
<div class="t-center px-16 pb-36">

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

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

Loading…
Cancel
Save