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

69 lines
2.9 KiB
HTML

{{define "panel_asset"}}
<div class="panel-content p-3" data-asset-id="{{.Asset.ID}}">
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="#" class="breadcrumb-link" data-type="root">Inventory</a></li>
{{range .Asset.FolderPath}}
<li class="breadcrumb-item"><a href="#" class="breadcrumb-link" data-type="folder" data-id="{{.ID}}">{{.Name}}</a></li>
{{end}}
<li class="breadcrumb-item active" aria-current="page">{{.Asset.Name}}</li>
</ol>
</nav>
<div class="d-flex align-items-center gap-2 mb-3 mt-2" data-context="asset-header" data-id="{{.Asset.ID}}" title="Right-click for actions">
<i class="bi {{iconOr .Asset.ItemTypeIcon "bi-box-seam"}} fs-3 text-body-secondary"></i>
<div>
<h4 class="mb-0">{{.Asset.Name}}</h4>
<div class="text-body-secondary">{{.Asset.AssetTag}} &middot; {{.Asset.ItemTypeName}}</div>
</div>
<span class="badge text-bg-{{.Asset.StatusColor}} ms-2 fs-6">{{.Asset.StatusName}}</span>
</div>
<div class="row g-3">
<div class="col-md-6">
<div class="card mb-3">
<div class="card-header py-2 fw-semibold">Details</div>
<table class="table table-sm mb-0">
<tbody>
<tr><th class="w-25">Assigned User</th><td>{{if .Asset.AssignedUsername}}{{.Asset.AssignedUsername}}{{else}}<span class="text-body-secondary">Unassigned</span>{{end}}</td></tr>
<tr><th>Created</th><td>{{fmtDate .Asset.CreatedAt}}</td></tr>
<tr><th>Updated</th><td>{{fmtDate .Asset.UpdatedAt}}</td></tr>
</tbody>
</table>
</div>
{{if .Asset.Notes}}
<div class="card mb-3">
<div class="card-header py-2 fw-semibold">Notes</div>
<div class="card-body py-2" style="white-space:pre-wrap">{{.Asset.Notes}}</div>
</div>
{{end}}
</div>
<div class="col-md-6">
{{if .Asset.CustomFields}}
<div class="card mb-3">
<div class="card-header py-2 fw-semibold">{{.Asset.ItemTypeName}} Fields</div>
<table class="table table-sm mb-0">
<tbody>
{{range .Asset.CustomFields}}
<tr>
<th class="w-40">{{.Def.Name}}</th>
<td>
{{if eq .Def.FieldType "boolean"}}
{{if eq .Value "true"}}<i class="bi bi-check-circle-fill text-success"></i>{{else}}<i class="bi bi-x-circle text-body-secondary"></i>{{end}}
{{else if eq .Def.FieldType "url"}}
{{if .Value}}<a href="{{.Value}}" target="_blank" rel="noopener">{{.Value}}</a>{{end}}
{{else}}
{{if .Value}}{{.Value}}{{else}}<span class="text-body-secondary">&mdash;</span>{{end}}
{{end}}
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
{{end}}
</div>
</div>
</div>
{{end}}