Files
vibetree/web/templates/partials/panel_folder.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

72 lines
3.1 KiB
HTML

{{define "panel_folder"}}
<div class="panel-content p-3" data-panel-type="folder" data-folder-id="{{.Folder.ID}}">
{{template "breadcrumb" .Breadcrumb}}
<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}}
<h6 class="mt-3 mb-2">Subfolders</h6>
<div class="list-group mb-3">
{{range .Subfolders}}
<a href="#" class="list-group-item list-group-item-action folder-link d-flex align-items-center" data-id="{{.ID}}">
<i class="bi {{iconOr .Icon "bi-folder-fill"}} text-warning-emphasis me-2"></i>
{{.Name}}
<span class="ms-auto text-body-secondary small">{{.FolderCount}} folder(s), {{.AssetCount}} asset(s)</span>
</a>
{{end}}
</div>
{{end}}
<div class="d-flex align-items-center flex-wrap gap-2 mt-3 mb-2">
<h6 class="mb-0 me-2">Assets</h6>
<form class="d-flex gap-2 flex-wrap align-items-center panel-filter-form" data-folder-id="{{.Folder.ID}}">
<select class="form-select form-select-sm" name="item_type_id" style="width:auto">
<option value="">All Types</option>
{{range .ItemTypes}}<option value="{{.ID}}" {{if eq .ID $.FilterType}}selected{{end}}>{{.Name}}</option>{{end}}
</select>
<select class="form-select form-select-sm" name="status_id" style="width:auto">
<option value="">All Statuses</option>
{{range .Statuses}}<option value="{{.ID}}" {{if eq .ID $.FilterStat}}selected{{end}}>{{.Name}}</option>{{end}}
</select>
<input type="search" class="form-control form-control-sm" name="q" value="{{.Query}}" placeholder="Filter assets&hellip;" style="width:160px">
</form>
</div>
{{if .Assets}}
<div class="table-responsive">
<table class="table table-sm table-hover asset-table">
<thead><tr><th>Asset ID</th><th>Name</th><th>Type</th><th>Status</th><th>Assigned</th></tr></thead>
<tbody>
{{range .Assets}}
<tr class="asset-row" data-id="{{.ID}}">
<td>{{.AssetTag}}</td>
<td><i class="bi {{iconOr .ItemTypeIcon "bi-box-seam"}} me-1"></i>{{.Name}}</td>
<td>{{.ItemTypeName}}</td>
<td><span class="badge text-bg-{{.StatusColor}}">{{.StatusName}}</span></td>
<td>{{if .AssignedUsername}}{{.AssignedUsername}}{{else}}<span class="text-body-secondary">&mdash;</span>{{end}}</td>
</tr>
{{end}}
</tbody>
</table>
</div>
{{$pages := ceilDiv .Total .PageSize}}
{{if gt $pages 1}}
<nav>
<ul class="pagination pagination-sm">
{{range $i := seqFrom1 $pages}}
<li class="page-item {{if eq $i $.Page}}active{{end}}">
<a class="page-link panel-page-link" href="#" data-folder-id="{{$.Folder.ID}}" data-page="{{$i}}">{{$i}}</a>
</li>
{{end}}
</ul>
</nav>
{{end}}
{{else}}
<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}}