2016-06-13 18:21:14 +08:00
|
|
|
import { withPluginApi } from 'discourse/lib/plugin-api';
|
|
|
|
import showModal from 'discourse/lib/show-modal';
|
|
|
|
|
|
|
|
function initializePollUIBuilder(api) {
|
2016-07-01 01:55:44 +08:00
|
|
|
const ComposerController = api.container.lookupFactory("controller:composer");
|
2016-06-13 18:21:14 +08:00
|
|
|
ComposerController.reopen({
|
|
|
|
actions: {
|
|
|
|
showPollBuilder() {
|
|
|
|
showModal("poll-ui-builder").set("toolbarEvent", this.get("toolbarEvent"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
api.addToolbarPopupMenuOptionsCallback(function() {
|
|
|
|
return {
|
|
|
|
action: 'showPollBuilder',
|
|
|
|
icon: 'bar-chart-o',
|
|
|
|
label: 'poll.ui_builder.title'
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: "add-poll-ui-builder",
|
|
|
|
|
|
|
|
initialize() {
|
2016-07-01 09:25:37 +08:00
|
|
|
withPluginApi('0.5', initializePollUIBuilder);
|
2016-06-13 18:21:14 +08:00
|
|
|
}
|
|
|
|
};
|