Jump to content
Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
If you make an edit, a temporary account will be created for you.

Module:Feedback: Difference between revisions

From The Petit Planet Wiki
ReisuDesign (talk | contribs)
No edit summary
Tag: Manual revert
ReisuDesign (talk | contribs)
No edit summary
 
(7 intermediate revisions by the same user not shown)
Line 121: Line 121:
------------------------------------------------------------
------------------------------------------------------------


local function renderAttachments(parent, entry)
local function renderAttachments(entry)
local wrapper =
mw.html.create('div')
:addClass('feedback-attachments')
 
local link = trim(entry.link)
local link = trim(entry.link)
local image = trim(entry.image)


if link == '' and image == '' then
if link ~= '' then
return
local linkWrapper =
wrapper:tag('span')
:addClass('feedback-attachment-link')
linkWrapper:tag('span')
:addClass('feedback-attachment-icon')
linkWrapper:wikitext(
'[' .. link .. ' ' .. mw.text.nowiki(link) .. ']'
)
end
end


local attachments =
local image = trim(entry.image)
parent:tag('div')
:addClass('feedback-attachments')


if link ~= '' then
if image ~= '' then
attachments:tag('a')
image = mw.ustring.gsub(
:addClass('feedback-link')
image,
:attr('href', link)
'^File:',
:attr('target', '_blank')
''
:attr('rel', 'noopener noreferrer')
)
:wikitext('View link')
end


if image ~= '' then
local title =
if link ~= '' then
mw.title.new('File:' .. image)
attachments:wikitext(' ')
end


attachments:tag('a')
if title then
:addClass('feedback-image-link')
local imageWrapper =
:attr(
wrapper:tag('span')
'href',
:addClass('feedback-attachment-image')
'./File:' .. image
imageWrapper:tag('span')
:addClass('feedback-attachment-icon')
imageWrapper:wikitext(
'[' ..
title:fullUrl() ..
' ' ..
mw.text.nowiki(image) ..
']'
)
)
:wikitext('View image')
end
end
end
return wrapper
end
end


Line 174: Line 191:
:addClass('feedback-resolution')
:addClass('feedback-resolution')


resolution:wikitext('↳ Resolved by ')
resolution:wikitext('Resolved by ')


if resolvedBy ~= '' then
if resolvedBy ~= '' then
Line 348: Line 365:
-- Attachments
-- Attachments
--------------------------------------------------------
--------------------------------------------------------
 
renderAttachments(
content:node(
content,
    renderAttachments(entry)
entry
)
)