Module:Metrics dashboard: Difference between revisions
Appearance
Content deleted Content added
trying to link to the user page instead of using a template |
footer and last-updated one on top of the other |
||
Line 19: | Line 19: | ||
end |
end |
||
output = output .. '<div class="metrics-dashboard-footer" style="font-size: smaller; padding-top: 2em; padding-bottom: 1.5em;">' |
|||
if args['footer'] then |
|||
output = output .. '<div class="footer-content">' .. args['footer'] .. '</div>' |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
else |
else |
||
output = output .. '< |
output = output .. '<div class="last-updated-content"> Last updated: ' .. args['last-updated'] .. '</div>' |
||
end |
end |
||
end |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
else |
|||
output = output .. '<span style="text-align: right; font-style: italic;"> Last updated: ' .. args['last-updated'] .. '</span>' |
|||
end |
|||
⚫ | |||
⚫ | |||
return output |
return output |
Revision as of 17:21, 11 May 2023
![]() | This module is rated as beta, and is ready for widespread use. It is still new and should be used with some caution to ensure the results are as expected. |
Usage
{{#invoke:Metrics dashboard|function_name}}
Provides functionality to Template:Metrics dashboard.
Input
See Template:Metrics dashboard/doc#Usage
Output
A formatted string representing the metrics dashboard with the provided key figures, labels, footer, and last-updated timestamp.
local p = {}
local function listItem(value, label)
return string.format('* <span class="md-value">%s</span><span class="md-label">%s</span>', value, label)
end
function p.list(frame)
local output = ''
local i = 1
local args = frame:getParent().args
while args['figure' .. i .. '-value'] and args['figure' .. i .. '-label'] do
local value = args['figure' .. i .. '-value']
local label = args['figure' .. i .. '-label']
output = output .. listItem(value, label) .. '\n'
i = i + 1
end
output = output .. '<div class="metrics-dashboard-footer" style="font-size: smaller; padding-top: 2em; padding-bottom: 1.5em;">'
if args['footer'] then
output = output .. '<div class="footer-content">' .. args['footer'] .. '</div>'
end
if args['last-updated'] then
if args['bot'] then
local user_link = frame:preprocess('[[User:' .. args['bot'] .. '|' .. args['bot'] .. ']]')
output = output .. '<div class="last-updated-content"> Last updated by 🤖 ' .. user_link .. ' on ' .. args['last-updated'] .. '</div>'
else
output = output .. '<div class="last-updated-content"> Last updated: ' .. args['last-updated'] .. '</div>'
end
end
output = output .. '</div>'
return output
end
return p