mirror of
https://codeberg.org/catask-org/catask.git
synced 2025-04-19 13:23:41 -05:00
see all emojis in a pack from the admin panel
This commit is contained in:
parent
95f2f4e1a9
commit
0af8ce7648
2 changed files with 23 additions and 5 deletions
17
app.py
17
app.py
|
@ -575,10 +575,23 @@ def uploadEmojiPack():
|
|||
def getEmojis():
|
||||
return func.listEmojis()
|
||||
|
||||
@api_bp.route('/get_emoji_packs/', methods=['GET'])
|
||||
@api_bp.route('/hyper/get_emoji_packs/', methods=['GET'])
|
||||
@loginRequired
|
||||
def getEmojiPacks():
|
||||
return func.listEmojiPacks()
|
||||
index = int(request.args.get('index', ''))
|
||||
packs = func.listEmojiPacks()
|
||||
pack = packs[index]
|
||||
rel_path = pack['relative_path']
|
||||
emojis = pack['emojis']
|
||||
html = ''
|
||||
for emoji in emojis:
|
||||
html += f"""
|
||||
<div class="mb-2">
|
||||
<img src="/{ rel_path }/{ emoji['file_name'] }" width="28" height="28" class="emoji" title=":{ emoji['name'] }:">
|
||||
<span>{ emoji['name'] }</span>
|
||||
</div>
|
||||
"""
|
||||
return html
|
||||
|
||||
# -- delete routes --
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<tr id="pack-{{pack.name}}" class="emoji-pack-row">
|
||||
<td><img src="/{{ pack.preview_image }}" width="28" height="28" class="emoji"></td>
|
||||
<td>{{ pack.name }}</td>
|
||||
<td><a data-bs-toggle="collapse" href="#pack-collapse-{{pack.name}}" class="text-decoration-none" title="Click to see all emojis in this pack">{{ pack.name }} <i class="bi bi-chevron-down small ms-1"></i></a></td>
|
||||
{% if json_pack %}
|
||||
<td>{{ pack.website }}</td>
|
||||
<td>{{ formatRelativeTime(pack.exportedAt) }}</td>
|
||||
|
@ -8,7 +8,12 @@
|
|||
<td><code>{{ pack.relative_path }}</code></td>
|
||||
<td>
|
||||
<div id="actions">
|
||||
<button class="btn btn-sm btn-outline-danger" hx-target="#pack-{{pack.name}}" hx-delete="{{ url_for('api.deleteEmojiPack', pack_name=pack.name) }}">Delete</button>
|
||||
<button class="btn btn-sm btn-outline-danger" hx-target="#pack-{{pack.name}}" hx-delete="{{ url_for('api.deleteEmojiPack', pack_name=pack.name) }}"><i class="bi bi-trash me-1"></i> Delete</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr class="collapse" id="pack-collapse-{{pack.name}}" data-dontshowtoast hx-get="{{ url_for('api.getEmojiPacks', index=index) }}" hx-trigger="intersect" hx-target="#{{ pack.name }}-td">
|
||||
<td class="border-0"></td>
|
||||
<td class="border-0" id="{{ pack.name }}-td">
|
||||
</td>
|
||||
</tr>
|
||||
|
|
Loading…
Add table
Reference in a new issue