Module:Protection banner: Difference between revisions

add a "TOOLTIPFRAGMENT" parameter, as we were having the same issues with commas in tooltips as we did with INTROBLURB and INTROFRAGMENT; also move the config module name to a global variable so that it's more obvious when updating
m (Protected Module:Protection banner: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite)))
(add a "TOOLTIPFRAGMENT" parameter, as we were having the same issues with commas in tooltips as we did with INTROBLURB and INTROFRAGMENT; also move the config module name to a global variable so that it's more obvious when updating)
Line 10: Line 10:
-- Lazily initialise modules and objects we don't always need.
-- Lazily initialise modules and objects we don't always need.
local getArgs, makeMessageBox, lang
local getArgs, makeMessageBox, lang
-- Set constants.
local CONFIG_MODULE = 'Module:Protection banner/config'


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Line 421: Line 424:
parameterFuncs.TALKPAGE          = self._makeTalkPageParameter
parameterFuncs.TALKPAGE          = self._makeTalkPageParameter
parameterFuncs.TOOLTIPBLURB      = self._makeTooltipBlurbParameter
parameterFuncs.TOOLTIPBLURB      = self._makeTooltipBlurbParameter
parameterFuncs.TOOLTIPFRAGMENT    = self._makeTooltipFragmentParameter
parameterFuncs.VANDAL            = self._makeVandalTemplateParameter
parameterFuncs.VANDAL            = self._makeVandalTemplateParameter
Line 642: Line 646:
else
else
return self:_getExpandedMessage('tooltip-blurb-noexpiry')
return self:_getExpandedMessage('tooltip-blurb-noexpiry')
end
end
function Blurb:_makeTooltipFragmentParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('tooltip-fragment-expiry')
else
return self:_getExpandedMessage('tooltip-fragment-noexpiry')
end
end
end
end
Line 881: Line 893:
function p.main(frame, cfg)
function p.main(frame, cfg)
getArgs = getArgs or require('Module:Arguments').getArgs
getArgs = getArgs or require('Module:Arguments').getArgs
cfg = cfg or require('Module:Protection banner/config')
cfg = cfg or require(CONFIG_MODULE)
local parentTitle = frame:getParent():getTitle()
local parentTitle = frame:getParent():getTitle()
parentTitle = parentTitle:gsub('/sandbox$', '')
parentTitle = parentTitle:gsub('/sandbox$', '')