Section "Grundriss (interaktiv)": floor plan with rooms, admin editor, Seebad view
- Table floor_plans (tenant_id, one per apartment, picture = website photo, rooms as JSON with corners in percent of the picture), model FloorPlan with BelongsToTenant, Property::floorPlan() - Admin › Webseite › Grundriss: room list with name, description, photos, equipment (from the equipment list), accessibility hint, visibility, and an area editor (click the corners on the picture) - Section floor_plan: base view without JavaScript (areas jump to the room list), Seebad view with room buttons, highlighted area and a cartouche per room (theme.js initFloorPlans) - Tests: tenant inheritance, point parsing, website output, admin create incl. validation; the render test for all themes now includes the floor plan - Docs: THEMES §5, ZUSAMMENARBEIT §6, STATUS §6 (incl. note for tenancy phase 5) - styles/grundriss: revised rendering, WebP renditions, room areas of the Stommer flat in percent Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
04b5189bd8
commit
f7cbc66451
26 files changed
+877
-1
No files matched your search
@@ -50,3 +50,50 @@ function initMenuPanels() {
|
||||
}
|
||||
|
||||
initMenuPanels();
|
||||
|
||||
/**
|
||||
* Floor plan (sections/floor_plan): one room at a time. Areas and room buttons select a room; on narrow
|
||||
* screens the description below the plan is scrolled into view. Without JavaScript all rooms are listed.
|
||||
*/
|
||||
function initFloorPlans() {
|
||||
const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
|
||||
document.querySelectorAll('[data-floor-plan]').forEach((plan) => {
|
||||
const rooms = [...plan.querySelectorAll('[data-floor-room]')];
|
||||
const links = [...plan.querySelectorAll('[data-floor-room-link]')];
|
||||
if (rooms.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const select = (key, scroll) => {
|
||||
rooms.forEach((room) => {
|
||||
room.hidden = room.id !== key;
|
||||
});
|
||||
links.forEach((link) => {
|
||||
const active = link.dataset.floorRoomLink === key;
|
||||
link.toggleAttribute('data-active', active);
|
||||
if (active) {
|
||||
link.setAttribute('aria-current', 'true');
|
||||
} else {
|
||||
link.removeAttribute('aria-current');
|
||||
}
|
||||
});
|
||||
const room = rooms.find((candidate) => candidate.id === key);
|
||||
if (scroll && room && room.getBoundingClientRect().top > window.innerHeight) {
|
||||
room.scrollIntoView({ behavior: reduceMotion ? 'auto' : 'smooth', block: 'nearest' });
|
||||
}
|
||||
};
|
||||
|
||||
links.forEach((link) => {
|
||||
link.addEventListener('click', (event) => {
|
||||
event.preventDefault();
|
||||
select(link.dataset.floorRoomLink, true);
|
||||
});
|
||||
});
|
||||
|
||||
const fromHash = rooms.find((room) => `#${room.id}` === window.location.hash);
|
||||
select((fromHash ?? rooms[0]).id, false);
|
||||
});
|
||||
}
|
||||
|
||||
initFloorPlans();
|
||||
Reference in new issue
Block a user