Skip to main content

max / makenotwork

4.3 KB · 104 lines History Blame Raw
1 <div class="content-section raised">
2 <p class="form-hint mb-pane">Curate lists of items: playlists, reading lists, bundles. Public collections appear on your profile.</p>
3
4 {% if collections.is_empty() %}
5 <p class="muted">No collections yet. Use the form below to create your first one, then add items from any item page.</p>
6 {% else %}
7 <div class="scroll-x">
8 <table class="data-table well">
9 <thead>
10 <tr>
11 <th>Title</th>
12 <th>Items</th>
13 <th>Visibility</th>
14 <th>Created</th>
15 <th></th>
16 </tr>
17 </thead>
18 <tbody>
19 {% for c in collections %}
20 <tr data-row>
21 <td><a href="/c/{{ username }}/{{ c.slug }}">{{ c.title }}</a></td>
22 <td>{{ c.item_count }}</td>
23 <td>{% if c.is_public %}<span class="badge">Public</span>{% else %}<span class="badge is-faded">Private</span>{% endif %}</td>
24 <td>{{ c.created_at }}</td>
25 <td>
26 {{ crate::quasi::library_acts::delete_collection_html(c.id)|safe }}
27 </td>
28 </tr>
29 {% endfor %}
30 </tbody>
31 </table>
32 </div>
33 {% endif %}
34
35 <details class="lib-coll-new">
36 <summary class="lib-coll-new-summary">New Collection</summary>
37 <form id="new-collection-form"
38 class="lib-coll-new-form"
39 hx-post="/api/collections"
40 hx-swap="none">
41 <div class="form-group">
42 <label for="new-coll-title">Title</label>
43 <input type="text" id="new-coll-title" name="title" maxlength="100" required placeholder="My Reading List"
44 data-input="slugifyCollName">
45 </div>
46 <div class="form-group">
47 <label for="new-coll-slug">URL name</label>
48 <input type="text" id="new-coll-slug" name="slug" maxlength="100" required placeholder="my-reading-list" pattern="[a-zA-Z0-9\-]+">
49 <small class="form-hint">Letters, numbers, and hyphens only. Filled in for you from the title; edit if you want a shorter URL.</small>
50 </div>
51 <div class="form-group">
52 <label for="new-coll-desc">Description (optional)</label>
53 <textarea id="new-coll-desc" name="description" maxlength="500" rows="2"></textarea>
54 </div>
55 <label class="checkbox-group">
56 <input type="checkbox" id="new-coll-public" name="is_public" value="true"> Public (visible on your profile)
57 </label>
58 <button type="submit">Create Collection</button>
59 </form>
60 </details>
61 </div>
62
63 <script src="/static/tab-library-collections.js?v=0623"></script>
64
65 <h2 class="lib-coll-wishlist-heading">Wishlist</h2>
66 {% if wishlists.is_empty() %}
67 <div class="content-section raised">
68 <p class="muted">No wishlisted items. Add items from any item page to save them for later.</p>
69 </div>
70 {% else %}
71 <div class="content-section lib-coll-wishlist-wrap raised">
72 <table class="data-table lib-coll-wishlist-table well">
73 <thead>
74 <tr>
75 <th>Title</th>
76 <th>Creator</th>
77 <th>Type</th>
78 <th>Price</th>
79 <th>Added</th>
80 <th></th>
81 </tr>
82 </thead>
83 <tbody>
84 {% for item in wishlists %}
85 <tr id="wishlist-row-{{ item.item_id }}">
86 <td><a href="/i/{{ item.item_id }}">{{ item.title }}</a></td>
87 <td><a href="/u/{{ item.creator }}">{{ item.creator }}</a></td>
88 <td><span class="badge">{{ item.item_type }}</span></td>
89 <td>{{ item.price_display() }}</td>
90 <td>{{ item.added_at.format("%b %d, %Y") }}</td>
91 <td class="lib-coll-row-actions">
92 <button class="btn-primary small btn-compact lib-coll-cart-btn"
93 hx-post="/api/cart/{{ item.item_id }}"
94 hx-swap="none"
95 data-after="mark-added">Add to Cart</button>
96 {{ crate::quasi::library_acts::remove_from_wishlist_html(item.item_id)|safe }}
97 </td>
98 </tr>
99 {% endfor %}
100 </tbody>
101 </table>
102 </div>
103 {% endif %}
104