Add download buttons for sprites and theme backgrounds #3

Closed
opened 2026-06-08 12:31:52 -07:00 by allen · 0 comments
Owner

Summary

Sprites and background images can be uploaded via the admin UI, but there is no way to download them back. Users need download buttons to save existing assets (e.g., to edit externally and re-upload, or to back up customizations).

Approach

No server changes needed — all assets are already served statically at known paths. Added download links/buttons to existing cards in the admin JS, plus minimal CSS.

Changes

admin/admin.js

  • loadSprites(): Added DOWNLOAD button (<a> with download attribute) next to UPLOAD, only shown when sprite.exists is true
  • loadThemeManager(): Added DOWNLOAD link next to UPLOAD in each theme direction cell, only shown when the direction image exists
  • Both wrapped in a .sprite-btn-row div for side-by-side layout

admin/admin.css

  • Added .sprite-btn-row flexbox class for button layout

Verification

  1. Admin → Sprites tab: each sprite with an image shows both UPLOAD and DOWNLOAD side by side
  2. Clicking DOWNLOAD triggers browser file save with correct filename (e.g., smallProp.png)
  3. Sprites without an image only show UPLOAD
  4. Admin → Themes tab: each direction with an image shows DOWNLOAD next to UPLOAD
  5. Directions without an image only show UPLOAD

Commit

3a3d461 — Add download buttons for sprites and theme backgrounds

## Summary Sprites and background images can be uploaded via the admin UI, but there is no way to download them back. Users need download buttons to save existing assets (e.g., to edit externally and re-upload, or to back up customizations). ## Approach No server changes needed — all assets are already served statically at known paths. Added download links/buttons to existing cards in the admin JS, plus minimal CSS. ## Changes ### `admin/admin.js` - **`loadSprites()`**: Added DOWNLOAD button (`<a>` with `download` attribute) next to UPLOAD, only shown when `sprite.exists` is true - **`loadThemeManager()`**: Added DOWNLOAD link next to UPLOAD in each theme direction cell, only shown when the direction image exists - Both wrapped in a `.sprite-btn-row` div for side-by-side layout ### `admin/admin.css` - Added `.sprite-btn-row` flexbox class for button layout ## Verification 1. Admin → Sprites tab: each sprite with an image shows both UPLOAD and DOWNLOAD side by side 2. Clicking DOWNLOAD triggers browser file save with correct filename (e.g., `smallProp.png`) 3. Sprites without an image only show UPLOAD 4. Admin → Themes tab: each direction with an image shows DOWNLOAD next to UPLOAD 5. Directions without an image only show UPLOAD ## Commit `3a3d461` — Add download buttons for sprites and theme backgrounds
allen added the enhancementadmin-ui labels 2026-06-08 12:31:52 -07:00
allen closed this issue 2026-06-08 12:32:01 -07:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: allen/ADS-Bit#3