Module:Tasks
Jump to navigation
Jump to search
Documentation for Module:Tasks does not exist yet [create] (How does this work?)
local getArgs = require("Module:Arguments").getArgs
local yesno = require("Module:Yesno")
local SMWTable = require("Module:SMWTable")
local p = {}
function p.table(frame)
local args = getArgs(frame)
return SMWTable.new({
selection = "[[Wiki task description::+]]" .. (args.query or ""),
attributes = {
class = "stdt__table_v2 sortable",
}
})
:column({
label = "",
printouts = {
[""] = "=#", -- "pagename"
["Wiki task status"] = ""
},
render = function(item)
return frame:expandTemplate({
title = "todo",
args = {
[1] = item["Wiki task status"],
["link"] = item[1]
}
})
end
})
:column({
label = "",
printouts = {
["Wiki task is sprout friendly"] = "",
},
render = function(item)
if yesno(item["Wiki task is sprout friendly"]) then
return "[[File:New adventurer status icon1.png|24px|Sprout/new editor friendly!|link=]]"
else
return ""
end
end
})
:column(SMWTable.textColumn({
label = "Task",
property = "Wiki task description",
}))
:column({
label = "Part of",
printouts = {
[""] = "=#", -- "pagename" (parent page and anchor) of task subobject
},
render = function(item)
local link = item[1]
local label = mw.title.new(link).text -- remove fragment with subobject ID; remove namespace/interwiki prefix
return "[[" .. link .. "|" .. label .. "]]"
end
})
:column(SMWTable.textColumn({
label = "Skills",
property = "Wiki task skills",
valuesep = "<br>"
}))
:column({
label = "Assignee",
printouts = {
["Wiki task assignee"] = "#",
[""] = "=#", -- "pagename" (for links)
},
render = function(item)
local assignees = item["Wiki task assignee"]
local out = ""
if not assignees or #assignees == 0 then
return "''None - [[Special:EditPage/" .. item[1] .."|claim]]''"
elseif type(assignees) == "string" then
assignees = {assignees}
end
for _, username in ipairs(assignees) do
username = username:gsub("^User:", "")
if out ~= "" then
out = out .. "<br>"
end
out = out
.. "[[User:" .. username .. "|" .. username .. "]] "
.. "([[User talk:" .. username .. "|talk]])"
end
return out
end
})
end
return p