Module:Article history: Difference between revisions

Content deleted Content added
change the way collapsible notices are rendered - still needs work
make collapsible notices display outside the action table if the action table is not collapsed
Line 579:
end
 
function CollapsibleNotice:exportHtml(isCollapsedisInCollapsibleTable)
if not self.text then
return nil
Line 634:
 
local html = mw.html.create('tr')
if isCollapsedisInCollapsibleTable then
local textCell = html:tag('td')
:attr('colspan', 3)
Line 974:
local actions = self:getActionObjects()
local actionHtmlObjects = {}
local collapsibleNotices = self:getCollapsibleNoticeObjects()
for _, obj in ipairs(actions or {}) do
table.insert(
Line 981 ⟶ 980:
)
end
local collapsibleNotices = self:getCollapsibleNoticeObjects()
local noCollapsibleRows = #actionHtmlObjects + #collapsibleNotices
-- Find out if we are collapsed or not.
local isCollapsed = false
if self.cfg.uncollapsedRows == 'all' then
isCollapsed = false
elseif noCollapsibleRows == 1 then
isCollapsed = false
else
isCollapsed = noCollapsibleRows > (tonumber(self.cfg.uncollapsedRows) or 3)
end
 
-- Collapsible table for actions and collapsible notices. Collapsible
-- notices are only included in the table if it is collapsed. Action rows
if noCollapsibleRows > 0 then
-- are always included.
-- Find out if we are collapsed or not.
local if isCollapsed or #actionHtmlObjects > 0 then
if self.cfg.uncollapsedRows == 'all' then
isCollapsed = false
elseif noCollapsibleRows == 1 then
isCollapsed = false
else
isCollapsed = noCollapsibleRows > (tonumber(self.cfg.uncollapsedRows) or 3)
end
 
-- Collapsible table base
local collapsibleTable = root
Line 1,057 ⟶ 1,059:
-- Collapsible notices
-- These are only included in the table if it is collapsed. Otherwise,
for _, obj in ipairs(collapsibleNotices) do
-- they are added afterwards, so that they can align with the status
collapsibleTable:node(self:try(obj.exportHtml, obj, isCollapsed))
-- and notices.
if isCollapsed then
for _, obj in ipairs(collapsibleNotices) do
collapsibleTable:node(self:try(obj.exportHtml, obj, isCollapsedtrue))
end
end
Line 1,075 ⟶ 1,082:
end
end
 
-- Add the collapsible notices if we are not collapsed.
if not isCollapsed then
for _, obj in ipairs(collapsibleNotices) do
root:node(self:try(obj.exportHtml, obj, false))
end
end
 
-- Error row