Implement snip hiding

This commit is contained in:
Tim
2025-04-25 22:17:27 +02:00
parent 5a940b9ebd
commit 7c4a2b46c0
13 changed files with 541 additions and 24 deletions

View File

@ -1,3 +1,13 @@
{% if snip.visible %}
<span class="badge bg-success">
<i class="fa fa-eye"></i>
</span>
{% else %}
<span class="badge bg-secondary">
<i class="fa fa-eye-slash"></i>
</span>
{% endif %}
{% if snip.public %}
<span class="badge bg-info">
<i class="fa fa-lock-open"></i>

View File

@ -1,6 +1,10 @@
{% extends 'base/single.column.html.twig' %}
{% set title = 'Snip edit ' ~ snip %}
{% if snip.id %}
{% set title = 'Edit Snip ' ~ snip %}
{% else %}
{% set title = 'Create Snip' %}
{% endif %}
{% block body %}
{% if snip.id %}

View File

@ -1,22 +1,24 @@
{% extends 'base/single.column.html.twig' %}
{% set title = 'My Snips' %}
{% block body %}
<a class="btn btn-success" href="{{ path('snip_new') }}">
<i class="fa fa-plus"></i> Add
</a>
{% if request.onlyVisible %}
<a class="btn btn-secondary" href="{{ path('snip_index', {onlyVisible: false}) }}">Show hidden</a>
{% else %}
<a class="btn btn-secondary" href="{{ path('snip_index', {onlyVisible: true}) }}">Hide hidden</a>
{% endif %}
<br><br>
<div class="list-group">
{% for snip in snips %}
<a class="list-group-item d-flex justify-content-between" href="{{ path('snip_single', {snip: snip.id}) }}">
<span>
{% if snip.createdBy == app.user %}
{{ include('snip/badge.html.twig', {snip: snip}) }}
{% endif %}
{{ include('snip/badge.html.twig', {snip: snip}) }}
{{ snip }}
</span>
{% if snip.createdBy != app.user %}
{{ include('user/badge.html.twig', {user: snip.createdBy}) }}
{% endif %}
</a>
{% endfor %}
</div>

View File

@ -0,0 +1,16 @@
{% extends 'base/single.column.html.twig' %}
{% set title = 'Public Snips' %}
{% block body %}
<div class="list-group">
{% for snip in snips %}
<a class="list-group-item d-flex justify-content-between" href="{{ path('snip_single', {snip: snip.id}) }}">
<span>
{{ snip }}
</span>
{{ include('user/badge.html.twig', {user: snip.createdBy}) }}
</a>
{% endfor %}
</div>
{% endblock %}