FIX: Use the register within the poll plugin
This commit is contained in:
parent
e3b47a3998
commit
d8a69e6bb2
|
@ -11,11 +11,11 @@ export function addDecorator(cb) {
|
||||||
|
|
||||||
export default class PostCooked {
|
export default class PostCooked {
|
||||||
|
|
||||||
constructor(attrs, getModel) {
|
constructor(attrs, decoratorHelper) {
|
||||||
this.attrs = attrs;
|
this.attrs = attrs;
|
||||||
this.expanding = false;
|
this.expanding = false;
|
||||||
this._highlighted = false;
|
this._highlighted = false;
|
||||||
this.getModel = getModel;
|
this.decoratorHelper = decoratorHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
update(prev) {
|
update(prev) {
|
||||||
|
@ -31,7 +31,7 @@ export default class PostCooked {
|
||||||
this._fixImageSizes($html);
|
this._fixImageSizes($html);
|
||||||
this._applySearchHighlight($html);
|
this._applySearchHighlight($html);
|
||||||
|
|
||||||
_decorators.forEach(cb => cb($html, this.getModel));
|
_decorators.forEach(cb => cb($html, this.decoratorHelper));
|
||||||
return $html[0];
|
return $html[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { withPluginApi } from 'discourse/lib/plugin-api';
|
import { withPluginApi } from 'discourse/lib/plugin-api';
|
||||||
import { observes } from "ember-addons/ember-computed-decorators";
|
import { observes } from "ember-addons/ember-computed-decorators";
|
||||||
|
|
||||||
function createPollComponent(container, post, poll, vote) {
|
function createPollComponent(register, post, poll, vote) {
|
||||||
const component = container.lookup("component:discourse-poll");
|
const component = register.lookup("component:discourse-poll");
|
||||||
component.setProperties({ model: poll, vote, post });
|
component.setProperties({ model: poll, vote, post });
|
||||||
return component;
|
return component;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ function initializePolls(api) {
|
||||||
const pollId = `${pollName}-${post.id}`;
|
const pollId = `${pollName}-${post.id}`;
|
||||||
|
|
||||||
const pollComponent = createPollComponent(
|
const pollComponent = createPollComponent(
|
||||||
helper.container,
|
helper.register,
|
||||||
post,
|
post,
|
||||||
polls[pollName],
|
polls[pollName],
|
||||||
votes[pollName]
|
votes[pollName]
|
||||||
|
|
Loading…
Reference in New Issue