Replace on-screen action buttons with right-click context menus

The tree and main panels now behave like a native file manager: right
click (or the keyboard Menu key) on a folder, asset, breadcrumb crumb, or
empty tree/panel background brings up the relevant actions instead of a
row of always-visible buttons.

- New generic showContextMenu() in app.js with per-target-kind menu
  builders (folder/asset/tree background/panel background), gated by
  admin role the same way the old buttons were.
- Removed: the "..." tree-row action button, and the New Folder/Add
  Asset/Rename/Delete/Edit/Move/Duplicate/Import/Export buttons from the
  inventory toolbar and every panel. Expand All/Collapse All shrank to two
  icon-only buttons next to the search box; everything else creation- or
  mutation-related is right-click only.
- Replaced the per-asset embedded "Move" modal with one shared
  #moveAssetModal populated via a new GET /app/folders/options endpoint,
  since move can now be triggered from any asset row, not just its own
  detail view.
- Breadcrumb crumbs (including the current folder) and folder/asset table
  rows are now valid right-click targets too, not just tree rows.
This commit is contained in:
Owen
2026-08-17 15:24:32 -05:00
parent 218687a1ee
commit 4ceb1cbc03
13 changed files with 299 additions and 193 deletions
+6 -15
View File
@@ -1,15 +1,10 @@
{{define "panel_folder"}}
<div class="panel-content p-3" data-folder-id="{{.Folder.ID}}">
<div class="d-flex align-items-start mb-2">
{{template "breadcrumb" .Breadcrumb}}
<div class="ms-auto d-flex gap-2 admin-only">
<button class="btn btn-sm btn-outline-secondary" data-action="new-subfolder" data-id="{{.Folder.ID}}"><i class="bi bi-folder-plus"></i> Subfolder</button>
<button class="btn btn-sm btn-outline-secondary" data-action="rename-folder" data-id="{{.Folder.ID}}" data-name="{{.Folder.Name}}" data-description="{{.Folder.Description}}" data-icon="{{.Folder.Icon}}" data-sort-order="{{.Folder.SortOrder}}"><i class="bi bi-pencil"></i> Rename</button>
<button class="btn btn-sm btn-outline-danger" data-action="delete-folder" data-id="{{.Folder.ID}}"><i class="bi bi-trash"></i> Delete</button>
</div>
</div>
<div class="panel-content p-3" data-panel-type="folder" data-folder-id="{{.Folder.ID}}">
{{template "breadcrumb" .Breadcrumb}}
<h4 class="mb-1"><i class="bi {{iconOr .Folder.Icon "bi-folder-fill"}} text-warning-emphasis me-1"></i>{{.Folder.Name}}</h4>
<h4 class="mb-1" data-context="folder-header" data-id="{{.Folder.ID}}">
<i class="bi {{iconOr .Folder.Icon "bi-folder-fill"}} text-warning-emphasis me-1"></i>{{.Folder.Name}}
</h4>
{{if .Folder.Description}}<p class="text-body-secondary">{{.Folder.Description}}</p>{{end}}
{{if .Subfolders}}
@@ -38,10 +33,6 @@
</select>
<input type="search" class="form-control form-control-sm" name="q" value="{{.Query}}" placeholder="Filter assets&hellip;" style="width:160px">
</form>
<div class="ms-auto d-flex gap-2">
<a class="btn btn-sm btn-outline-secondary" href="/export/assets.csv?folder_id={{.Folder.ID}}&recursive=1"><i class="bi bi-download"></i> Export</a>
<button class="btn btn-sm btn-primary admin-only" data-action="new-asset" data-folder-id="{{.Folder.ID}}"><i class="bi bi-plus-lg"></i> Add Asset</button>
</div>
</div>
{{if .Assets}}
@@ -74,7 +65,7 @@
</nav>
{{end}}
{{else}}
<p class="text-body-secondary">No assets in this folder yet.</p>
<p class="text-body-secondary">No assets in this folder yet. <span class="admin-only">Right-click here to add one.</span></p>
{{end}}
</div>
{{end}}