No edit summary |
No edit summary |
||
Line 7: | Line 7: | ||
local LocationWidget = require('Module:Infobox/Widget/Location') | local LocationWidget = require('Module:Infobox/Widget/Location') | ||
local RowWidget = require('Module:Infobox/Widget/Row') | local RowWidget = require('Module:Infobox/Widget/Row') | ||
local cargo = mw.ext.cargo | |||
local Flags = require('Module:Flags') | local Flags = require('Module:Flags') | ||
Line 22: | Line 23: | ||
container:node(headerNode):node(Subheader.make('Team Information')) | container:node(headerNode):node(Subheader.make('Team Information')) | ||
local tables = 'Squads' | |||
local fields = '_pageName, captain, coach, manager' | |||
mw.log('!!!!!') | |||
mw.log(mw.title.getCurrentTitle().text ) | |||
local cargoArgs = { | |||
where = '_pageName = "' .. mw.title.getCurrentTitle().text .. '"' | |||
} | |||
local results = cargo.query(tables, fields, cargoArgs) | |||
mw.log('resultSTART') | |||
mw.log(results.captain) | |||
mw.logObject(results) | |||
mw.log('RESULTSEND') | |||
if args.country then | if args.country then | ||
container:node(RowWidget.make('Location', LocationWidget.make(args.country, args.city, currentTitleSplit[1] .. '/Teams'))) | container:node(RowWidget.make('Location', LocationWidget.make(args.country, args.city, currentTitleSplit[1] .. '/Teams'))) | ||
end | end | ||
if args.region then | if args.region then | ||
container:node(RowWidget.make('Region', LocationWidget.make(args.region, nil, currentTitleSplit[1] .. '/Teams'))) | container:node(RowWidget.make('Region', LocationWidget.make(args.region, nil, currentTitleSplit[1] .. '/Teams'))) | ||
end | end | ||
if args.founded then | if args.founded then | ||
container:node(RowWidget.make('Founded', args.founded)) | container:node(RowWidget.make('Founded', args.founded)) | ||
end | end | ||
if args.org then | if args.org then | ||
container:node(RowWidget.make('Organization', args.org, frame)) | container:node(RowWidget.make('Organization', args.org, frame)) | ||
end | end | ||
if args.sponsors then | if args.sponsors then | ||
container:node(RowWidget.make('Sponsors', ListWidget.make(args.sponsors))) | container:node(RowWidget.make('Sponsors', ListWidget.make(args.sponsors))) | ||
end | end | ||
if args.coach then | if args.coach then | ||
container:node(RowWidget.make('Coach', args.coach, frame)) | container:node(RowWidget.make('Coach', args.coach, frame)) | ||
end | end | ||
if args.manager then | if args.manager then | ||
container:node(RowWidget.make('Manager', args.manager, frame)) | container:node(RowWidget.make('Manager', args.manager, frame)) | ||
end | end | ||
if args.captain then | if args.captain then | ||
container:node(RowWidget.make('Captain', args.captain, frame)) | container:node(RowWidget.make('Captain', args.captain, frame)) | ||
end | end | ||
container:node(Subheader.make('Links')) | container:node(Subheader.make('Links')) |
Revision as of 23:25, 6 September 2022
Documentation for this module may be created at Module:Infobox team/doc
local getArgs = require('Module:Arguments').getArgs
local Links = require('Module:Links')
local Header = require('Module:Infobox/Widget/Header')
local Subheader = require('Module:Infobox/Widget/Subheader')
local LinksWidget = require('Module:Infobox/Widget/Links')
local ListWidget = require('Module:Infobox/Widget/List')
local LocationWidget = require('Module:Infobox/Widget/Location')
local RowWidget = require('Module:Infobox/Widget/Row')
local cargo = mw.ext.cargo
local Flags = require('Module:Flags')
local Infobox = {}
function Infobox.main(frame)
local args = getArgs(frame)
local currentTitleSplit = mw.text.split(mw.title.getCurrentTitle().text, '/')
local headerNode = Header.make(args.title or currentTitleSplit[2], args.image or '')
local container = mw.html.create('div')
:addClass('ib')
container:node(headerNode):node(Subheader.make('Team Information'))
local tables = 'Squads'
local fields = '_pageName, captain, coach, manager'
mw.log('!!!!!')
mw.log(mw.title.getCurrentTitle().text )
local cargoArgs = {
where = '_pageName = "' .. mw.title.getCurrentTitle().text .. '"'
}
local results = cargo.query(tables, fields, cargoArgs)
mw.log('resultSTART')
mw.log(results.captain)
mw.logObject(results)
mw.log('RESULTSEND')
if args.country then
container:node(RowWidget.make('Location', LocationWidget.make(args.country, args.city, currentTitleSplit[1] .. '/Teams')))
end
if args.region then
container:node(RowWidget.make('Region', LocationWidget.make(args.region, nil, currentTitleSplit[1] .. '/Teams')))
end
if args.founded then
container:node(RowWidget.make('Founded', args.founded))
end
if args.org then
container:node(RowWidget.make('Organization', args.org, frame))
end
if args.sponsors then
container:node(RowWidget.make('Sponsors', ListWidget.make(args.sponsors)))
end
if args.coach then
container:node(RowWidget.make('Coach', args.coach, frame))
end
if args.manager then
container:node(RowWidget.make('Manager', args.manager, frame))
end
if args.captain then
container:node(RowWidget.make('Captain', args.captain, frame))
end
container:node(Subheader.make('Links'))
local transformedLinks = Links.transform(args)
local fullLinks = LinksWidget.make(transformedLinks, 'team')
container:node(fullLinks)
return container
end
return Infobox