Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:WikiProjectBanner/TaskForce
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
------------------------------------------------------------------------------- -- TaskForce class -- -- This module contains the TaskForce class used in -- -- Module:WikiProjectBanner. It is used to generate the task force rows. -- ------------------------------------------------------------------------------- -- Load necessary modules local Row = require('Module:WikiProjectBanner/Row') -- Lazily load modules we don't always need local mShared, Grade local TaskForce = setmetatable({}, Row) TaskForce.__index = TaskForce function TaskForce.new(args, bannerData, cfg, rowCfg) local obj = Row.new(args, bannerData, cfg, rowCfg) setmetatable(obj, TaskForce) -- Quality grade obj.qualityGrade = obj.bannerData.grades.quality if obj.quality and obj.qualityGrade then local qualityData = obj.qualityGrade:exportData() obj.qualityCategory = obj.qualityGrade:makeAssessmentCategory{ grade = qualityData.short, assessmentCategory = obj.rowCfg.assessmentCategory } obj.forceImportance = qualityData.forceImportance end -- Importance grade if obj.qualityGrade and obj.rowCfg.importance then local gradeCfg = {} gradeCfg.forceGrade = obj.forceImportance gradeCfg.assessmentCategory = obj.rowCfg.assessmentCategory gradeCfg.param = obj.rowCfg.importanceParams Grade = Grade or require('Module:WikiProjectBanner/Grade') obj.importanceGrade = Grade.new( 'importance', obj.args, obj.bannerData, obj.cfg, gradeCfg ) obj.importanceCategory = obj.importanceGrade:exportData().assessmentCategory end -- Image if rowCfg.image then obj:setIcon(string.format( '[[File:%s|x25px|center|alt=Task force icon]]', rowCfg.image )) end local text = '' -- Portal if rowCfg.portal then mShared = mShared or require('Module:WikiProjectBanner/shared') local portal = mShared.makePortal( rowCfg.portal, {height = '15', margin = '0'} ) text = text .. portal end -- Text if rowCfg.text then text = text .. rowCfg.text else local msg if obj.importanceGrade then msg = "This $1 is supported by '''[[$2|$3]]''' (marked as $4)." else msg = "This $1 is supported by '''[[$2|$3]]'''." end local pageType = obj.bannerData.pageType local link = rowCfg.link local name = rowCfg.name local importance if obj.importanceGrade then importance = obj.importanceGrade:exportData().full else importance = '' end mShared = mShared or require('Module:WikiProjectBanner/shared') text = text .. mShared.substituteParams( msg, pageType, link, name, importance ) end obj:setText(text) -- Categories obj:addCategory(obj.rowCfg.mainCategory) obj:addCategory(obj.qualityCategory) obj:addCategory(obj.importanceCategory) return obj end return TaskForce
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:WikiProjectBanner/TaskForce/doc
(
edit
)