mirror of
https://github.com/flarum/framework.git
synced 2024-12-02 15:03:44 +08:00
Improved naming of class for post by actor.
Made class list for post extensible by using a separate method.
This commit is contained in:
parent
9f0a178f58
commit
830f48a212
|
@ -39,7 +39,7 @@ export default class Post extends Component {
|
||||||
view() {
|
view() {
|
||||||
const attrs = this.attrs();
|
const attrs = this.attrs();
|
||||||
|
|
||||||
attrs.className = 'Post ' + (this.loading ? 'Post--loading ' : '') + (this.props.post.user() === app.session.user ? 'Post--self' : '') + (attrs.className || '');
|
attrs.className = this.classes().join(' ');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<article {...attrs}>
|
<article {...attrs}>
|
||||||
|
@ -98,6 +98,20 @@ export default class Post extends Component {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
classes() {
|
||||||
|
let classes = ['Post'];
|
||||||
|
|
||||||
|
if (this.loading) {
|
||||||
|
classes.push('Post--loading');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.props.post.user() === app.session.user) {
|
||||||
|
classes.push('Post--by-actor');
|
||||||
|
}
|
||||||
|
|
||||||
|
return classes;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build an item list for the post's actions.
|
* Build an item list for the post's actions.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user