Content deleted Content added
make collapsible notices display outside the action table if the action table is not collapsed |
rewrite the Row class internals to deal with function values from the config - other classes also need to be updated |
||
Line 123:
obj.currentTitle = data.currentTitle
obj.isSmall = data.isSmall
return obj
end
function Row:
self.icon = icon
self.
self.iconSize = size
self.iconSmallSize = smallSize
end
function Row:
return maybeCallFunc(self.icon, ...)
end
function Row:
return maybeCallFunc(self.iconCaption, ...)
end
function Row:getIconSize()
if self.isSmall then
return self.iconSmallSize or self.cfg.defaultSmallIconSize or '15px'
else
return self.iconSize or self.cfg.defaultIconSize or '30px'
end
end
function Row:renderIcon(...)
local icon = self:getIcon(...)
if not icon then
return nil
end
return renderImage(icon, self:getIconCaption(...), self:getIconSize())
end
function Row:setNoticeBarIconValues(icon, caption, size)
self.noticeBarIcon = icon
self.noticeBarIconCaption = caption
self.noticeBarIconSize = size
end
function Row:getNoticeBarIcon(...)
return maybeCallFunc(self.noticeBarIcon, ...)
end
function Row:getNoticeBarIconCaption(...)
return maybeCallFunc(self.noticeBarIconCaption, ...)
end
function Row:getNoticeBarIconSize()
return self.noticeBarIconSize or self.cfg.defaultNoticeBarIconSize or '15px'
end
function Row:exportNoticeBarIcon(...)
local icon = self:getNoticeBarIcon(...)
if not icon then
return nil
end
return renderImage(
icon,
self.getNoticeBarCaption(...),
self:getNoticeBarIconSize()
)
end
function Row:setText(text)
self.text = text
end
function Row:getText(...)
return maybeCallFunc(self.text)
end
function Row:exportHtml(...)
local text = self:getText(...)
if not text then
return nil
end
local html = mw.html.create('tr')
html
:tag('td')
:addClass('mbox-image')
:wikitext(
:done()
:tag('td')
:addClass('mbox-text')
:wikitext(
return html
end
function Row:
--
--
self.categories = val
end
function Row:getCategories(...)
local ret = {}
if type(self.categories) == 'table' then
ret[#ret + 1] = Category.new(cat)
end
elseif type(
for _, categoryObj in ipairs(
end
end
return ret
end
Line 234 ⟶ 259:
iconSize = statusCfg.iconSize or obj.cfg.defaultStatusIconSize or '50px'
end
obj:
return obj
Line 248 ⟶ 273:
end
function Status:
self:
return Row.
end
Line 300 ⟶ 325:
end
function MultiStatus:
local ret = {}
for i, obj in ipairs(self.statuses) do
for j, categoryObj in ipairs(obj:
ret[#ret + 1] = categoryObj
end
Line 341 ⟶ 366:
setmetatable(obj, Notice)
obj:
data.icon,
data.iconCaption,
Line 348 ⟶ 373:
)
obj:setText(data.text)
obj:
return obj
Line 540 ⟶ 565:
end
function Action:
local categories = self.actionCfg.categories
if type(categories) == 'table' then
Line 566 ⟶ 591:
setmetatable(obj, CollapsibleNotice)
obj:
data.icon,
data.iconCaption,
Line 573 ⟶ 598:
)
obj:setText(data.text)
obj:
obj.collapsibleText = data.collapsibleText
Line 597 ⟶ 622:
or '20px'
end
icon = renderImage(self.icon, self.
end
Line 1,114 ⟶ 1,139:
-- Child object categories
for i, obj in ipairs(self:getAllObjects()) do
local categories = self:try(obj.
for j, categoryObj in ipairs(categories or {}) do
ret[#ret + 1] = tostring(categoryObj)
|