1
0
mirror of https://github.com/flarum/core.git synced 2025-07-30 13:10:24 +02:00

Extract EventPost description into separate method

This makes it easier to override in subclasses.
In preparation for #428.
This commit is contained in:
Franz Liedke
2016-03-30 20:41:15 +09:00
parent 9ae189bb9f
commit bc11ec68dd
2 changed files with 17 additions and 2 deletions

View File

@@ -34,7 +34,7 @@ export default class EventPost extends Post {
return [
icon(this.icon(), {className: 'EventPost-icon'}),
<div class="EventPost-info">
{app.translator.transChoice(this.descriptionKey(), data.count, data)}
{this.description(data)}
</div>
];
}
@@ -48,6 +48,16 @@ export default class EventPost extends Post {
return '';
}
/**
* Get the description text for the event.
*
* @param {Object} data
* @return {String|Object} The description to render in the DOM
*/
description(data) {
return app.translator.transChoice(this.descriptionKey(), data.count, data);
}
/**
* Get the translation key for the description of the event.
*