Why mixes widget and handlebars?

My advice here would be to look at existing plugins like polls plugin etc.

There is a large list at: GitHub - discourse/all-the-plugins · GitHub