Modul:Benutzerinfo

Aus Steel Beasts Wiki

Die Dokumentation für dieses Modul kann unter Modul:Benutzerinfo/Doku erstellt werden

local Benutzerinfo = {}

local metatable = {}
local methodtable = {}

metatable.__index = methodtable

-- Extensions
local infobox = require( 'Module:InfoboxNeue' )


--- Creates the infobox
function methodtable.getInfoBox( self )
    local box = infobox:new( {
        removeEmpty = true,
    } )

    box:renderImage( self.frameArgs[ 'image' ] or self.frameArgs[ 'Bild' ] )
	box:renderHeader( {
		title = self.frameArgs[ 'Name' ],
		subtitle = self.frameArgs[ 'Beschreibung' ] or self.frameArgs[ 'Überschrift' ],
	} )

	box:renderSection( {
		title = 'Informationen',
		col = 2,
		content = {
    		box:renderItem( 'Geschlecht', self.frameArgs[ 'Geschlecht' ] ),
    		box:renderItem( 'Zugehörigkeit', self.frameArgs[ 'Zugehörigkeit' ] ),
    		box:renderItem( 'Geboren', self.frameArgs[ 'Geboren' ] ),
    		box:renderItem( 'Gestorben', self.frameArgs[ 'Gestorben' ] ),
		}
	} )

	box:renderSection( {
		title = 'Online',
		content = {
    		box:renderItem( {
    			label = self.frameArgs[ 'Website Name' ] or 'Webseite',
    			data = self.frameArgs[ 'Webseite' ],
    			--row = true,
				--spacebetween = true
			} ),
    		box:renderItem( {
    			label = 'GitHub',
    			data = self.frameArgs[ 'GitHub' ],
    			--row = true,
				--spacebetween = true
			} ),
    		box:renderItem( {
    			label = 'Discord',
    			data = self.frameArgs[ 'Discord' ],
    			--row = true,
				--spacebetween = true
			} ),
		}
	} )

	box:renderSection( {
		title = 'Fahrzeuge',
		col = 2,
		content = {
    		box:renderItem( 'Lieblings Schiff', self.frameArgs[ 'Lieblings Schiff' ] ),
    		box:renderItem( 'Lieblings Fahrzeug', self.frameArgs[ 'Lieblings Fahrzeug' ] ),
		}
	} )

	if self.frameArgs[ 'Referral Code'] ~= nil then
		box:renderFooterButton( {
			label = 'Referral Code',
			type = 'link',
			content = string.format( '[https://robertsspaceindustries.com/enlist?referral=%s %s]',  self.frameArgs[ 'Referral Code'], self.frameArgs[ 'Referral Code'] )
		} )
	end

    return tostring( box )
end


--- Set the frame and load args
--- @param frame table
function methodtable.setFrame( self, frame )
    self.currentFrame = frame
    self.frameArgs = require( 'Module:Arguments' ).getArgs( frame )
end


--- Template entry
function Benutzerinfo.main( frame )
    local instance = Benutzerinfo:new()
    instance:setFrame( frame )

    return tostring( instance:getInfoBox() )
end


--- New Instance
function Benutzerinfo.new( self )
    local instance = {}

    setmetatable( instance, metatable )

    return instance
end


return Benutzerinfo