Skip to main content

max / makenotwork

2.7 KB · 65 lines History Blame Raw
1 {%- import "partials/_ui.html" as ui -%}
2 <div id="placement-list">
3 <h3 class="placement-list-heading">Dynamic Clips</h3>
4
5 {% if placements.is_empty() && available_insertions.is_empty() %}
6 {% call ui::empty_state("", "No clips available. Upload clips in your dashboard first.") %}
7 {% else %}
8
9 {% if !placements.is_empty() %}
10 <table class="data-table placement-list-table">
11 <thead>
12 <tr>
13 <th>Clip</th>
14 <th>Position</th>
15 <th>Offset</th>
16 <th class="placement-list-th-actions">Actions</th>
17 </tr>
18 </thead>
19 <tbody>
20 {% for p in placements %}
21 <tr>
22 <td>{{ p.insertion_title }}</td>
23 <td>{{ p.position }}</td>
24 <td>{% if let Some(offset) = p.offset_display %}{{ offset }}{% else %}-{% endif %}</td>
25 <td class="placement-list-actions">
26 <button type="button" class="btn btn-xs btn-danger placement-list-remove"
27 hx-delete="/api/item-insertions/{{ p.id }}"
28 hx-target="#placement-list"
29 hx-swap="outerHTML">Remove</button>
30 </td>
31 </tr>
32 {% endfor %}
33 </tbody>
34 </table>
35 {% endif %}
36
37 {% if !available_insertions.is_empty() %}
38 <form id="add-placement-form" class="placement-list-form">
39 <div>
40 <label class="placement-list-label">Clip</label>
41 <select name="insertion_id" id="placement-insertion-id" class="placement-list-select input--sm" required>
42 {% for ins in available_insertions %}
43 <option value="{{ ins.id }}">{{ ins.title }} ({{ ins.duration_display }})</option>
44 {% endfor %}
45 </select>
46 </div>
47 <div>
48 <label class="placement-list-label">Position</label>
49 <select name="position" id="placement-position" class="placement-list-select input--sm" required onchange="MNW.insertions.toggleOffsetInput(this.value)">
50 <option value="pre_roll">Pre-roll</option>
51 <option value="mid_roll">Mid-roll</option>
52 <option value="post_roll">Post-roll</option>
53 </select>
54 </div>
55 <div id="offset-input-group" class="hidden">
56 <label class="placement-list-label">Offset (seconds)</label>
57 <input type="number" name="offset_seconds" id="placement-offset" class="placement-list-input input--sm w-100" min="0" step="1">
58 </div>
59 <button type="button" class="btn btn-sm placement-list-add" onclick="MNW.insertions.addPlacement('{{ item_id }}')">Add</button>
60 </form>
61 {% endif %}
62
63 {% endif %}
64 </div>
65