Module:PlayerTeamHistoryPopup

From Leaguepedia | League of Legends Esports Wiki
Jump to: navigation, search

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

local util_args = require('Module:ArgsUtil')
local util_cargo = require("Module:CargoUtil")
local util_esports = require("Module:EsportsUtil")
local util_html = require("Module:HtmlUtil")
local util_map = require("Module:MapUtil")
local util_math = require("Module:MathUtil")
local util_news = require("Module:NewsUtil")
local util_source = require("Module:SourceUtil")
local util_table = require("Module:TableUtil")
local util_text = require("Module:TextUtil")
local util_time = require("Module:TimeUtil")
local util_timedelta = require("Module:TimedeltaUtil")
local util_vars = require("Module:VarsUtil")
local i18n = require('Module:i18nUtil')
local lang = mw.getLanguage('en')

local m_team = require('Module:Team')
local m_region = require('Module:Region')
local m_role = require('Module:Role')

local PTHD = require('Module:PlayerTeamHistoryAbstract'):extends()

PTHD.COLUMNS = {
	'RegionDisplay', 'TeamDisplay', 'RoleDisplay', 'DateJoinDisplay', 'DateLeaveDisplay',
	classes = {
		RoleDisplay = 'player-team-history-role',
	},
	colclasses = {
		RoleDisplay = 'unsortable',
		RegionDisplay = 'unsortable',
		StatusDisplay = 'unsortable',
	},
	sorttypes = { DateJoinPretty = 'number', DateLeave = 'number', DurationDisplay = 'number' }
}

PTHD.PRELOADS_TO_IGNORE = util_table.mergeArrays(
	PTHD.PRELOADS_TO_IGNORE,
	{ 'confirm_role_swap', 'gcd_to_sub', 'loan_end_and_join', 'role_swap', 'sub_to_trainee', 'to_active', 'to_inactive', 'to_main_also_stay', 'to_starting', 'to_sub', 'to_trainee', 'loan_return', 'loaned_to', }
)

local h = {}

local p = {}
function p.main(frame)
	local args = util_args.merge()
	return PTHD:init(args, 'PlayerTeamHistory')
end

function PTHD:getTeamDisplay(row)
	return row.Team and m_team.rightshortlinked(row.Team)
end

function PTHD:getDateDisplay(row, when)
	local date = (row['Date_Display' .. when] or row['Date' .. when])
	if not date then
		return nil
	end
	return util_news.formatDateApproxForTableDisplay(date, when)
end

function PTHD:getKey(row)
	return row.Team
end

return p