Module:CRTModel: Difference between revisions

Added release_year and msrp display to infobox Overview section (via update-page on MediaWiki MCP Server)
Updated chassis link to prefill manufacturer and chassis_family when creating new chassis pages (via update-page on MediaWiki MCP Server)
Tag: Reverted
Line 55: Line 55:
else
else
fullDiv:wikitext(valueHtmlOrWikitext)
fullDiv:wikitext(valueHtmlOrWikitext)
end
end
-- Helper function to create a link that's either blue (exists) or red (doesn't exist) with prefill params
local function makeFormLink(pageName, form, displayText, prefillParams)
local titleObj = mw.title.new(pageName)
if titleObj and titleObj.exists then
-- Page exists - normal blue link
return '[[' .. pageName .. '|' .. displayText .. ']]'
else
-- Page doesn't exist - red link to form with prefill params
local params = {
form = form,
target = pageName
}
-- Add prefill parameters
if prefillParams then
for k, v in pairs(prefillParams) do
params[k] = v
end
end
local url = mw.uri.fullUrl('Special:FormEdit', params)
return '<span class="new">[' .. tostring(url) .. ' ' .. displayText .. ']</span>'
end
end
end
end
Line 222: Line 245:
if chassis then
if chassis then
local chassisWikitext = string.format(
-- Build prefill parameters for chassis form
'{{#formredlink: target=%s |form=Chassis |existing page link text=%s }}',
local chassisPrefill = {}
chassis, chassis
if brand then
)
chassisPrefill['Chassis[manufacturer]'] = brand
chassisDisplay = frame:preprocess(chassisWikitext)
end
if chassis_family then
chassisPrefill['Chassis[chassis_family]'] = chassis_family
end
chassisDisplay = makeFormLink(chassis, 'Chassis', chassis, chassisPrefill)
end
end
MediaWiki Appliance - Powered by TurnKey Linux