Documentation for this module may be created at Module:LocationsSearch/doc
local getArgs = require('Module:Arguments').getArgs
local cargo = mw.ext.cargo
local p = {}
function p.main(frame)
local args = getArgs(frame)
local tables = 'Locations, _pageData, Logos'
local fields = 'Locations._pageName=_pageName, Logos.logoAll=logoAll, Logos.logoLight=logoLight, Logos.logoDark=logoDark'
local cargoArgs = {
join = 'Locations._pageName = _pageData._pageName, Locations._pageName=Logos._pageName',
limit = 20,
orderBy = "_pageData._modificationDate DESC",
}
local results = cargo.query(tables, fields, cargoArgs)
local container = mw.html.create('div'):addClass('locations__list')
if #results > 0 then
for i = 1, #results do
local result = results[i]
local img = result.logoAll or result.logoLight or result.logoDark or 'Team_placeholder_light.png'
local title = mw.html.create('div'):addClass('news-title'):wikitext(mw.ext.displaytitle.get(result._pageName))
local newsItem = mw.html.create('div'):addClass('news-item'):wikitext('[[File:'.. img .. '|link=' .. result._pageName .. ']]'):node(title)
container:node(newsItem)
end
return container
end
end
return p