Clean up the interface with nice buttons

This commit is contained in:
Tim 2023-04-05 00:31:41 +02:00
parent 693f83ca4a
commit 22735cf884
5 changed files with 35 additions and 10 deletions

View File

@ -19,7 +19,6 @@ class SnipService
{
$git = new Git();
$repoPath = sprintf('%s/%s', $snipBasePath, $snip->getId());
dump($repoPath, $snip);
if (!is_dir($repoPath)) {
$this->repo = $git->init($repoPath);
} else {
@ -39,7 +38,6 @@ class SnipService
public function update(string $snipContents): void
{
dump($this->getSnipPath());
file_put_contents($this->getSnipPath(), $snipContents);
$this->repo->addFile('snip.txt');
if ($this->repo->hasChanges()) {

View File

@ -1,5 +1,7 @@
{% extends 'base/base.html.twig' %}
{% block title %}Register{% endblock %}
{% block body %}
<h1 class="h3 mb-3 font-weight-normal">Register new user</h1>
{{ form(registrationForm) }}

View File

@ -1,6 +1,18 @@
{% extends 'base/base.html.twig' %}
{% block title %}Edit {{ snip }}{% endblock %}
{% block body %}
{% if snip.id %}
<a href="{{ path('snip_single', {snip: snip.id}) }}" class="btn btn-primary">
<i class="fa fa-arrow-left"></i>
Back
</a>
{% endif %}
<a href="{{ path('snip_index') }}" class="btn btn-info">
<i class="fa fa-list"></i>
Index
</a><br><br>
<h2>Editing {{ snip }}</h2>
{{ form(form) }}
{% endblock %}

View File

@ -1,8 +1,12 @@
{% extends 'base/base.html.twig' %}
{% block title %}My snippets{% endblock %}
{% block body %}
<h1>Snippets</h1>
<a class="btn btn-primary" href="{{ path('snip_new') }}">Create a new Snip</a>
<h1>My snippets</h1>
<a class="btn btn-success" href="{{ path('snip_new') }}">
<i class="fa fa-plus"></i> Add
</a><br><br>
<div class="list-group">
{% for snip in snips %}
<a class="list-group-item" href="{{ path('snip_single', {snip: snip.id}) }}">

View File

@ -1,18 +1,27 @@
{% extends 'base/base.html.twig' %}
{% block title %}Snip {{ snip }}{% endblock %}
{% block body %}
<div class="card" style="width: 100%;">
<h4 class="card-header">
<a href="{{ path('snip_index') }}" class="btn btn-primary">
<i class="fa fa-arrow-left"></i> Back
</a>
{% if is_granted('edit', snip) %}
<a class="btn btn-sm btn-outline-info" href="{{ path('snip_edit', {snip: snip.id}) }}">
<i class="fa fa-pencil" aria-hidden="true"></i>
<a class="btn btn-warning" href="{{ path('snip_edit', {snip: snip.id}) }}">
<i class="fa fa-pencil" aria-hidden="true"></i> Edit
</a>
{% endif %}
<a href="{{ path('snip_raw', {snip: snip.id}) }}" class="btn btn-danger">
<i class="fa fa-eye"></i> Raw
</a>
<br><br>
<div class="card" style="width: 100%;">
<h4 class="card-header">
{{ include('snip/badge.html.twig', {snip: snip}) }}
{{ snip }}
</h4>
<div class="card-body">
<p class="card-text">{{ content }}</p>
<p class="card-text">{{ content|nl2br }}</p>
</div>
</div>
{% endblock %}