Template:Hansard-mp-record-month: Difference between revisions

From PoliticalSG
(Created page with "<includeonly><div class="mw-collapsible mw-collapsed" style="margin:0.2em 0 0.2em 1.5em;border:1px solid #c8ccd1;"><div style="background:#eaecf0;padding:0.25em 0.6em;font-weight:bold;">{{{MonthLabel|{{{YearMonth|}}}}}}</div><div class="mw-collapsible-content">{{#cargo_query:tables=hansard_items,hansard_sittings|join on=hansard_items.sitting_id=hansard_sittings.sitting_id|fields=hansard_items.sitting_date=Date,hansard_items.item_type=Type,hansard_items.subject=Subject,CO...")
 
No edit summary
Line 1: Line 1:
<includeonly><div class="mw-collapsible mw-collapsed" style="margin:0.2em 0 0.2em 1.5em;border:1px solid #c8ccd1;"><div style="background:#eaecf0;padding:0.25em 0.6em;font-weight:bold;">{{{MonthLabel|{{{YearMonth|}}}}}}</div><div class="mw-collapsible-content">{{#cargo_query:tables=hansard_items,hansard_sittings|join on=hansard_items.sitting_id=hansard_sittings.sitting_id|fields=hansard_items.sitting_date=Date,hansard_items.item_type=Type,hansard_items.subject=Subject,CONCAT("[[",hansard_items._pageName,"#",hansard_items.item_id,"|→]]")=Link|where=(hansard_items.asking_mp_id="{{{MPId|}}}" OR hansard_items.speaker_mp_id="{{{MPId|}}}") AND DATE_FORMAT(hansard_items.sitting_date,"%Y-%m")="{{{YearMonth|}}}"|order by=hansard_items.sitting_date|format=dynamictable}}</div></div></includeonly><noinclude>
<includeonly><div class="mw-collapsible mw-collapsed" style="margin:0.2em 0 0.2em 1.5em;border:1px solid #c8ccd1;clear:both;"><div class="mw-collapsible-toggle" style="display:block;float:none;clear:both;cursor:pointer;background:#eaecf0;padding:0.25em 0.6em;font-weight:bold;">{{{MonthLabel|{{{YearMonth|}}}}}}</div><div class="mw-collapsible-content" style="clear:both;">{{#cargo_query:tables=hansard_items,hansard_sittings|join on=hansard_items.sitting_id=hansard_sittings.sitting_id|fields=hansard_items.sitting_date=Date,hansard_items.item_type=Type,hansard_items.subject=Subject,CONCAT("[[",hansard_items._pageName,"#",hansard_items.item_id,"|→]]")=Link|where=(hansard_items.asking_mp_id="{{{MPId|}}}" OR hansard_items.speaker_mp_id="{{{MPId|}}}") AND DATE_FORMAT(hansard_items.sitting_date,"%Y-%m")="{{{YearMonth|}}}"|order by=hansard_items.sitting_date|format=dynamictable}}</div></div></includeonly><noinclude>
== Usage ==
 
Not called directly. Invoked automatically by the outer month-grouping {{tl|Hansard-item-cargo}} query on each MP's Parliamentary Record section, via <code>format=template|template=Hansard-mp-record-month|named args=yes</code>. One call is generated per distinct month that has data for that MP.
 
== Parameters ==
 
{| class="wikitable"
! Parameter !! Source !! Notes
|-
| YearMonth || DATE_FORMAT(sitting_date,"%Y-%m") from the outer query || e.g. 2026-07. Used to filter the inner query and as fallback heading text.
|-
| MonthLabel || DATE_FORMAT(sitting_date,"%M %Y") from the outer query || e.g. July 2026. Human-readable heading, preferred over YearMonth when present.
|-
| MPId || Literal string passed by the outer query (e.g. "cai-yinzhou"=MPId) || Must match the mp_id used in the outer query's WHERE clause.
|}
 
Renders a collapsed accordion, one per month, each containing its own sortable {{tl|Hansard-item-cargo}}-sourced table for that MP in that month.
 
[[Category:Cargo templates]]
[[Category:Cargo templates]]
[[Category:Hansard templates]]
[[Category:Hansard templates]]
</noinclude>
</noinclude>

Revision as of 18:47, 15 July 2026