This is a documentation subpage for Template:RfX template maker. It may contain usage information, categories and other content that is not part of the original template page. |
This template is used for making reports about current requests for adminship and requests for bureaucratship (collectively known as "RfX" discussions). The data about current RfXes is provided by Module:Rfx, and this template enables editors to organise this RfX data into custom templates of their own devising. Updates to the RfX data are generated on the fly, but it may be necessary to purge the page to force the latest data to be generated.
Usage
editTo use this template, you need to create two different types of template: a main template, and a row template. The main template contains introductory code, for example a heading saying "Current RfXes", and a call to {{RfX template maker}}. The row template contains the code for displaying each individual RfX discussion. {{RfX template maker}} links these two together to make the final template.
Main and row templates
editHere is an example of a main template:
Current requests for adminship:
{{RfX template maker
|type = rfa
|template = Template:My Rfx template/row
|page = yes
|user = yes
|supports = yes
|opposes = yes
|neutrals = yes
|percent = yes
|report = yes
}}
This template has two required parameters, |type=
and |template=
. The |type=
parameter can be set to either "rfa", to list current requests for adminship, or to "rfb", to list current requests for bureaucratship. The |template=
parameter is the name of the row template. The rest of the parameters are the fields that you use in the row template, and should be set to "yes".
Here is an example of a row template:
* [[{{{page}}}|{{{user}}}]] – S: {{{supports}}}, O: {{{opposes}}}, N: {{{neutrals}}} ({{{percent}}}%). [{{{report}}} report]
This template is called for each open rfa or rfb, depending on the |type=
parameter specified in the main template.
If there were two current requests for adminship, the template output might look like this:
Current requests for adminship:
- AdminHopeful1 – S: 10, O: 5, N: 2 (67%). report
- AdminHopeful2 – S: 2, O: 8, N: 0 (20%). report
Row template parameters
editRow templates can take the following parameters:
- page - the full page name of the RfX discussion page.
- user - the candidate's username.
- status - the status of the RfX. Can be "open" or "pending closure".
- supports - the number of users supporting the candidate.
- opposes - the number of users opposing the candidate.
- neutrals - the number of users neutral about the candidate.
- percent - the percentage support that the candidate has. Calculated by supports / (supports + opposes) * 100, rounded to the nearest whole number.
- endtime - the time that the RfX discussion is scheduled to end.
- secondsleft - the number of seconds before the discussion is scheduled to end. Doesn't go below zero.
- timeleft - the time left before the discussion is scheduled to end, in days and hours.
- lastupdate - the time that the RfX data was last updated.
- dupes - whether there are any duplicate votes. Either "yes" or "no".
- report - the URL of the RfA report, for example "//tools.wmflabs.org/xtools/rfa/?p=Wikipedia:Requests_for_adminship/Example".
Each parameter used in the row template should be passed as |parameter=yes
to the main template, as described above. (This is for performance reasons - some of the parameters require a significant amount of processing, and this system avoids processing the parameters when they are not being used.)