Module:Infobox: Difference between revisions

Dropdown list support
(switch_datatable defaults to '' instead of nil)
(Dropdown list support)
Tag: Reverted
Line 423:
:addClass('infobox-buttons')
:attr('data-default-version', self.default_version)
-- Dropdown list instead of buttons if too many versions
if self.versions > self.max_buttons then
-- Dropdown list instead of buttons if too many versions
local select = buttons:tag('select'):addClass('infobox-buttons-select')
end
for version=1, self.versions do
-- Create all the buttons
select:tag('option')
for version=1, self.versions do
buttons :tagattr('spanvalue', version)
:attr('data-switch-index', version)
:attr('data-switch-anchor', '#'..self.version_names[version])
:wikitext(self.version_names[version])
:addClass('button')
end
:wikitext(self.version_names[version])
else
-- Individual buttons if not too many versions
for version=1, self.versions do
buttons:tag('span')
:attr('data-switch-index', version)
:attr('data-switch-anchor', '#'..self.version_names[version])
:addClass('button')
:wikitext(self.version_names[version])
end
end
end