Welcome to the Umamusume Wiki! If you want to contribute, please read the guidelines.

Module:Albums

From Umamusume Wiki
Jump to navigation Jump to search

Documentation for this module may be created at Module:Albums/doc

local p = {}
local cargo = mw.ext.cargo

function p.list(frame)
	local query = {
		limit = '1000',
		orderBy = 'Albums.release_date ASC',
	}
	if (frame.args[1]) then
		query['where'] = 'Albums.type = "'.. frame.args[1]  ..'"'
	end
	local fields = {'_pageName','title','cover'}
	local albums = cargo.query('Albums', table.concat(fields, ','), query)
	
	local root = mw.html.create('div'):cssText('display:flex; flex-flow:row wrap; gap: 10px;')
	for _, al in ipairs(albums) do
		if al.cover then
			root:wikitext('[[Image:' .. al.cover .. '|180px|link=' .. al._pageName .. ']]')
		end
	end
	return root
end

return p