- save & load

- key navigation
- ui improvements
This commit is contained in:
bkfox
2022-12-11 00:29:53 +01:00
parent cfc0e45439
commit 61af53eecb
10 changed files with 250 additions and 95 deletions

View File

@ -4,21 +4,18 @@
{# include "adminsortable2/edit_inline/tabular-django-4.1.html" #}
{% with inline_admin_formset as admin_formset %}
{% with admin_formset.formset as formset %}
<script id="{{ formset.prefix }}-init-data">
{{ formset|inline_data|json }}
</script>
<div id="inline-tracks" class="box mb-5">
<h5 class="title is-4">{% trans "Playlist" %}</h5>
<script id="{{ formset.prefix }}-init-data">{
"items": [
{% for form in formset.forms %}
{{ form.initial|json }}
{% if not forloop.last %},{% endif %}
{% endfor %}
]
}
</script>
{{ admin_formset.non_form_errors }}
<a-playlist-editor>
<a-playlist-editor data-el="{{ formset.prefix }}-init-data"
data-prefix="{{ formset.prefix }}-">
<template #title>
<h5 class="title is-4">{% trans "Playlist" %}</h5>
</template>
<template v-slot:top="{items}">
<input type="hidden" name="{{ formset.prefix }}-TOTAL_FORMS"
:value="items.length || 0"/>
@ -43,7 +40,7 @@
<input type="hidden"
:name="'{{ formset.prefix }}-' + row + '-position'"
:value="row"/>
<input t-if="item.data.id" type="hidden"
<input t-if="item.id" type="hidden"
:name="'{{ formset.prefix }}-' + row + '-id'"
:value="item.data.id"/>
@ -59,11 +56,17 @@
{% for field in admin_formset.fields %}
{% if not field.widget.is_hidden and not field.is_readonly %}
<template v-slot:row-{{ field.name }}="{item,col,row,value,attr,emit}">
<div class="control">
<input type="{{ widget.type }}" class="input half-field"
:name="'{{ formset.prefix }}-' + row + '-{{ field.name }}'"
v-model="item.data[attr]"
@change="emit('change', col)"/>
<div class="field">
<div class="control">
<input type="{{ widget.type }}"
:class="['input', item.error(attr) ? 'is-danger' : 'half-field']"
:name="'{{ formset.prefix }}-' + row + '-{{ field.name }}'"
v-model="item.data[attr]"
@change="emit('change', col)"/>
</div>
<p v-for="error in item.error(attr)" class="help is-danger">
[[ error ]] !
</p>
</div>
</template>
{% endif %}

View File

@ -18,7 +18,7 @@ The audio player
</noscript>
<a-player ref="player"
:live-args="{url: '{% url "api:live" %}', timeout:10, src: {{ audio_streams|json }} || []}"
:live-args="{url: '{% url "api:live" %}', timeout:10, src: {{ audio_streams|json|force_escape }} || []}"
button-title="{% translate "Play or pause audio" %}">
<template v-slot:content="{ loaded, live, current }">
<h4 v-if="loaded" class="title is-4">