Module:RemoteControl: Difference between revisions
Create remote control infobox module matching CRT model style (via create-page on MediaWiki MCP Server) |
Add ECID field to infobox matching CRT model implementation (via update-page on MediaWiki MCP Server) |
||
| (3 intermediate revisions by 2 users not shown) | |||
| Line 63: | Line 63: | ||
local title = mw.title.getCurrentTitle() | local title = mw.title.getCurrentTitle() | ||
local pageName = title.text | local pageName = title.text | ||
local pageId = title.id or 0 | |||
local brand = trim(args.brand) | local brand = trim(args.brand) | ||
| Line 68: | Line 69: | ||
local image_main = trim(args.image_main) | local image_main = trim(args.image_main) | ||
-- | -- Load the remote control stylesheet | ||
local styleTag = frame:extensionTag('templatestyles', '', {src = 'Template: | local styleTag = frame:extensionTag('templatestyles', '', {src = 'Template:Remote control/styles.css'}) | ||
local container = mw.html.create('div') | local container = mw.html.create('div') | ||
| Line 76: | Line 77: | ||
css(container, 'float:right; clear:right; margin:0 0 1em 1em; width:22em; font-size:88%; line-height:1.5em; display:grid; grid-template-columns:auto 1fr; gap:3px; padding:3px;') | css(container, 'float:right; clear:right; margin:0 0 1em 1em; width:22em; font-size:88%; line-height:1.5em; display:grid; grid-template-columns:auto 1fr; gap:3px; padding:3px;') | ||
-- Title row | -- Title row | ||
addFullRow( | addFullRow( | ||
container, | container, | ||
| Line 113: | Line 114: | ||
addRow(container, 'Type', 'Remote', false) | addRow(container, 'Type', 'Remote', false) | ||
-- ECID row: build as a normal external link wikitext; preprocess not required, but fine. | |||
local ecidWikitext = string.format('[{{fullurl:%s|curid=%d}} EC%d]', pageName, pageId, pageId) | |||
addRow(container, 'ECID', frame:preprocess(ecidWikitext), true) | |||
-- Contribute section | -- Contribute section | ||
| Line 130: | Line 135: | ||
css(editDiv, 'grid-column: 1 / -1; padding:0.2em 0.4em; text-align:center;') | css(editDiv, 'grid-column: 1 / -1; padding:0.2em 0.4em; text-align:center;') | ||
-- Add edit button | -- Add edit button using the infobox-button classes | ||
editDiv:wikitext('[' .. tostring(editUrl) .. ' <span class="infobox-button infobox-button-primary">Edit this data</span>]') | editDiv:wikitext('[' .. tostring(editUrl) .. ' <span class="infobox-button infobox-button-primary">Edit this data</span>]') | ||