Fandom Developers Wiki
Advertisement

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

Template:Script Install/ImportJS

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 = {
	'columns' : '1 or 2',
	'size' : 'number 3-6',
	'mostrecent' : 'true/false',
	'catid' : [
		'first category id',
		'second category id',
		'etc'
	]
}
Option Description Default
columns

Number of columns for the post list.
Maximum of 2 columns.

1
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.

To-do

  • Embed-only option that deactivates the rail module.
  • Rewrite for better performance and code readability.
  • Translation for default header text "Discussions Activity".
  • Color adjustment for default Discussions avatar.
  • Generating the rail module HTML with JS?
Advertisement