Module:Navbox: Difference between revisions
replacing gutter rows with CSS borders; uses temporary navbox-spacing-temp class to avoid cache issues
m>Johnuniq (update from Module:Navbox/sandbox per Template talk:Navbox#Merging nowrap navbox to implement nowrapitems=yes to nowrap listN + above + below text) |
m>Matt Fitzpatrick (replacing gutter rows with CSS borders; uses temporary navbox-spacing-temp class to avoid cache issues) |
||
Line 9: | Line 9: | ||
local args | local args | ||
local border | local border | ||
local listnums = {} | local listnums = {} | ||
Line 78: | Line 77: | ||
end | end | ||
return item | return item | ||
end | end | ||
Line 113: | Line 97: | ||
if not args.title then return end | if not args.title then return end | ||
local titleRow = | local titleRow = tbl:tag('tr') | ||
if args.titlegroup then | if args.titlegroup then | ||
Line 171: | Line 155: | ||
if not args.above then return end | if not args.above then return end | ||
tbl:tag('tr') | |||
:tag('td') | :tag('td') | ||
:addClass('navbox-abovebelow') | :addClass('navbox-abovebelow') | ||
Line 185: | Line 169: | ||
if not args.below then return end | if not args.below then return end | ||
tbl:tag('tr') | |||
:tag('td') | :tag('td') | ||
:addClass('navbox-abovebelow') | :addClass('navbox-abovebelow') | ||
Line 200: | Line 184: | ||
-- | -- | ||
local function renderListRow(tbl, index, listnum) | local function renderListRow(tbl, index, listnum) | ||
local row = | local row = tbl:tag('tr') | ||
if index == 1 and args.imageleft then | if index == 1 and args.imageleft then | ||
Line 207: | Line 191: | ||
:addClass('navbox-image') | :addClass('navbox-image') | ||
:addClass(args.imageclass) | :addClass(args.imageclass) | ||
:css('width', ' | :css('width', '1px') -- Minimize width | ||
:css('padding', '0px 2px 0px 0px') | :css('padding', '0px 2px 0px 0px') | ||
:cssText(args.imageleftstyle) | :cssText(args.imageleftstyle) | ||
:attr('rowspan', | :attr('rowspan', #listnums) | ||
:tag('div') | :tag('div') | ||
:wikitext(processItem(args.imageleft)) | :wikitext(processItem(args.imageleft)) | ||
Line 223: | Line 207: | ||
:addClass(args.groupclass) | :addClass(args.groupclass) | ||
:cssText(args.basestyle) | :cssText(args.basestyle) | ||
:css('width', args.groupwidth or '1%') -- If groupwidth not specified, minimize width | |||
groupCell | groupCell | ||
Line 279: | Line 260: | ||
:addClass('navbox-image') | :addClass('navbox-image') | ||
:addClass(args.imageclass) | :addClass(args.imageclass) | ||
:css('width', ' | :css('width', '1px') -- Minimize width | ||
:css('padding', '0px 0px 0px 2px') | :css('padding', '0px 0px 0px 2px') | ||
:cssText(args.imagestyle) | :cssText(args.imagestyle) | ||
:attr('rowspan', | :attr('rowspan', #listnums) | ||
:tag('div') | :tag('div') | ||
:wikitext(processItem(args.image)) | :wikitext(processItem(args.image)) | ||
Line 362: | Line 343: | ||
if border == 'subgroup' or border == 'none' then | if border == 'subgroup' or border == 'none' then | ||
tbl | tbl | ||
:addClass('navbox-subgroup') | :addClass('navbox-subgroup navbox-spacing-temp') | ||
:cssText(args.bodystyle) | :cssText(args.bodystyle) | ||
:cssText(args.style) | :cssText(args.style) | ||
Line 424: | Line 405: | ||
local nav = res:tag('div') | local nav = res:tag('div') | ||
:attr('role', 'navigation') | :attr('role', 'navigation') | ||
:addClass('navbox') | :addClass('navbox navbox-spacing-temp') | ||
:cssText(args.bodystyle) | :cssText(args.bodystyle) | ||
:cssText(args.style) | :cssText(args.style) |