I lowkey forgot to commit
This commit is contained in:
17
templates/review/edit.html.twig
Normal file
17
templates/review/edit.html.twig
Normal file
@@ -0,0 +1,17 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
{% block title %}Edit Review{% endblock %}
|
||||
{% block body %}
|
||||
<h1 class="h4 mb-1">Edit review</h1>
|
||||
<p class="text-secondary">{{ review.albumName }} — {{ review.albumArtist }} ({{ review.spotifyAlbumId }})</p>
|
||||
|
||||
{{ form_start(form, {attr: {class: 'vstack gap-3', novalidate: 'novalidate'}}) }}
|
||||
<div>{{ form_label(form.title) }}{{ form_widget(form.title, {attr: {class: 'form-control'}}) }}{{ form_errors(form.title) }}</div>
|
||||
<div>{{ form_label(form.content) }}{{ form_widget(form.content, {attr: {class: 'form-control', rows: 8}}) }}{{ form_errors(form.content) }}</div>
|
||||
<div>{{ form_label(form.rating) }}{{ form_widget(form.rating, {attr: {class: 'form-control'}}) }}{{ form_errors(form.rating) }}</div>
|
||||
<button class="btn btn-success" type="submit">Update review</button>
|
||||
{{ form_end(form) }}
|
||||
|
||||
<p class="mt-3"><a href="{{ path('review_show', {id: review.id}) }}">Back to review</a></p>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
29
templates/review/index.html.twig
Normal file
29
templates/review/index.html.twig
Normal file
@@ -0,0 +1,29 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
{% block title %}Album Reviews{% endblock %}
|
||||
{% block body %}
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h1 class="h4 mb-0">Album reviews</h1>
|
||||
{% if app.user %}
|
||||
<a class="btn btn-success" href="{{ path('review_new') }}">New review</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="row g-3">
|
||||
{% for r in reviews %}
|
||||
<div class="col-12">
|
||||
<div class="card h-100">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title mb-1">{{ r.title }} <span class="text-secondary">(Rating {{ r.rating }}/10)</span></h5>
|
||||
<div class="text-secondary mb-2">{{ r.albumName }} — {{ r.albumArtist }}</div>
|
||||
<p class="card-text">{{ r.content|u.truncate(220, '…', false) }}</p>
|
||||
<a class="btn btn-link p-0" href="{{ path('review_show', {id: r.id}) }}">Read more</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<p>No reviews yet.</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
30
templates/review/new.html.twig
Normal file
30
templates/review/new.html.twig
Normal file
@@ -0,0 +1,30 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
{% block title %}New Review{% endblock %}
|
||||
{% block body %}
|
||||
<h1 class="h4 mb-3">Write a review</h1>
|
||||
|
||||
<div class="row g-2 mb-3">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Spotify Album ID</label>
|
||||
<input class="form-control" type="text" name="spotifyAlbumId" value="{{ review.spotifyAlbumId }}" placeholder="e.g. 4m2880jivSbbyEGAKfITCa" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Artist</label>
|
||||
<input class="form-control" type="text" name="albumArtist" value="{{ review.albumArtist }}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Album Title</label>
|
||||
<input class="form-control" type="text" name="albumName" value="{{ review.albumName }}" />
|
||||
</div>
|
||||
|
||||
{{ form_start(form, {attr: {class: 'vstack gap-3', novalidate: 'novalidate'}}) }}
|
||||
<div>{{ form_label(form.title) }}{{ form_widget(form.title, {attr: {class: 'form-control'}}) }}{{ form_errors(form.title) }}</div>
|
||||
<div>{{ form_label(form.content) }}{{ form_widget(form.content, {attr: {class: 'form-control', rows: 8}}) }}{{ form_errors(form.content) }}</div>
|
||||
<div>{{ form_label(form.rating) }}{{ form_widget(form.rating, {attr: {class: 'form-control'}}) }}{{ form_errors(form.rating) }}</div>
|
||||
<button class="btn btn-success" type="submit">Save review</button>
|
||||
{{ form_end(form) }}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
22
templates/review/show.html.twig
Normal file
22
templates/review/show.html.twig
Normal file
@@ -0,0 +1,22 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
{% block title %}{{ review.title }}{% endblock %}
|
||||
{% block body %}
|
||||
<p><a href="{{ path('review_index') }}">← Back</a></p>
|
||||
<h1 class="h4">{{ review.title }} <span class="text-secondary">(Rating {{ review.rating }}/10)</span></h1>
|
||||
<p class="text-secondary">{{ review.albumName }} — {{ review.albumArtist }} ({{ review.spotifyAlbumId }})</p>
|
||||
<article class="mb-3">
|
||||
<p>{{ review.content|nl2br }}</p>
|
||||
</article>
|
||||
|
||||
{% if is_granted('REVIEW_EDIT', review) %}
|
||||
<div class="d-flex gap-2">
|
||||
<a class="btn btn-outline-secondary" href="{{ path('review_edit', {id: review.id}) }}">Edit</a>
|
||||
<form action="{{ path('review_delete', {id: review.id}) }}" method="post" onsubmit="return confirm('Delete this review?')">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('delete_review_' ~ review.id) }}" />
|
||||
<button class="btn btn-danger" type="submit">Delete</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user