Module:RFX report: Difference between revisions

Content deleted Content added
use TemplateStyles (supports mobile now better and generally customizing stuff); remove style= as it was almost exclusively setting float and clear (and removing the style on the background, which should probably just be the default wikitable rather than white); moved some table paddings to be margins
update from /sandbox. Implements support for RRfAs
 
(5 intermediate revisions by 4 users not shown)
Line 60:
end
colour = colour or ''
 
local percentStr = mw.ustring.format( '%d', percent )
if percent == 0 and supports == 0 and opposes == 0 and neutrals == 0 then
percentStr = 'N/A'
elseif percent == 100 and opposes ~= 0 then
percentStr = '>99'
end
 
local votes
if supports and opposes and neutrals and percent then
Line 67 ⟶ 75:
| class="rfx-report-number" | [[%s#Oppose|%d]]
| class="rfx-report-number" | [[%s#Neutral|%d]]
| class="rfx-report-number rfx-report-percent" style="background: #%s; color: #202122" | %ds]==],
page, supports,
page, opposes,
page, neutrals,
colour, percentpercentStr
)
else
Line 125 ⟶ 133:
elseif rfxType == 'rfb' then
rfxCaps = 'RfB'
elseif rfxType == 'rrfa' then
rfxCaps = 'RRfA'
else
return nil
Line 142 ⟶ 152:
local rfas = {}
local rfbs = {}
local rrfas = {}
for i, rfxPage in ipairs( rfxes ) do
local rfxObject = rfx.new( rfxPage )
Line 149 ⟶ 160:
elseif rfxObject.type == 'rfb' then
table.insert( rfbs, rfxObject )
elseif rfxObject.type == 'rrfa' then
table.insert( rrfas, rfxObject)
end
end
end
return rfas, rfbs, rrfas
end
 
local function makeReportRows()
local rfas, rfbs, rrfas = getRfasRfbsSeparate()
 
local ret = {}
if #rfas + #rrfas > 0 then
table.insert( ret, makeHeading( 'rfa' ) )
for i, rfaObject in ipairs( rfas ) do
table.insert( ret, makeRow( rfaObject ) )
end
for i, rrfaObject in ipairs( rrfas ) do
table.insert( ret, makeRow( rrfaObject ) )
end
end
if #rfbs > 0 then
table.insert( ret, makeHeading( 'rfb' ) )
Line 215 ⟶ 232:
 
function p.countRfas()
local rfas, rfbs, rrfas = getRfasRfbsSeparate()
return getTableLength(rfas)
end