Add extra meta data to snip view and show all snips in public
This commit is contained in:
parent
af9f83f189
commit
bf55e069e0
@ -36,7 +36,7 @@ class SnipController extends AbstractController
|
|||||||
public function public(): Response
|
public function public(): Response
|
||||||
{
|
{
|
||||||
return $this->render('snip/index.html.twig', [
|
return $this->render('snip/index.html.twig', [
|
||||||
'snips' => $this->repository->findPublic($this->getUser()),
|
'snips' => $this->repository->findPublic(),
|
||||||
'title' => 'Public Snips',
|
'title' => 'Public Snips',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ class SnipRepository extends ServiceEntityRepository
|
|||||||
return $qb->getQuery()->getResult();
|
return $qb->getQuery()->getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findPublic(?User $user): array
|
public function findPublic(?User $user = null): array
|
||||||
{
|
{
|
||||||
$qb = $this->createQueryBuilder('s')
|
$qb = $this->createQueryBuilder('s')
|
||||||
->where('s.public = :public')
|
->where('s.public = :public')
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
{% extends 'base/single.column.html.twig' %}
|
{% extends 'base/single.column.html.twig' %}
|
||||||
|
|
||||||
{% set title = 'Snip index' %}
|
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<a class="btn btn-success" href="{{ path('snip_new') }}">
|
<a class="btn btn-success" href="{{ path('snip_new') }}">
|
||||||
<i class="fa fa-plus"></i> Add
|
<i class="fa fa-plus"></i> Add
|
||||||
|
@ -39,6 +39,10 @@
|
|||||||
<p class="card-text text-muted">
|
<p class="card-text text-muted">
|
||||||
Current version: {{ snip.activeVersion.id }}
|
Current version: {{ snip.activeVersion.id }}
|
||||||
{% if snip.activeVersion == snip.latestVersion %}(latest){% endif %}
|
{% if snip.activeVersion == snip.latestVersion %}(latest){% endif %}
|
||||||
|
|
||||||
|
Created at {{ snip.activeVersion.id.dateTime|date('Y-m-d H:i:s') }}
|
||||||
|
|
||||||
|
{{ include('user/badge.html.twig', {user: snip.createdBy}) }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1 +1 @@
|
|||||||
<span class="badge bg-secondary">{{ user }}</span>
|
<span class="badge {% if user == app.user %}bg-success{% else %}bg-secondary{% endif %}">{{ user }}</span>
|
@ -14,8 +14,8 @@
|
|||||||
</a>
|
</a>
|
||||||
<br><br>
|
<br><br>
|
||||||
<div class="list-group">
|
<div class="list-group">
|
||||||
{% for version in snip.snipContents %}
|
{% for version in snip.snipContents|reverse %}
|
||||||
<a class="list-group-item" href="{{ path('version_set', {version: version.id, snip: snip.id}) }}">
|
<a class="list-group-item {% if version.id == snip.activeVersion.id %}list-group-item-success{% endif %}" href="{{ path('version_set', {version: version.id, snip: snip.id}) }}">
|
||||||
{{ version.id.dateTime|date('Y-m-d H:i:s') }} - {{ version.id }}
|
{{ version.id.dateTime|date('Y-m-d H:i:s') }} - {{ version.id }}
|
||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user