2019-03-18 14:34:35 +01:00
|
|
|
import { Counter } from "./counter.js";
|
|
|
|
|
|
2019-03-27 15:26:20 +01:00
|
|
|
export class Message extends owl.core.Component {
|
2019-03-18 14:34:35 +01:00
|
|
|
inlineTemplate = `
|
2019-03-18 11:35:03 +01:00
|
|
|
<div class="message">
|
|
|
|
|
<span class="author"><t t-esc="props.author"/></span>
|
|
|
|
|
<span class="msg"><t t-esc="props.msg"/></span>
|
|
|
|
|
<button class="remove" t-on-click="removeMessage">Remove</button>
|
2019-03-18 14:34:35 +01:00
|
|
|
<t t-widget="Counter" t-props="{initialState: props.id}"/>
|
2019-03-18 11:35:03 +01:00
|
|
|
</div>`;
|
|
|
|
|
|
|
|
|
|
constructor(parent, props) {
|
|
|
|
|
super(parent, props);
|
2019-03-18 14:34:35 +01:00
|
|
|
this.widgets = { Counter };
|
2019-03-18 11:35:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
removeMessage() {
|
|
|
|
|
this.trigger("remove_message", {
|
|
|
|
|
id: this.props.id
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|