Module:Listbox: Difference between revisions

Want an adless experience? Log in or Create an account.
m
change label class to zdw-label to distinguish from bootstrap
(remove {{Main}} regex since it is always expanded now)
m (change label class to zdw-label to distinguish from bootstrap)
 
(12 intermediate revisions by the same user not shown)
Line 26: Line 26:
-- override
-- override
function Listbox:renderContent()
function Listbox:renderContent()
   local listing = Listing._parseListing( (self.categories[1] == 'The Legend of Zelda' or self.categories[1] == 'The Adventure of Link' or self.categories[1] == 'A Link to the Past' or self.categories[1] == 'Link\'s Awakening') and self.subject .. '/Staging' or self.subject )
   local listing = Listing._parseListing( self.subject )
 
  -- If categories weren't set already (because caller used single arg), then use the ones parsed from the page.
  -- CODE SMELL: setting unrelated state. this only works because renderFooter is called after renderContent.
  if #self.categories == 0 then self.categories = listing.categories end


   local content = mw.html.create( 'table' )
   local content = mw.html.create( 'table' )
Line 41: Line 45:
       local row = content:tag( 'tr' )
       local row = content:tag( 'tr' )
       row:tag( 'th' )
       row:tag( 'th' )
         :addClass( 'label' )
         :addClass( 'zdw-label' )
         :wikitext( group.name )
         :wikitext( group.name )
       local cell = row:tag( 'td' )
       local cell = row:tag( 'td' )
Line 65: Line 69:
   getParent = function() return {
   getParent = function() return {
     args = {
     args = {
       [1] = "The Legend of Zelda",
       [1] = "The Legend of Zelda Locations"
      [2] = "Locations"
     }
     }
   } end
   } end