Add collection and new vocab + mess with repository

This commit is contained in:
2024-11-04 17:16:16 +01:00
parent f8e470b096
commit 0a41ff4a7b
28 changed files with 2599 additions and 38 deletions

View File

@@ -0,0 +1,72 @@
{% extends 'data_entry.html.twig' %}
{% block title %}Bibliography - Add new | ArCOA{% endblock %}
{% block rightpanel %}
<div class="container" style="max-width: 60vw">
<h1 class="is-size-1 mt-0 has-text-centered">Bibliography</h1>
<h2 class="is-size-3 mt-3 has-text-centered">Add new record</h2>
<p class="pt-4 pb-4 has-text-link has-text-weight-bold">Fields marked with (*) are mandatory</p>
<div class="card p-5 has-background-light">
{{ form_start(form) }}
<div class="field">
<label class="label">
{{ form_label(form.status) }}
</label>
<div class="select">
{{ form_widget(form.status) }}
</div>
</div>
<div class="field">
<label class="label">
{{ form_label(form.editor) }}
</label>
<div class="control">
{{
form_widget(
form.editor,
{'attr': {'class': 'input', 'placeholder': 'Name of the editor (mandatory)'}}
)
}}
</div>
</div>
<div class="field">
<label class="label">
{{ form_label(form.citation) }}
</label>
<div class="control">
{{ form_widget(form.citation, {'attr': {'class': 'input'}}) }}
</div>
</div>
<div class="field">
<label class="label">
{{ form_label(form.reference) }}
</label>
<div class="control">
{{ form_widget(form.reference, {'attr': {'class': 'textarea'}}) }}
</div>
</div>
<div class="field">
<label class="label">
{{ form_label(form.notes) }}
</label>
<div class="control">
{{ form_widget(form.notes, {'attr': {'class': 'textarea'}}) }}
</div>
</div>
<div class="field is-grouped is-grouped-right mt-5">
<div class="control">
<button type="submit" class="button is-link">
Save
<span class="icon ml-3">
<i class="fa fa-save"></i>
</span>
</button>
</div>
</div>
{{ form_end(form) }}
</div>
</div>
<script type="text/javascript" defer></script>
{% endblock %}

View File

@@ -1,6 +1,6 @@
{% extends 'data_entry.html.twig' %}
{% block title %}Bibliography | ArCOA{% endblock %}
{% block title %}Bibliography - {{ record.citation }} | ArCOA{% endblock %}
{% block rightpanel %}
<div class="container" style="max-width: 60vw">
@@ -16,6 +16,7 @@
<p><strong>Editor:</strong> {{ record.editor }}</p>
</div>
</article>
<div class="card p-5">
{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_REVISOR') %}
<div class="columns">
@@ -27,12 +28,18 @@
<i class="fa fa-edit"></i>
</span>
</button>
<button class="button is-danger ml-2">
<button class="button is-link">
Copy
<span class="icon ml-2">
<i class="fa fa-copy"></i>
</span>
</button>
<a href="{{ path('app_bibliography_del', {'id' : record.id}) }}" class="button is-danger" id="del-record">
Delete
<span class="icon ml-2">
<i class="fa fa-trash"></i>
</span>
</button>
</a>
</div>
</div>
{% endif %}
@@ -55,7 +62,56 @@
<div class="data-tabs is-hidden" id="relations">
Some stuff...
</div>
</div>
</div>
</div>
<script type="text/javascript" defer></script>
<div class="modal">
<div class="modal-background"></div>
<div class="modal-card">
<header class="modal-card-head">
<span class="icon is-large has-text-warning">
<i class="fa fa-warning fa-2x"></i>
</span>
<p class="modal-card-title has-text-danger pl-2"><strong>Delete record?</strong></p>
<button class="delete" aria-label="close"></button>
</header>
<section class="modal-card-body">
<p class="is-size-5">This record will be permanently deleted. Proceed?</p>
</section>
<footer class="modal-card-foot">
<div class="buttons is-right">
<button class="button is-link" id="confirm-del">Confirm</button>
<button class="button is-light" id="cancel">Cancel</button>
</div>
</footer>
</div>
</div>
<script type="text/javascript" defer>
const del = document.querySelector('#del-record');
const delPath = del.href;
del.addEventListener('click', event => {
event.preventDefault();
const modal = document.querySelector('.modal');
modal.classList.add('is-active');
modal.querySelector('.delete').addEventListener('click', () => {
modal.classList.remove('is-active');
});
modal.querySelector('.modal-background').addEventListener('click', () => {
modal.classList.remove('is-active');
});
modal.querySelector('#cancel').addEventListener('click', () => {
modal.classList.remove('is-active');
});
// Proceed with deletion...
modal.querySelector('#confirm-del').addEventListener('click', () => {
location.href = delPath;
});
});
</script>
{% endblock %}

View File

@@ -7,19 +7,25 @@
<h1 class="is-size-1 mt-0 has-text-centered">Bibliography</h1>
<h2 class="is-size-3 mt-3 has-text-centered">Choose action</h2>
{% for message in app.flashes('notice') %}
<div class=" mt-4 notification is-success">
<button class="delete"></button>
{{ message }}
</div>
{% endfor %}
<div class="card p-5 mt-6 pt-6 pb-6">
<div class="columns">
<div class="column is-half has-text-centered">
<a href="{{ path('app_bibliography_search') }}" class="button is-large">
<button class="button is-medium">
Search
<span class="icon ml-2">
<i class="fa fa-search"></i>
</span>
</a>
</button>
</div>
{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_REVISOR') or is_granted('ROLE_EDITOR') %}
<div class="column has-text-centered">
<a href="{{ path('app_bibliography_add') }}" class="button is-link is-large">
<a href="{{ path('app_bibliography_create') }}" class="button is-link is-medium">
Add new
<span class="icon ml-2">
<i class="fa fa-plus"></i>
@@ -29,6 +35,54 @@
{% endif %}
</div>
</div>
<h3 class="has-text-centered is-size-4 mt-6">Records</h3>
<p class="pt-4 pb-4"><strong>{{ count }} result(s) found</strong></p>
<table class="table is-hoverable is-fullwidth mt-5 has-text-centered results">
<tr>
<th>ID</th>
<th>Citation</th>
<th>Status</th>
<th>Editor</th>
<th>Reference</th>
<th>Last modified</th>
<th>Actions</th>
</tr>
{% for record in records %}
<tr>
<td><a href="{{ path('app_bibliography', {'id' : record.id}) }}">{{ record.id }}</a></td>
<td><a href="{{ path('app_bibliography', {'id' : record.id}) }}">{{ record.citation }}</a></td>
<td>{{ record.status }}</td>
<td>{{ record.owner }}</td>
<td style="max-width: 350px;">{{ record.reference }}</td>
<td>
{{ record.modifiedAt.format('Y-m-d') }}<br>
{{ record.editor }} at {{ record.modifiedAt.format('H:i:s') }}
</td>
<td style="min-width: 120px;">
<div class="buttons">
<button class="button is-small is-link" title="Edit record">
<span class="icon">
<i class="fa fa-edit"></i>
</span>
</button>
<button class="button is-small is-danger" title="Delete record">
<span class="icon">
<i class="fa fa-trash"></i>
</span>
</button>
</div>
</td>
</tr>
{% endfor %}
</table>
</div>
<script type="text/javascript" defer></script>
<script type="text/javascript" defer>
const delBtns = document.querySelectorAll('.delete');
for (let btn of delBtns) {
btn.addEventListener('click', function () {
this.parentElement.classList.add('is-hidden');
})
}
</script>
{% endblock %}