FANDOM


DiscussionsRailModule adds a rail module for Discussions to the rail, listing a feed of discussions posts for the wiki. The script offers the same configuration options as the activity feed tag.

If you import the script, you can use the feed design on any article by placing the <discussions /> tag in the same wrapper:

<div class="discussions-rail-theme">
<discussions />
</div>

Installation

Configuration

Embedding-only use

The script can be configured to deactivate the rail module and style the embedded module in articles, by using the window.discussionsModuleEmbed object in your wiki's MediaWiki:Wikia.js:

window.discussionsModuleEmbed = true;

Positioning

The Discussions rail module is positioned below the Wiki Activity or Forum Activity modules when they're available, or appended to the bottom of the rail.

It is possible to adjust the module to any desired position by using the discussionsModule.added hook in your wiki's MediaWiki:Wikia.js.

For example, this code will position the module above the Insights module.

    mw.hook('discussionsModule.added').add(function($module) {
        // Module addition
        if ($('.insights-module').exists()) {
            $module.insertBefore('.insights-module');
        } else {
            $module.appendTo('#WikiaRail');
        }
    });

Post-processing

The module's contents can be changed after loading using the discussionsModule.loaded hook.

Styling

The header text is adjustable with the following CSS (replacing <TITLE> with your text):

.discussions-rail-theme .embeddable-discussions-module .embeddable-discussions-heading:after {
	content: '<TITLE>';
}

Content filtering

The feed content for the rail module is configured through the optional window.discussionsModuleConfig object, placed in MediaWiki:Wikia.js:

window.discussionsModuleConfig = {
	'size' : 'number 3-6',
	'mostrecent' : 'true/false',
	'catid' : [
		'first category id',
		'second category id',
		'etc'
	]
}
Option Description Default
size

Number of posts in the post list.
Post minimum is 3, maximum is 6.

4
mostrecent

Controls feed sorting by latest or trending posts.
Accepts true or false.

false
catid Specific categories to return posts from. None.

The help page for the Discussions activity feed has further guidance on how the configuration options work.

Updates

Changelog

May 30, 2017
Speedit: Initial revision.
May 31, 2017
Rappy 4187: Initial release on FANDOM Developers Wiki.
June 23, 2017‎
KockaAdmiralac: Full rewrite of initial version.
July 29, 2017
Speedit: Addition of WDS spinner.
July 7, 2017‎
Speedit: Addition of Discussions default avatar SVG.
July 29, 2017‎
Speedit: Removal of .module class.

September 5, 2017‎
Speedit: Object-based rewrite and feature additions.

  • Populating empty post titles (from Discussions alpha stage).
  • Cleanup of mutated arguments, nested functions & callbacks.

November 29, 2017‎
Speedit: I18n support for module header.
March 18 2018
Speedit: Content embedding patches, DRY for logic, preventing race conditions.

TO-DO:

  • Color adjustment for default Discussions avatar.