mirror of
https://github.com/flarum/framework.git
synced 2025-02-22 20:04:11 +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(
|
return [icon(this.icon(), { className: 'EventPost-icon' }), m(
|
||||||
'div',
|
'div',
|
||||||
{ 'class': 'EventPost-info' },
|
{ '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() {
|
value: function icon() {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'description',
|
||||||
|
value: function description(data) {
|
||||||
|
return app.translator.transChoice(this.descriptionKey(), data.count, data);
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: 'descriptionKey',
|
key: 'descriptionKey',
|
||||||
value: function descriptionKey() {
|
value: function descriptionKey() {
|
||||||
|
@ -34,7 +34,7 @@ export default class EventPost extends Post {
|
|||||||
return [
|
return [
|
||||||
icon(this.icon(), {className: 'EventPost-icon'}),
|
icon(this.icon(), {className: 'EventPost-icon'}),
|
||||||
<div class="EventPost-info">
|
<div class="EventPost-info">
|
||||||
{app.translator.transChoice(this.descriptionKey(), data.count, data)}
|
{this.description(data)}
|
||||||
</div>
|
</div>
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -48,6 +48,16 @@ export default class EventPost extends Post {
|
|||||||
return '';
|
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.
|
* Get the translation key for the description of the event.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user