Jump to content

Module:RFX report and Module:RFX report/sandbox: Difference between pages

(Difference between pages)
Page 1
Page 2
Content deleted Content added
update from /sandbox. Implements support for RRfAs
 
oh it's twice
 
Line 42: Line 42:
end
end
return t
return t
end

local function rfxCapsTooltip(rfxType)
if rfxType == 'rfa' then
return '{{tooltip|RfA|Requests for adminship}}'
elseif rfxType == 'rfb' then
return '{{tooltip|RfB|Requests for bureaucratship}}'
elseif rfxType == 'rrfa' then
return '{{tooltip|RRfA|Reconfirmation requests for adminship}}'
else
return nil
end
end
end


Line 110: Line 122:
dupes = '--'
dupes = '--'
end
end
local rfxtype = mw.ustring.format( '\n| %s', rfxCapsTooltip(rfxObject.type))
local report = rfxObject:getReport()
local report = rfxObject:getReport()
if report then
if report then
Line 121: Line 134:
end
end
return mw.ustring.format(
return mw.ustring.format(
'\n|-%s\n| [[%s|%s]]%s%s%s\n| class="rfx-report-dupes" | %s%s',
'\n|-%s%s\n|[[%s|%s]]%s%s%s\n| class="rfx-report-dupes" | %s%s',
pending_class, page, user, votes, status, time, dupes, report
pending_class, rfxtype, page, user, votes, status, time, dupes, report
)
end

local function makeHeading( rfxType )
local frame = mw.getCurrentFrame()
local rfxCaps
if rfxType == 'rfa' then
rfxCaps = 'RfA'
elseif rfxType == 'rfb' then
rfxCaps = 'RfB'
elseif rfxType == 'rrfa' then
rfxCaps = 'RRfA'
else
return nil
end
return mw.ustring.format(
'\n|-\n! scope="col" | %s candidate !! scope="col" | <abbr title="Support">S</abbr> !! scope="col" | <abbr title="Oppose">O</abbr> !! scope="col" | <abbr title="Neutral">N</abbr> !! scope="col" | <abbr title="Support percentage (%%)">S %%</abbr> !! scope="col" | Status !! scope="col" | Ending (UTC) !! scope="col" | Time left !! scope="col" | <abbr title="Has duplicate votes?">Dups?</abbr> !! scope="col" | Report',
rfxCaps
)
)
end
end
Line 173: Line 168:


local ret = {}
local ret = {}
if #rfas + #rrfas > 0 then
if #rfas + #rrfas + #rfbs > 0 then
table.insert( ret, '\n|-\n! scope="col" | type !! scope="col" | Candidate !! scope="col" | <abbr title="Support">S</abbr> !! scope="col" | <abbr title="Oppose">O</abbr> !! scope="col" | <abbr title="Neutral">N</abbr> !! scope="col" | <abbr title="Support percentage (%%)">S %%</abbr> !! scope="col" | Status !! scope="col" | Ending (UTC) !! scope="col" | Time left !! scope="col" | <abbr title="Has duplicate votes?">Dups?</abbr> !! scope="col" | Report' )
table.insert( ret, makeHeading( 'rfa' ) )
for i, rfaObject in ipairs( rfas ) do
for i, rfaObject in ipairs( rfas ) do
table.insert( ret, makeRow( rfaObject ) )
table.insert( ret, makeRow( rfaObject ) )
Line 181: Line 176:
table.insert( ret, makeRow( rrfaObject ) )
table.insert( ret, makeRow( rrfaObject ) )
end
end
end
if #rfbs > 0 then
table.insert( ret, makeHeading( 'rfb' ) )
for i, rfbObject in ipairs( rfbs ) do
for i, rfbObject in ipairs( rfbs ) do
table.insert( ret, makeRow( rfbObject ) )
table.insert( ret, makeRow( rfbObject ) )