mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
Set up poll plugin javascript using an Ember initializer.
This commit is contained in:
parent
55e5515657
commit
5cb2df8f09
7
.gitignore
vendored
7
.gitignore
vendored
|
@ -40,9 +40,10 @@ config/discourse.conf
|
|||
log/
|
||||
|
||||
# Ignore plugins except for the bundled ones.
|
||||
/plugins
|
||||
!/plugins/emoji
|
||||
!/plugins/poll
|
||||
/plugins/*
|
||||
!/plugins/emoji/
|
||||
!/plugins/poll/
|
||||
/plugins/*/auto_generated/
|
||||
|
||||
/spec/fixtures/plugins/my_plugin/auto_generated
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import PollController from "discourse/plugins/poll/controllers/poll";
|
||||
|
||||
var Poll = Discourse.Model.extend({
|
||||
post: null,
|
||||
options: [],
|
||||
|
@ -41,8 +43,6 @@ var Poll = Discourse.Model.extend({
|
|||
}
|
||||
});
|
||||
|
||||
var PollController = require("discourse/plugins/poll/controllers/poll").default;
|
||||
|
||||
var PollView = Ember.View.extend({
|
||||
templateName: "poll",
|
||||
classNames: ['poll-ui'],
|
||||
|
@ -73,6 +73,11 @@ function initializePollView(self) {
|
|||
return pollView;
|
||||
}
|
||||
|
||||
|
||||
export default {
|
||||
name: 'poll',
|
||||
|
||||
initialize: function() {
|
||||
Discourse.PostView.reopen({
|
||||
createPollUI: function($post) {
|
||||
var post = this.get('post');
|
||||
|
@ -99,3 +104,5 @@ Discourse.PostView.reopen({
|
|||
}
|
||||
}.on('willClearRender')
|
||||
});
|
||||
}
|
||||
}
|
|
@ -144,7 +144,7 @@ end
|
|||
# Poll UI.
|
||||
register_asset "javascripts/controllers/poll.js.es6"
|
||||
register_asset "javascripts/discourse/templates/poll.js.handlebars"
|
||||
register_asset "javascripts/poll_ui.js"
|
||||
register_asset "javascripts/initializers/poll.js.es6"
|
||||
register_asset "javascripts/poll_bbcode.js", :server_side
|
||||
|
||||
register_css <<CSS
|
||||
|
|
Loading…
Reference in New Issue
Block a user