diff --git a/README.md b/README.md
index f91f6d1..b4af10b 100644
--- a/README.md
+++ b/README.md
@@ -106,6 +106,7 @@ sudo systemctl restart netbox netbox-rq
- **Shape library:** wall, door (with swing arc), window, area/zone, column, cooling unit, power/UPS and free text labels, each with an editable colour.
- **NetBox integration:**
- The palette lists the site's racks (filtered by location) and its non-racked devices, such as access points and cameras. Objects already placed are marked and can only be placed once.
+ - Clickable floor plan previews on Location pages. Clicking a preview opens the floor plan.
- A **Floor Plans** tab on Site and Location pages, with a pre-filled "Add floor plan" button.
- A **Show on floor plan** button on Rack and Device pages that opens the plan, zooms to the object and highlights it.
- **Interactive view mode:** pan, zoom, tooltips (status, role, tenant, height, device count), click to open the rack or device (Ctrl+click opens a new tab), colouring by type, status or role, and a search box that highlights matches.
diff --git a/netbox_floorplanner/__init__.py b/netbox_floorplanner/__init__.py
index fd15274..ad808a8 100644
--- a/netbox_floorplanner/__init__.py
+++ b/netbox_floorplanner/__init__.py
@@ -1,7 +1,7 @@
from django.utils.translation import gettext_lazy as _
from netbox.plugins import PluginConfig
-__version__ = '0.1.1'
+__version__ = '0.1.2'
class FloorPlannerConfig(PluginConfig):
diff --git a/netbox_floorplanner/locale/de/LC_MESSAGES/django.mo b/netbox_floorplanner/locale/de/LC_MESSAGES/django.mo
index 1babd87..58eed25 100644
Binary files a/netbox_floorplanner/locale/de/LC_MESSAGES/django.mo and b/netbox_floorplanner/locale/de/LC_MESSAGES/django.mo differ
diff --git a/netbox_floorplanner/locale/de/LC_MESSAGES/django.po b/netbox_floorplanner/locale/de/LC_MESSAGES/django.po
index 0bd6119..c5ee3b9 100644
--- a/netbox_floorplanner/locale/de/LC_MESSAGES/django.po
+++ b/netbox_floorplanner/locale/de/LC_MESSAGES/django.po
@@ -239,6 +239,9 @@ msgstr "Beschreibung"
msgid "Add floor plan"
msgstr "Grundriss hinzufügen"
+msgid "Open floor plan"
+msgstr "Grundriss öffnen"
+
msgid "Show on floor plan"
msgstr "Im Grundriss anzeigen"
diff --git a/netbox_floorplanner/preview.py b/netbox_floorplanner/preview.py
new file mode 100644
index 0000000..adb9bf5
--- /dev/null
+++ b/netbox_floorplanner/preview.py
@@ -0,0 +1,93 @@
+"""
+Server-side SVG preview of a floor plan (read-only, no JavaScript). Mirrors the
+shape styling of the designer in floorplanner.js in a simplified form.
+"""
+from django.utils.html import escape
+from django.utils.safestring import mark_safe
+
+from .utils import format_meters
+
+__all__ = ('render_preview_svg',)
+
+TYPE_COLORS = {
+ 'area': '#22c55e', 'wall': '#475569', 'door': '#b45309', 'window': '#0ea5e9', 'column': '#64748b',
+ 'rack': '#3b82f6', 'device': '#8b5cf6', 'cooling': '#06b6d4', 'power': '#f59e0b', 'label': '#334155',
+}
+FILLED_TYPES = ('rack', 'device', 'cooling', 'power')
+
+
+def _shade(hex_color):
+ try:
+ n = int(hex_color.lstrip('#'), 16)
+ except ValueError:
+ return hex_color
+ return '#{:02x}{:02x}{:02x}'.format(*(round(((n >> s) & 255) * 0.7) for s in (16, 8, 0)))
+
+
+def _item_svg(item):
+ x, y, w, h = item.x, item.y, item.width, item.height
+ cx, cy = x + w / 2, y + h / 2
+ color = item.color or TYPE_COLORS.get(item.item_type, '#868e96')
+ parts = []
+ t = item.item_type
+ if t == 'area':
+ parts.append(f'')
+ elif t in ('wall', 'door'):
+ parts.append(f'')
+ if t == 'door':
+ parts.append(f'')
+ elif t == 'window':
+ parts.append(f'')
+ elif t == 'column':
+ parts.append(f''
+ f'')
+ elif t in FILLED_TYPES:
+ parts.append(f'')
+ if t == 'rack':
+ fh = min(h * 0.12, 10)
+ parts.append(f'')
+
+ text = item.label or (item.rack.name if item.rack_id else item.device.name if item.device_id else '')
+ if text:
+ if t == 'label':
+ fs = max(8, h * 0.6)
+ else:
+ fs = max(6, min(h * 0.3, (w * 1.6) / max(len(text), 3), 60))
+ fill = '#ffffff' if t in FILLED_TYPES else (item.color or 'currentColor') if t == 'label' else _shade(color)
+ anchor, tx, ty = ('start', x + fs * 0.5, y + fs * 1.2) if t == 'area' else ('middle', cx, cy)
+ parts.append(f'{escape(text)}')
+
+ transform = f' transform="rotate({item.rotation} {cx} {cy})"' if item.rotation else ''
+ return f'{"".join(parts)}'
+
+
+def render_preview_svg(floorplan):
+ width, depth = floorplan.width, floorplan.depth
+ fs = max(10, min(max(width, depth) * 0.025, 200))
+ m = fs * 2
+ items = floorplan.items.select_related('rack', 'device').order_by('z_index', 'pk')
+ background = ''
+ if floorplan.background_image:
+ background = (f'')
+ return mark_safe(
+ f''
+ )
diff --git a/netbox_floorplanner/static/netbox_floorplanner/floorplanner.css b/netbox_floorplanner/static/netbox_floorplanner/floorplanner.css
index 85a6963..78f0207 100644
--- a/netbox_floorplanner/static/netbox_floorplanner/floorplanner.css
+++ b/netbox_floorplanner/static/netbox_floorplanner/floorplanner.css
@@ -158,3 +158,33 @@
.fp-canvas { height: 60vh; }
.fp-palette, .fp-panel { width: auto; max-height: 30vh; border: none; border-top: 1px solid var(--fp-border); }
}
+
+/* Location page previews */
+.fp-preview-list {
+ --fp-floor: #ffffff;
+ --fp-wall: #334155;
+ --fp-muted: #6c757d;
+ display: flex;
+ flex-wrap: wrap;
+ gap: 16px;
+}
+[data-bs-theme="dark"] .fp-preview-list {
+ --fp-floor: #1f2937;
+ --fp-wall: #94a3b8;
+ --fp-muted: #9aa5b1;
+}
+.fp-preview-card {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 6px;
+ padding: 8px;
+ border: 1px solid var(--tblr-border-color, #dee2e6);
+ border-radius: 6px;
+ color: inherit;
+ text-decoration: none;
+ transition: border-color .15s, box-shadow .15s;
+}
+.fp-preview-card:hover { border-color: #206bc4; box-shadow: 0 2px 10px rgba(32, 107, 196, .2); }
+.fp-preview { display: block; width: auto; height: 320px; max-width: 100%; }
+.fp-preview-name { font-weight: 600; }
diff --git a/netbox_floorplanner/template_content.py b/netbox_floorplanner/template_content.py
index 05b09fe..ecfbf50 100644
--- a/netbox_floorplanner/template_content.py
+++ b/netbox_floorplanner/template_content.py
@@ -1,6 +1,7 @@
from netbox.plugins import PluginTemplateExtension
-from .models import FloorPlanItem
+from .models import FloorPlan, FloorPlanItem
+from .preview import render_preview_svg
class RackFloorPlanButton(PluginTemplateExtension):
@@ -19,4 +20,18 @@ class RackFloorPlanButton(PluginTemplateExtension):
})
-template_extensions = [RackFloorPlanButton]
+class LocationFloorPlanPreview(PluginTemplateExtension):
+ """Shows clickable previews of the location's floor plans on the location page."""
+ models = ['dcim.location']
+
+ def full_width_page(self):
+ request = self.context['request']
+ plans = FloorPlan.objects.restrict(request.user, 'view').filter(location=self.context['object'])
+ if not plans:
+ return ''
+ return self.render('netbox_floorplanner/inc/location_floorplans.html', extra_context={
+ 'previews': [(plan, render_preview_svg(plan)) for plan in plans],
+ })
+
+
+template_extensions = [RackFloorPlanButton, LocationFloorPlanPreview]
diff --git a/netbox_floorplanner/templates/netbox_floorplanner/inc/designer.html b/netbox_floorplanner/templates/netbox_floorplanner/inc/designer.html
index 7f526ad..c01d3bc 100644
--- a/netbox_floorplanner/templates/netbox_floorplanner/inc/designer.html
+++ b/netbox_floorplanner/templates/netbox_floorplanner/inc/designer.html
@@ -1,5 +1,5 @@
{% load static %}
-
+
{% csrf_token %}
{{ designer_config|json_script:"fp-config" }}
-
+
diff --git a/netbox_floorplanner/templates/netbox_floorplanner/inc/location_floorplans.html b/netbox_floorplanner/templates/netbox_floorplanner/inc/location_floorplans.html
new file mode 100644
index 0000000..fb6161f
--- /dev/null
+++ b/netbox_floorplanner/templates/netbox_floorplanner/inc/location_floorplans.html
@@ -0,0 +1,14 @@
+{% load static %}
+{% load i18n %}
+
+
diff --git a/pyproject.toml b/pyproject.toml
index 25ba52c..843c880 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "netbox-floorplanner"
-version = "0.1.1"
+version = "0.1.2"
description = "Modern drag & drop floor plan designer for NetBox 4.7+"
readme = "README.md"
license = "Apache-2.0"