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' ..
' |?Has description=desc\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[4] = description
-- 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'
local accDesc = cells[4]
if accPageName then
if accPageName then
Line 768: Line 766:
table.insert(accessoriesByType[accType], {
table.insert(accessoriesByType[accType], {
page = accPageName,
page = accPageName
desc = accDesc
})
})
end
end
Line 782: Line 779:
local accLinks = {}
local accLinks = {}
for _, acc in ipairs(accs) do
for _, acc in ipairs(accs) do
local displayText = getDisplayTextWithoutBrand(acc.page, brand)
-- Show just "Brand Model" as the link text (the page name)
local linkText = displayText
table.insert(accLinks, '[[' .. acc.page .. ']]')
if acc.desc and acc.desc ~= '' then
linkText = displayText .. ' – ' .. acc.desc
end
table.insert(accLinks, '[[' .. acc.page .. '|' .. linkText .. ']]')
end
end
addRow(container, accType, table.concat(accLinks, '<br>'), true)
addRow(container, accType, table.concat(accLinks, '<br>'), true)
MediaWiki Appliance - Powered by TurnKey Linux