Skip to content

Commit

Permalink
feat(squad): remove title row in most situations (#3349)
Browse files Browse the repository at this point in the history
* Update squad.lua

Removing title row from most tables as they almost always live under section headings with a synonymous name.

* Update components/squad/commons/squad.lua

* white space

* Update squad.lua

---------

Co-authored-by: hjpalpha <[email protected]>
  • Loading branch information
salle and hjpalpha authored Jan 10, 2024
1 parent 15bf295 commit 2199c3e
Showing 1 changed file with 18 additions and 19 deletions.
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

0 comments on commit 2199c3e

Please sign in to comment.