Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update squad.lua #3349

Merged
merged 5 commits into from
Jan 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 18 additions & 19 deletions components/squad/commons/squad.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

local Class = require('Module:Class')
local Arguments = require('Module:Arguments')
local Logic = require('Module:Logic')
local String = require('Module:StringUtils')

local Squad = Class.new()
Expand Down Expand Up @@ -49,31 +50,29 @@ end

function Squad:title()
local defaultTitle
if self.type == Squad.TYPE_FORMER then
defaultTitle = 'Former Squad'
elseif self.type == Squad.TYPE_INACTIVE then
defaultTitle = 'Inactive Squad'
else
defaultTitle = 'Active Squad'
if self.type == Squad.TYPE_INACTIVE then
defaultTitle = 'Inactive Players'
end

local titleText = String.isEmpty(self.args.title) and defaultTitle or self.args.title
local titleText = Logic.emptyOr(self.args.title, defaultTitle)

local titleContainer = mw.html.create('tr')
if String.isNotEmpty(titleText) then
local titleContainer = mw.html.create('tr')

local titleRow = mw.html.create('th')
titleRow:addClass('large-only')
:attr('colspan', '1')
:wikitext(titleText)
local titleRow = mw.html.create('th')
titleRow:addClass('large-only')
:attr('colspan', '1')
:wikitext(titleText)

local titleRow2 = mw.html.create('th')
titleRow2:addClass('large-only')
:attr('colspan', '10')
:addClass('roster-title-row2-border')
:wikitext(titleText)
local titleRow2 = mw.html.create('th')
titleRow2:addClass('large-only')
:attr('colspan', '10')
:addClass('roster-title-row2-border')
:wikitext(titleText)

titleContainer:node(titleRow):node(titleRow2)
self.content:node(titleContainer)
titleContainer:node(titleRow):node(titleRow2)
self.content:node(titleContainer)
end

return self
end
Expand Down
Loading