Module:NavboxMobile: Difference between revisions
EnWikiAdmin (talk | contribs) No edit summary |
EnWikiAdmin (talk | contribs) No edit summary |
||
Line 266: | Line 266: | ||
end | end | ||
local function renderListRow(tbl, path, parentLevel) | local function renderListRow(tbl, path, parentLevel) | ||
Line 292: | Line 276: | ||
if args[groupKey] then | if args[groupKey] then | ||
-- Add custom inline styles based on group levels | |||
local inlineStyles = "" | |||
-- Render the group (heading) | -- Render the group (heading) | ||
local groupRow = addTableRow(tbl) | local groupRow = addTableRow(tbl) | ||
Line 299: | Line 286: | ||
:addClass('navboxMobile-group-level' .. parentLevel) -- Level-specific class | :addClass('navboxMobile-group-level' .. parentLevel) -- Level-specific class | ||
:attr('data-level', parentLevel) -- Optional attribute for CSS targeting | :attr('data-level', parentLevel) -- Optional attribute for CSS targeting | ||
:cssText(inlineStyles) | |||
:wikitext(processItem(args[groupKey])) | :wikitext(processItem(args[groupKey])) | ||
Line 307: | Line 295: | ||
:attr('colspan', 2) | :attr('colspan', 2) | ||
:addClass('navboxMobile-list-content') | :addClass('navboxMobile-list-content') | ||
:addClass('navboxMobile-list-level' .. parentLevel) -- | :addClass('navboxMobile-list-level' .. parentLevel) -- Level-specific class | ||
:addClass((i % 2 == 1) and 'navboxMobile-odd' or 'navboxMobile-even') -- | :addClass((i % 2 == 1) and 'navboxMobile-odd' or 'navboxMobile-even') | ||
: | :css('padding', '0 0.25em') | ||
:css('width', parentLevel == 2 and '95%' or '90%') -- Adjust width for narrowing | |||
:cssText(inlineStyles) -- Apply the same styles as the group heading | |||
:cssText(args[listKey .. 'style']) | |||
if args[listKey] == 'child' then | if args[listKey] == 'child' then | ||
local newPath = (path ~= "" and path .. "_" or "") .. i | local newPath = (path ~= "" and path .. "_" or "") .. i | ||
renderListRow(tbl, tostring(newPath), parentLevel + 1) | renderListRow(tbl, tostring(newPath), parentLevel + 1) | ||
else | |||
listCell | |||
:addClass('hlist') | |||
:wikitext(processItem(args[listKey], args.nowrapitems)) | |||
end | end | ||
end | end |