mirror of
https://github.com/flarum/framework.git
synced 2025-02-22 07:19:56 +08:00
Extract EventPost description into separate method
This makes it easier to override in subclasses. In preparation for #428.
This commit is contained in:
parent
9ae189bb9f
commit
bc11ec68dd
7
js/forum/dist/app.js
vendored
7
js/forum/dist/app.js
vendored
@ -21923,7 +21923,7 @@ System.register('flarum/components/EventPost', ['flarum/components/Post', 'flaru
|
||||
return [icon(this.icon(), { className: 'EventPost-icon' }), m(
|
||||
'div',
|
||||
{ 'class': 'EventPost-info' },
|
||||
app.translator.transChoice(this.descriptionKey(), data.count, data)
|
||||
this.description(data)
|
||||
)];
|
||||
}
|
||||
}, {
|
||||
@ -21931,6 +21931,11 @@ System.register('flarum/components/EventPost', ['flarum/components/Post', 'flaru
|
||||
value: function icon() {
|
||||
return '';
|
||||
}
|
||||
}, {
|
||||
key: 'description',
|
||||
value: function description(data) {
|
||||
return app.translator.transChoice(this.descriptionKey(), data.count, data);
|
||||
}
|
||||
}, {
|
||||
key: 'descriptionKey',
|
||||
value: function descriptionKey() {
|
||||
|
@ -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.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user