Template:Topic: Difference between revisions

From Discourse DB
Jump to navigation Jump to search
(Added "Has number of opinion items" property)
No edit summary
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>This template holds information on a political topic; it should be called with the following structure:
<noinclude>This template holds information on a political topic. It should be called in the following format:
<pre>{{source
<pre>
|start date=The date at which the topic started, if there was one
{{Topic
|end date=The date at which the topic ended, if there was one
|Start date=The date at which the topic started, if there was one
|themes=The theme(s) of this topic, separated by commas if there's more than one
|End date=The date at which the topic ended, if there was one
|Themes=The theme(s) of this topic, separated by commas if there's more than one
}}
}}
</pre>
</pre>
Line 9: Line 10:


The order of the fields is not relevant.
The order of the fields is not relevant.
</noinclude><includeonly>
{{#cargo_declare:_table=Topics|Start_date=Date|End_date=Date|Themes=List (,) of String (allowed values=Africa, Asia, International relations, Middle East, Terrorism, United Kingdom domestic politics, United States domestic politics, War)}}
This is a [[:Category:Topics|topic]], with start date [[Has start date::{{#if:{{{start date| }}}|{{{start date}}}|unknown}}]] and end date [[Has end date::{{#if:{{{end date| }}}|{{{end date}}}|unknown}}]].
</noinclude><includeonly>{{#cargo_store:_table=Topics|Start_date={{{start date|}}}|End_date={{{end date|}}}|Themes={{{Themes|}}} }}
This is a [[:Category:Topics|topic]], with {{#if:{{{start date|}}}|start date {{{start date}}}|unknown start date}} and {{#if:{{{end date|}}}|end date {{{end date}}}|unknown end date}}.


Its theme(s) are {{#arraymap:{{{Themes|}}}|,|x|[[Has theme::x]]}}.
Its theme(s) are {{#arraymap:{{{Themes|}}}|,|x|[[x]]}}.


{{#ask:[[Addresses topic::{{PAGENAME}}]][[Category:Positions]]|query=TopicSummary|link=none}}
==Summary of positions for this topic==
{{#cargo_query:tables=Items,Opinions
|join on=Items._pageName=Opinions._pageName
|fields=concat(Opinions.Position_link, ' (', count(*), ' items)')
|group by=Opinions.Position
|where=Opinions.Topic="{{PAGENAME}}"
|order by=Items.Date
|format=ul
}}
 
==Full listing==
''Click on position names to view quotes from each listed item.''
 
{{#cargo_query:tables=Items,Opinions
|join on=Items._pageName=Opinions._pageName
|fields=Items.Summary,Opinions.Position_link,Opinions.Stance
|where=Opinions.Topic="{{PAGENAME}}"
|format=ddb outline
|outline fields=Position_link,Stance
|order by=CONCAT(CASE Stance
        WHEN 'for' THEN 1
        WHEN 'against' THEN 2
        WHEN 'mixed' THEN 3
        END), Date DESC
}}
 
==All items that address this topic ({{#cargo_query:tables=Items,Opinions
|join on=Items._pageName=Opinions._pageName
|fields=count(DISTINCT Items._pageName)
|where=Opinions.Topic="{{PAGENAME}}"
}} total)==
 
{{#cargo_query:tables=Items,Opinions
|join on=Items._pageName=Opinions._pageName
|fields=Items._pageName=Title,Items.Author,Items.Source,Items.Date
|where=Opinions.Topic="{{PAGENAME}}"
|order by=Items.Date
|group by=Items._pageName
}}


<font size="+1">All items that address this topic ([[Has number of opinion items::{{#ask:[[Addresses topic::{{PAGENAME}}]][[Category:Items]]|format=count}}]] total)</font>
<hr>
{{#ask:mainlabel=Title|sort=Was published on|order="descending"|[[Category:Items]][[Addresses topic::{{PAGENAME}}]]|? Was written by|? Was published by|? Was published on}}


{{#ask:format=timeline|timelinebands=DAY,MONTH|timelineposition=end|timelinesize=400px|[[Category:Items]][[Addresses topic::{{PAGENAME}}]]|? Was written by|? Was published by|? Was published on}}
{{#cargo_query:tables=Items,Opinions
|join on=Items._pageName=Opinions._pageName
|fields=Items._pageName,Items.Author,Items.Source,Items.Date
|where=Opinions.Topic="{{PAGENAME}}"
|group by=Items._pageName
|format=timeline
|height=400px
}}
[[Category:Topics]]
[[Category:Topics]]
</includeonly>
</includeonly>

Revision as of 03:37, August 8, 2019

This template holds information on a political topic. It should be called in the following format:

{{Topic
|Start date=The date at which the topic started, if there was one
|End date=The date at which the topic ended, if there was one
|Themes=The theme(s) of this topic, separated by commas if there's more than one
}}

An example of start and end date would be, if the topic is a bill, the date the bill was introduced in Congress, and the date it was signed into law, respectively.

The order of the fields is not relevant. This template defines the table "Topics". View table.