Module:ReportHeader: Difference between revisions

From Accountable Brands
No edit summary
No edit summary
 
(7 intermediate revisions by the same user not shown)
Line 11: Line 11:
title = frame.args.title,
title = frame.args.title,
headerStyle = headerStyle,  
headerStyle = headerStyle,  
bodyClass = 'report-page-infobox'
} )
} )
    --:addImage( '[[File:'..args.cover..'|200px]]', args.coverCaption, 'report-md-cover-div' )
if args.type and args.type ~= '' then
if args.type and args.type ~= '' then
if args.type ~= 'Human Rights Abuse' and args.type ~= 'Anti-Consumer Tactics' and args.type ~= 'Political Profits'
if args.type ~= 'Human Rights Abuse' and args.type ~= 'Anti-Consumer Tactics' and args.type ~= 'Political Profits'
then retval:addRow( 'Invalid report category. Click on this box, then \'Edit\' to categorize this report.' )
then retval:addRow( 'Invalid report category. <!-- Click on this box, then \'Edit\' to categorize this report. --> [[Category:Uncategorized Reports]]', '', 'report-unfinished' )
else
else
retval:addRow( 'Type', args.type, 'report-md-type-div' ) end
retval:addRow( 'Type', args.type..'[[Category:Report]]', 'report-md-type-div' ) end
else
else
retval:addRow( 'Click on this box, then \'Edit\' to categorize this report.' ) end
retval:addRow( '<!-- Click on this box, then \'Edit\' to categorize this report. --> [[Category:Uncategorized Reports]]', '', 'report-unfinished' ) end
if args.timeframe and args.timeframe ~= '' then
if args.timeframe and args.timeframe ~= '' then
     retval:addRow( 'Date(s)', args.timeframe, 'brand-md-timeframe-div' )
     retval:addRow( 'Date(s)', args.timeframe, 'brand-md-timeframe-div' )

Latest revision as of 20:10, 6 February 2024

Documentation for this module may be created at Module:ReportHeader/doc

local capiunto = require 'capiunto'

local p = {}

function p.main(frame)
	local args = frame:getParent().args
	local headerStyle
	headerStyle = 'background-color:grey;'

	local retval = capiunto.create( {
		title = frame.args.title,
		headerStyle = headerStyle, 
		bodyClass = 'report-page-infobox'
	} )
	if args.type and args.type ~= '' then
		if args.type ~= 'Human Rights Abuse' and args.type ~= 'Anti-Consumer Tactics' and args.type ~= 'Political Profits'
			then retval:addRow( 'Invalid report category. <!-- Click on this box, then \'Edit\' to categorize this report.  --> [[Category:Uncategorized Reports]]', '', 'report-unfinished' )
		else
			retval:addRow( 'Type', args.type..'[[Category:Report]]', 'report-md-type-div' ) end
	else
		retval:addRow( '<!-- Click on this box, then \'Edit\' to categorize this report. --> [[Category:Uncategorized Reports]]', '', 'report-unfinished' ) end
	if args.timeframe and args.timeframe ~= '' then
    	retval:addRow( 'Date(s)', args.timeframe, 'brand-md-timeframe-div' )
    end
	return retval
end

return p