Files
vibetree/web/templates/partials/tree_children.html
T
Owen 4ceb1cbc03 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.
2026-08-17 15:24:32 -05:00

40 lines
1.6 KiB
HTML

{{define "tree_children"}}
{{range .}}
{{if eq .Type "folder"}}
<li class="tree-node" data-type="folder" data-id="{{.ID}}" draggable="true">
<div class="tree-row" data-type="folder" data-id="{{.ID}}" tabindex="0">
{{if .HasChildren}}
<button type="button" class="tree-toggle{{if .Expanded}} expanded{{end}}" data-id="{{.ID}}" aria-label="Toggle">
<i class="bi bi-chevron-right"></i>
</button>
{{else}}
<span class="tree-toggle-spacer"></span>
{{end}}
<i class="bi {{iconOr .Icon "bi-folder-fill"}} tree-icon text-warning-emphasis"></i>
<span class="tree-label">{{.Name}}</span>
</div>
<ul class="tree-children list-unstyled{{if not .Expanded}} d-none{{end}}" data-expanded="{{.Expanded}}" data-loaded="{{.Expanded}}">
{{if .Expanded}}{{template "tree_children" .Children}}{{end}}
</ul>
</li>
{{else if eq .Type "asset"}}
<li class="tree-node" data-type="asset" data-id="{{.ID}}" draggable="true">
<div class="tree-row" data-type="asset" data-id="{{.ID}}" tabindex="0">
<span class="tree-toggle-spacer"></span>
<i class="bi {{iconOr .Icon "bi-box-seam"}} tree-icon text-body-secondary"></i>
<span class="tree-label">{{.Name}}</span>
<span class="badge rounded-pill text-bg-{{.StatusColor}} tree-status-badge">{{.StatusName}}</span>
</div>
</li>
{{else}}
<li class="tree-node tree-node-more">
<div class="tree-row tree-row-more text-body-secondary fst-italic">
<span class="tree-toggle-spacer"></span>
<i class="bi bi-three-dots"></i>
<span class="tree-label">{{.Name}}</span>
</div>
</li>
{{end}}
{{end}}
{{end}}