Module:Message box: Difference between revisions

Content added Content deleted
(show link to talk discussion when used in small format, per request)
 
m (66 revisions imported from wikipedia:Module:Message_box)
Line 12: Line 12:
-- Define constants
-- Define constants
local CONFIG_MODULE = 'Module:Message box/configuration'
local CONFIG_MODULE = 'Module:Message box/configuration'
local DEMOSPACES = {talk = 'tmbox', image = 'imbox', file = 'imbox', category = 'cmbox', article = 'ambox', main = 'ambox'}
local DEMOSPACES = {user = 'tmbox', talk = 'tmbox', image = 'imbox', file = 'imbox', category = 'cmbox', article = 'ambox', main = 'ambox'}


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Line 268: Line 268:
end
end
if talkTitle and talkTitle.exists then
if talkTitle and talkTitle.exists then
local talkText = 'Relevant discussion may be found on'
local talkText
if talkArgIsTalkPage then
if self.isSmall then
talkText = string.format(
local talkLink = talkArgIsTalkPage and talk or (talkTitle.prefixedText .. '#' .. talk)
'%s [[%s|%s]].',
talkText = string.format('([[%s|talk]])', talkLink)
talkText,
else
talk,
talkText = 'Relevant discussion may be found on'
talkTitle.prefixedText
if talkArgIsTalkPage then
)
talkText = string.format(
else
'%s [[%s|%s]].',
talkText = string.format(
talkText,
'%s the [[%s#%s|talk page]].',
talk,
talkText,
talkTitle.prefixedText
talkTitle.prefixedText,
)
talk
else
)
talkText = string.format(
end
'%s the [[%s#%s|talk page]].',
talkText,
talkTitle.prefixedText,
talk
)
end
end
self.talk = talkText
self.talk = talkText
end
end
Line 530: Line 524:
:addClass('mbox-text-span')
:addClass('mbox-text-span')
:wikitext(self.issue or nil)
:wikitext(self.issue or nil)
if (self.talk or self.fix) then
if (self.talk or self.fix) and not self.isSmall then
textCellDiv:tag('span')
textCellDiv:tag('span')
:addClass('hide-when-compact')
:addClass('hide-when-compact')