Module:Infobox company: Difference between revisions

From TwogPedia
No edit summary
No edit summary
Line 19: Line 19:
if args.logos then
if args.logos then
mw.log('olen siiin')
mw.log(VariablesLua.var('logoLight', nil))
mw.log(VariablesLua.var('logoDark', nil))
mw.log(VariablesLua.var('logoAll', nil))
headerNode = Header.make(args.title or mw.title.getCurrentTitle().text, VariablesLua.var('logoLight', nil), VariablesLua.var('logoDark', nil), VariablesLua.var('logoAll', nil))
headerNode = Header.make(args.title or mw.title.getCurrentTitle().text, VariablesLua.var('logoLight', nil), VariablesLua.var('logoDark', nil), VariablesLua.var('logoAll', nil))
mw.log(headerNode)
elseif args.logoAll or args.logoLight or args.logoDark then
elseif args.logoAll or args.logoLight or args.logoDark then
headerNode = Header.make(args.title or mw.title.getCurrentTitle().text, args.logoLight, args.logoDark, args.logoAll)
headerNode = Header.make(args.title or mw.title.getCurrentTitle().text, args.logoLight, args.logoDark, args.logoAll)

Revision as of 19:17, 5 May 2023

Documentation for this module may be created at Module:Infobox company/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 SponsorsWidget = require('Module:Infobox/Widget/Sponsors')
local LocationWidget = require('Module:Infobox/Widget/Location')
local RowWidget = require('Module:Infobox/Widget/Row')

VariablesLua = mw.ext.VariablesLua

local Flags = require('Module:Flags')
local Infobox = {}

function Infobox.main(frame)
	local args = getArgs(frame)
	local headerNode
	
	if args.logos then
		mw.log('olen siiin')
		mw.log(VariablesLua.var('logoLight', nil))
		mw.log(VariablesLua.var('logoDark', nil))
		mw.log(VariablesLua.var('logoAll', nil))
		headerNode = Header.make(args.title or mw.title.getCurrentTitle().text, VariablesLua.var('logoLight', nil), VariablesLua.var('logoDark', nil), VariablesLua.var('logoAll', nil))
		mw.log(headerNode)
	elseif args.logoAll or args.logoLight or args.logoDark then
		 headerNode = Header.make(args.title or mw.title.getCurrentTitle().text, args.logoLight, args.logoDark, args.logoAll)
	end
	
	local container = mw.html.create('div')
		:addClass('ib')
		
	container:node(headerNode):node(Subheader.make('Company Information'))
	
	if args.country then
		container:node(RowWidget.make('Headquarter', LocationWidget.make(args.country, args.city, 'Companies')))
	end
	
	if args.founded then
		container:node(RowWidget.make('Founded', args.founded))
	end
	
	if args.employees then 
		container:node(RowWidget.make('Employees', args.employees))
	end
	
	if args.sponsors then
		container:node(RowWidget.make('Sponsors', args.sponsors))
	end
	
	if args.type then
		container:node(RowWidget.make('Type', args.type))
	end
	
	if args.parentcompany then
		container:node(RowWidget.make('Parent company', args.parentcompany, frame))
	end
	
	if args.subsidiaries then
		container:node(RowWidget.make('Subsidiaries', ListWidget.make(args.subsidiaries)))
	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