Content deleted Content added
Lets use words when using abbreviation tags |
update from /sandbox. Implements support for RRfAs |
||
(6 intermediate revisions by 4 users not shown) | |||
Line 48:
return nil
end
local style = ''▼
local styleInline = ''▼
local status = rfxObject:getStatus()
if status == 'pending closure' then▼
end▼
local page = rfxObject:getTitleObject().prefixedText
local user = rfxObject.user or rfxObject:getTitleObject().subpageText
Line 66 ⟶ 60:
end
colour = colour or ''
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
votes = mw.ustring.format( [==[
|
|
|
|
colour,
)
else
votes = '\n| colspan="4"
end
if status then
Line 87 ⟶ 89:
status = 'Pending closure...'
end
status =
else
status = '\n|
end
local endTime = rfxObject.endTime
Line 96 ⟶ 98:
local time
if endTime and timeLeft then
time = mw.ustring.format( '\n|
else
time = '\n| colspan="2"
end
local dupes = rfxObject:dupesExist()
if dupes then
dupes = '<span class="
elseif dupes == false then
dupes = 'no'
Line 110 ⟶ 112:
local report = rfxObject:getReport()
if report then
report = mw.ustring.format( '\n|
else
report = '\n|
▲ if status == 'pending closure' then
pending_class = 'class="rfx-report-pending"'
end
return mw.ustring.format(
'\n|-%s\n|
)
end
Line 127 ⟶ 133:
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
)
Line 144 ⟶ 152:
local rfas = {}
local rfbs = {}
local rrfas = {}
for i, rfxPage in ipairs( rfxes ) do
local rfxObject = rfx.new( rfxPage )
Line 151 ⟶ 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 ) )
for i, rrfaObject in ipairs( rrfas ) do
table.insert( ret, makeRow( rrfaObject ) )
end
end
if #rfbs > 0 then
table.insert( ret, makeHeading( 'rfb' ) )
Line 180 ⟶ 195:
local purgeLink = mw.title.getCurrentTitle():fullUrl( 'action=purge' )
local header = mw.ustring.format(
'\n|+ Requests for [[Wikipedia:Requests for adminship|adminship]] and [[Wikipedia:Requests for bureaucratship|bureaucratship]] <span class="rfx-report-purge plainlinks
purgeLink
)
local rows = makeReportRows() or ''
if rows == '' then
rows = '\n|-\n| colspan="10" | No current discussions. <
end
local style = args.style▼
if not style then▼
if
float = nil
▲ local clear = args.clear or 'left'
▲ style = mw.ustring.format(
▲ clear, float
▲ )
end
return mw.ustring.format( '\n{| class="wikitable" %s%s%s\n|-\n|}', style, header, rows )▼
if not clear or mw.text.trim(clear) == '' then
clear = nil
end
▲ local style = ''
style = string.format(
'style="%s%s"',
clear and ('clear: ' .. clear .. ';') or '',
float and ('float: ' .. float .. ';') or ''
)
end
return mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = 'Module:RFX report/styles.css' }
} .. mw.ustring.format(
▲
style,
header,
rows
)
end
function p.countRfas()
local rfas, rfbs, rrfas = getRfasRfbsSeparate()
return getTableLength(rfas)
end
|