Module:CRTModel: Difference between revisions
Fix Parts section: capitalize IC, remove description from link, add "Add a part" button (always show section) (via update-page on MediaWiki MCP Server) |
Accessories: show just "Brand Model" link instead of model code + description (via update-page on MediaWiki MCP Server) |
||
| Line 735: | Line 735: | ||
' |?Has accessory type=type\n' .. | ' |?Has accessory type=type\n' .. | ||
' |?Has model code=model\n' .. | ' |?Has model code=model\n' .. | ||
' |format=broadtable\n' .. | ' |format=broadtable\n' .. | ||
' |headers=hide\n' .. | ' |headers=hide\n' .. | ||
| Line 754: | Line 753: | ||
end | end | ||
-- cells[1] = page name, cells[2] = type, cells[3] = model code | -- cells[1] = page name, cells[2] = type, cells[3] = model code | ||
if #cells >= 2 then | if #cells >= 2 then | ||
local accPageName = cells[1] | local accPageName = cells[1] | ||
local accType = cells[2] or 'Accessory' | local accType = cells[2] or 'Accessory' | ||
if accPageName then | if accPageName then | ||
| Line 768: | Line 766: | ||
table.insert(accessoriesByType[accType], { | table.insert(accessoriesByType[accType], { | ||
page = accPageName | page = accPageName | ||
}) | }) | ||
end | end | ||
| Line 782: | Line 779: | ||
local accLinks = {} | local accLinks = {} | ||
for _, acc in ipairs(accs) do | for _, acc in ipairs(accs) do | ||
-- Show just "Brand Model" as the link text (the page name) | |||
table.insert(accLinks, '[[' .. acc.page .. ']]') | |||
table.insert(accLinks, '[[' .. acc.page | |||
end | end | ||
addRow(container, accType, table.concat(accLinks, '<br>'), true) | addRow(container, accType, table.concat(accLinks, '<br>'), true) | ||