17,230
edits
(doesn't like a tags I guess) |
(switch to zdw selectors) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 24: | Line 24: | ||
function Box:render() | function Box:render() | ||
local root = mw.html.create( 'div' ) | local root = mw.html.create( 'div' ) | ||
:addClass( self.boxType == 'dark' and ' | :addClass( self.boxType == 'dark' and 'zdw-box--dark' or 'zdw-box' ) | ||
:addClass( self.args.class ) | :addClass( self.args.class ) | ||
Line 53: | Line 53: | ||
function Box:renderHeader() | function Box:renderHeader() | ||
local header = mw.html.create( 'div' ) | local header = mw.html.create( 'div' ) | ||
:addClass( ' | :addClass( 'zdw-box__title' ) | ||
:css( 'text-align', 'center' ) | :css( 'text-align', 'center' ) | ||
:wikitext( self.args.title ) | :wikitext( self.args.title ) | ||
Line 60: | Line 60: | ||
header:tag( 'span' ) | header:tag( 'span' ) | ||
:addClass( 'edit plainlinks' ) | :addClass( 'edit plainlinks' ) | ||
: | :wikitext( '[' .. tostring( mw.uri.fullUrl( self.args.edit, { action = 'edit' } ) ) .. ' [edit]]' ) | ||
end | end | ||
Line 69: | Line 67: | ||
end | end | ||
return | return header | ||
end | end | ||
Line 86: | Line 84: | ||
function Box:renderFooter() | function Box:renderFooter() | ||
local footer = mw.html.create( 'div' ) | local footer = mw.html.create( 'div' ) | ||
:addClass( ' | :addClass( 'zdw-box__title zdw-hlist' ) | ||
:css( 'text-align', 'center' ) | :css( 'text-align', 'center' ) | ||
Line 98: | Line 96: | ||
end | end | ||
local p, mt = | local p, mt = {}, {} | ||
p.Box = Box | |||
function p._main( boxType, args ) | function p._main( boxType, args ) | ||
local box = Box.new( boxType, args ) | local box = Box.new( boxType, args ) | ||
return box:render() | return box:render() | ||
end | end | ||