Template:ProjectCard: Difference between revisions
More actions
No edit summary |
Add <templatedata> for Visual Editor Usage. |
||
| Line 1: | Line 1: | ||
<templatestyles src="ProjectCard/styles.css"/><div class="project-card-wrap" data-name="{{lc:{{{name|}}}}}" data-status="{{lc:{{{status|}}}}}" data-license="{{lc:{{{license|}}}}}" data-tags="{{lc:{{{tags|}}}}}" data-creator="{{lc:{{{creator|}}}}}" data-extra="{{lc:{{{field1label|}}} {{{field1value|}}} {{{field2label|}}} {{{field2value|}}} {{{field3label|}}} {{{field3value|}}} {{{field4label|}}} {{{field4value|}}}}}" data-page="{{urlencode:{{{pagename|}}}|PATH}}"><div class="project-card"><div class="project-card-image">{{#if:{{{image|}}}|[[File:{{{image}}}|300px|link=]]|<div class="project-card-image-fallback">[[File:places-folder.png|48px|link=]]</div>}}</div><div class="project-card-body"><div class="project-card-title">[[{{{pagename|}}}|{{{name|Project}}}]]</div><div class="project-card-badges">{{#if:{{{status|}}}|<span class="project-badge-status project-badge-status--{{lc:{{{status|active}}}}}">{{ucfirst:{{{status|Active}}}}}</span>|}}{{#if:{{{license|}}}|<span class="project-badge-license">{{{license}}}</span>|}}</div><div class="project-card-creator">{{#if:{{{creator|}}}|<span class="project-card-label">By</span> {{{creator}}}|}}</div>{{#if:{{{field1label|}}}|<div class="project-card-extra">{{{field1label}}}: <strong>{{{field1value|}}}</strong></div>|}}{{#if:{{{field2label|}}}|<div class="project-card-extra">{{{field2label}}}: <strong>{{{field2value|}}}</strong></div>|}}{{#if:{{{field3label|}}}|<div class="project-card-extra">{{{field3label}}}: <strong>{{{field3value|}}}</strong></div>|}}{{#if:{{{field4label|}}}|<div class="project-card-extra">{{{field4label}}}: <strong>{{{field4value|}}}</strong></div>|}}{{#if:{{{tags|}}}|<div class="project-card-tags" data-tags="{{{tags|}}}"></div>|}}<div class="project-card-footer"><span class="project-card-meta-item project-card-contributors" data-page="{{{pagename|}}}">—</span><span class="project-card-meta-item project-card-updated" data-page="{{{pagename|}}}">—</span></div></div><div class="project-card-description">{{{description|}}}</div></div></div><noinclude> | <templatestyles src="ProjectCard/styles.css"/><div class="project-card-wrap" data-name="{{lc:{{{name|}}}}}" data-status="{{lc:{{{status|}}}}}" data-license="{{lc:{{{license|}}}}}" data-tags="{{lc:{{{tags|}}}}}" data-creator="{{lc:{{{creator|}}}}}" data-extra="{{lc:{{{field1label|}}} {{{field1value|}}} {{{field2label|}}} {{{field2value|}}} {{{field3label|}}} {{{field3value|}}} {{{field4label|}}} {{{field4value|}}}}}" data-page="{{urlencode:{{{pagename|}}}|PATH}}"><div class="project-card"><div class="project-card-image">{{#if:{{{image|}}}|[[File:{{{image}}}|300px|link=]]|<div class="project-card-image-fallback">[[File:places-folder.png|48px|link=]]</div>}}</div><div class="project-card-body"><div class="project-card-title">[[{{{pagename|}}}|{{{name|Project}}}]]</div><div class="project-card-badges">{{#if:{{{status|}}}|<span class="project-badge-status project-badge-status--{{lc:{{{status|active}}}}}">{{ucfirst:{{{status|Active}}}}}</span>|}}{{#if:{{{license|}}}|<span class="project-badge-license">{{{license}}}</span>|}}</div><div class="project-card-creator">{{#if:{{{creator|}}}|<span class="project-card-label">By</span> {{{creator}}}|}}</div>{{#if:{{{field1label|}}}|<div class="project-card-extra">{{{field1label}}}: <strong>{{{field1value|}}}</strong></div>|}}{{#if:{{{field2label|}}}|<div class="project-card-extra">{{{field2label}}}: <strong>{{{field2value|}}}</strong></div>|}}{{#if:{{{field3label|}}}|<div class="project-card-extra">{{{field3label}}}: <strong>{{{field3value|}}}</strong></div>|}}{{#if:{{{field4label|}}}|<div class="project-card-extra">{{{field4label}}}: <strong>{{{field4value|}}}</strong></div>|}}{{#if:{{{tags|}}}|<div class="project-card-tags" data-tags="{{{tags|}}}"></div>|}}<div class="project-card-footer"><span class="project-card-meta-item project-card-contributors" data-page="{{{pagename|}}}">—</span><span class="project-card-meta-item project-card-updated" data-page="{{{pagename|}}}">—</span></div></div><div class="project-card-description">{{{description|}}}</div></div></div><noinclude> | ||
== ProjectCard == | == ProjectCard == | ||
Displays a visual project card used on hub pages. Shows a cover image, project name, status/license badges, creator, optional custom fields, tags, and a hover description overlay. Contributor count and last-edited date are populated by [[MediaWiki:Gadget-projects.js]] | Displays a visual project card used on hub pages. Shows a cover image, project name, status/license badges, creator, optional custom fields, tags, and a hover description overlay. Contributor count and last-edited date are populated by [[MediaWiki:Gadget-projects.js]]. | ||
Styles are loaded from [[Template:ProjectCard/styles.css]]. | Styles are loaded from [[Template:ProjectCard/styles.css]]. | ||
| Line 25: | Line 25: | ||
=== Parameters (passed by Cargo via named args=yes) === | === Parameters (passed by Cargo via named args=yes) === | ||
; <code>pagename</code> : Full page name (aliased from <code>_pageName</code> | ; <code>pagename</code> : Full page name (aliased from <code>_pageName</code>). Used for the card title link and gadget API calls. | ||
; <code>name</code> : Project display name. | ; <code>name</code> : Project display name. | ||
; <code>status</code> : Project status. | ; <code>status</code> : Project status. Values: <code>Active</code>, <code>Hiatus</code>, <code>Completed</code>, <code>Abandoned</code>. | ||
; <code>license</code> : License name shown as a badge (e.g. <code>CC-BY-SA 4.0</code>). | ; <code>license</code> : License name shown as a badge (e.g. <code>CC-BY-SA 4.0</code>). | ||
; <code>creator</code> : Creator or team name. | ; <code>creator</code> : Creator or team name. | ||
; <code>description</code> : Short description shown in the hover overlay. | ; <code>description</code> : Short description shown in the hover overlay. | ||
; <code>image</code> : Cover image filename (e.g. <code>MyProject.png</code>). | ; <code>image</code> : Cover image filename (e.g. <code>MyProject.png</code>). | ||
; <code>tags</code> : Space-separated tag string | ; <code>tags</code> : Space-separated tag string. | ||
; <code>field1label</code> – <code>field4label</code> : Optional custom field labels. | ; <code>field1label</code> – <code>field4label</code> : Optional custom field labels. | ||
; <code>field1value</code> – <code>field4value</code> : Optional custom field values. | ; <code>field1value</code> – <code>field4value</code> : Optional custom field values. | ||
<templatedata> | |||
{ | |||
"description": "Displays a visual project card. Normally called automatically by Cargo on hub pages — see Template:ProjectInfobox for submitting projects.", | |||
"params": { | |||
"pagename": { | |||
"label": "Page name", | |||
"description": "Full wiki page name of the project. Used for the card title link.", | |||
"type": "wiki-page-name", | |||
"required": true | |||
}, | |||
"name": { | |||
"label": "Project name", | |||
"description": "Display name shown on the card.", | |||
"type": "string", | |||
"required": false | |||
}, | |||
"status": { | |||
"label": "Status", | |||
"description": "Current project status. Affects badge colour.", | |||
"type": "string", | |||
"suggestedvalues": ["Active", "Hiatus", "Completed", "Abandoned"], | |||
"required": false | |||
}, | |||
"license": { | |||
"label": "License", | |||
"description": "License name shown as a badge (e.g. CC-BY-SA 4.0).", | |||
"type": "string", | |||
"required": false | |||
}, | |||
"creator": { | |||
"label": "Creator", | |||
"description": "Creator or team name.", | |||
"type": "string", | |||
"required": false | |||
}, | |||
"description": { | |||
"label": "Description", | |||
"description": "Short description shown in the hover overlay. Keep to 1-2 sentences.", | |||
"type": "content", | |||
"required": false | |||
}, | |||
"image": { | |||
"label": "Cover image", | |||
"description": "Cover image filename without File: prefix (e.g. MyProject.png).", | |||
"type": "wiki-file-name", | |||
"required": false | |||
}, | |||
"tags": { | |||
"label": "Tags", | |||
"description": "Space-separated keywords used for hub filtering.", | |||
"type": "string", | |||
"required": false | |||
}, | |||
"field1label": { "label": "Custom field 1 label", "type": "string", "required": false }, | |||
"field1value": { "label": "Custom field 1 value", "type": "string", "required": false }, | |||
"field2label": { "label": "Custom field 2 label", "type": "string", "required": false }, | |||
"field2value": { "label": "Custom field 2 value", "type": "string", "required": false }, | |||
"field3label": { "label": "Custom field 3 label", "type": "string", "required": false }, | |||
"field3value": { "label": "Custom field 3 value", "type": "string", "required": false }, | |||
"field4label": { "label": "Custom field 4 label", "type": "string", "required": false }, | |||
"field4value": { "label": "Custom field 4 value", "type": "string", "required": false } | |||
}, | |||
"format": "block" | |||
} | |||
</templatedata> | |||
[[Category:Layout Templates]] | [[Category:Layout Templates]] | ||
</noinclude> | </noinclude> | ||
Revision as of 08:28, 23 March 2026
ProjectCard
Displays a visual project card used on hub pages. Shows a cover image, project name, status/license badges, creator, optional custom fields, tags, and a hover description overlay. Contributor count and last-edited date are populated by MediaWiki:Gadget-projects.js.
Styles are loaded from Template:ProjectCard/styles.css.
⚠️ This template is called automatically by Cargo via #cargo_query on hub pages. You should not need to call it manually. See Template:ProjectInfobox for how projects are submitted to the database.
Called by Cargo — example query
{{#cargo_query:
tables = Projects
| fields = _pageName=pagename, name, categories, status, license, creator,
description, image, tags, field1label, field1value,
field2label, field2value, field3label, field3value, field4label, field4value
| where = categories HOLDS 'Audio'
| order by = Projects._pageName
| limit = 500
| format = template
| template = ProjectCard
| named args = yes
| no results text = <div class="project-hub-empty">No projects yet.</div>
}}
Parameters (passed by Cargo via named args=yes)
pagename- Full page name (aliased from
_pageName). Used for the card title link and gadget API calls. name- Project display name.
status- Project status. Values:
Active,Hiatus,Completed,Abandoned. license- License name shown as a badge (e.g.
CC-BY-SA 4.0). creator- Creator or team name.
description- Short description shown in the hover overlay.
image- Cover image filename (e.g.
MyProject.png). tags- Space-separated tag string.
field1label–field4label- Optional custom field labels.
field1value–field4value- Optional custom field values.
Displays a visual project card. Normally called automatically by Cargo on hub pages — see Template:ProjectInfobox for submitting projects.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Page name | pagename | Full wiki page name of the project. Used for the card title link. | Page name | required |
| Project name | name | Display name shown on the card. | String | optional |
| Status | status | Current project status. Affects badge colour.
| String | optional |
| License | license | License name shown as a badge (e.g. CC-BY-SA 4.0). | String | optional |
| Creator | creator | Creator or team name. | String | optional |
| Description | description | Short description shown in the hover overlay. Keep to 1-2 sentences. | Content | optional |
| Cover image | image | Cover image filename without File: prefix (e.g. MyProject.png). | File | optional |
| Tags | tags | Space-separated keywords used for hub filtering. | String | optional |
| Custom field 1 label | field1label | no description | String | optional |
| Custom field 1 value | field1value | no description | String | optional |
| Custom field 2 label | field2label | no description | String | optional |
| Custom field 2 value | field2value | no description | String | optional |
| Custom field 3 label | field3label | no description | String | optional |
| Custom field 3 value | field3value | no description | String | optional |
| Custom field 4 label | field4label | no description | String | optional |
| Custom field 4 value | field4value | no description | String | optional |