Module:AVDevice: Difference between revisions
Connectivity section: group inputs/outputs by location with left stripe (mirrors TBC group pattern) (via update-page on MediaWiki MCP Server) |
Connectivity: keep Inputs/Outputs as main rows, add location stripe groups inside each value cell (via update-page on MediaWiki MCP Server) |
||
| Line 160: | Line 160: | ||
local count = tonumber(trim(result)) or 0 | local count = tonumber(trim(result)) or 0 | ||
return count | return count | ||
end | |||
-- Helper to build location-grouped I/O content for a value cell | |||
-- Returns HTML string with stripe groups per location, or nil if empty | |||
local function buildLocationGroupedIO(frame, fullPageName, ioType, locations, locationLabels) | |||
local html = '' | |||
local locationCount = 0 | |||
for _, loc in ipairs(locations) do | |||
local count = countIOByLocation(frame, fullPageName, ioType, loc) | |||
if count > 0 then | |||
local locContent = queryIOByLocation(frame, fullPageName, ioType, loc) | |||
if locContent and locContent ~= '' then | |||
locationCount = locationCount + 1 | |||
html = html .. | |||
'<div class="infobox-io-location-group">' .. | |||
'<div class="infobox-io-location-header">' .. locationLabels[loc] .. '</div>' .. | |||
locContent .. | |||
'</div>' | |||
end | |||
end | |||
end | |||
if html == '' then return nil end | |||
return html | |||
end | end | ||
| Line 295: | Line 320: | ||
end | end | ||
-- Connectivity section - | -- Connectivity section - Inputs and Outputs as main rows, | ||
-- with location stripe groups inside each value cell | |||
local locations = {'front', 'rear', 'side'} | local locations = {'front', 'rear', 'side'} | ||
local locationLabels = {front = 'Front', rear = 'Rear', side = 'Side'} | local locationLabels = {front = 'Front', rear = 'Rear', side = 'Side'} | ||
local inputsHtml = buildLocationGroupedIO(frame, fullPageName, 'input', locations, locationLabels) | |||
local outputsHtml = buildLocationGroupedIO(frame, fullPageName, 'output', locations, locationLabels) | |||
local | |||
if | if inputsHtml or outputsHtml then | ||
addSectionRow(container, 'Connectivity') | addSectionRow(container, 'Connectivity') | ||
if inputsHtml then | |||
addRow(container, 'Inputs', inputsHtml, true) | |||
end | |||
if outputsHtml then | |||
addRow(container, 'Outputs', outputsHtml, true) | |||
end | end | ||
end | end | ||