Module:PagedGallery
Jump to navigation
Jump to search
Want an adless experience? Log in or Create an account.
Documentation for this module may be created at Module:PagedGallery/doc
local Args = require( 'Module:Args' ) local Box = require( 'Module:Box' ).Box local PagedGallery = Box.new() PagedGallery.__index = PagedGallery setmetatable( PagedGallery, Box ) function PagedGallery.new( args ) args.class = 'zdw-paged-gallery' local obj = Box.new( 'light', args ) return setmetatable( obj, PagedGallery ) end function addButton( nav, kind, text ) nav:tag( 'div' ) :addClass( 'zdw-button zdw-button--paging' ) :attr( 'data-nav', kind ) :wikitext( text ) end -- override Box:renderContent function PagedGallery:renderContent() local content = mw.html.create( 'div' ); local nav = content:tag( 'div' ) :addClass( 'zdw-paged-gallery__navigation' ) addButton( nav, 'first', '<< First' ) addButton( nav, 'prev', '< Previous' ) addButton( nav, 'next', 'Next >' ) addButton( nav, 'last', 'Last >>' ) -- TODO pages return content end local p = {} function p.main( frame ) local gallery = PagedGallery.new( Args.fromFrame( frame ) ) return gallery:render() end -- for use in the debug console: -- =p.main(p.debugframe) p.debugframe = { args = {}, getParent = function() return { args = { } } end } return p