A teaser?

NodeBB Plugins
  • Ahem
    Has anyone read these so far?

    I think I already nailed the database part. Now the most difficult part 🙂
    And oh, it's a plugin.

  • ideally you should have waited till we announced plugin weekend 5 and what the prize was before posting the winner to the competition 😄

  • @psychobunny said:

    ideally you should have waited till we announced plugin weekend 5 and what the prize was before posting the winner to the competition 😄

    I didn't say it would be an entry to this weeks competition 😛 I would like it to be, but I'd have to finish it by tomorrow since I'm swamped Friday through Sunday, and I only started working on it this evening.

  • @Mr_Waffle

    Very nice, Mr Waffle. What does or what will the result interface look like? Do I see horizontal-colored bars representing each option that slide right per vote, or something else?

  • @Mr_Waffle,

    Question, Mr Waffle:

    When the plugin is installed and activated, does that put an icon in the composer toolbar so that clicking on it brings up the poll input box. Or how do users access the poll? Ideally, it would be better to place some user-access restriction on polling, don't you think?

  • @planner I'm thinking of horizontal bars, with a percentage shown somewhere.
    It only adds the icon to the toolbar on a new topic, not on a new post. The poll creation box pulls up when clicked. I'm still thinking about how users will vote. It has admin panel access so that restrictions can be set, but depending on how much progress I make that will or won't make it into the first version.

  • @Mr_Waffle

    That sounds good. How about showing the percentage of votes inside the (colored) bars?

  • @planner said:

    @Mr_Waffle

    That sounds good. How about showing the percentage of votes inside the (colored) bars?

    Details for later 😛 First I need to get an actual poll to show up on a topic. I'm figuring out what the best way for this is. Might need some core changes to help with this.

  • So I got poll insertion working.
    stuff

    Still 100% plugin 🙂 Pretty tough keeping it like that.

  • @Mr_Waffle

    Looking good, but how is this supposed to work?

    Is the poll going to be the topic or is it designed to be inserted into a topic or can it be used both ways?

  • @planner said:

    @Mr_Waffle

    Looking good, but how is this supposed to work?

    Is the poll going to be the topic or is it designed to be inserted into a topic or can it be used both ways?

    Because of certain limitations in NodeBB (that would require some serious extra hard work to get into core) it currently works like this:

    • Click poll button in composer
      • Poll composer opens
      • If all your entries are valid, it's send to server and saved in the database. (database now contains unlinked poll)
      • A "special" identifier is added to the post content ((%poll:1%) for example)
    • You post your topic
      • Post gets parsed, if identifier is found, it checks a few things: are the author of the poll and post the same? Has the poll been linked yet? And something else, think it was if the post was OP
      • If everything checks out, poll and topic/post get linked via some database entries

    That covers the creation of a poll, now how I'm showing it:

    • Register for ajaxify events, catch navigation to /topic/\d+/
      • Ask server if this topic has a poll
      • If it does, poll is returned and will be parsed and displayed. Else do nothing

    Interesting stuff 🙂

  • @Mr_Waffle

    Interesting stuff

    Yes, very interesting. Just thinking if polls should be allowed in posts or should be just limited to topics, that is, original posts.

  • Wow, all that awesome hard work @mr_waffle!

    I wanted to tackle this a long time ago, but I wanted to go about it a different way, and use a polling API instead. It would've ended up being less work in the end, except I couldn't find a good enough polling API service! 😓

  • @julian said:

    Wow, all that awesome hard work @mr_waffle!

    I wanted to tackle this a long time ago, but I wanted to go about it a different way, and use a polling API instead. It would've ended up being less work in the end, except I couldn't find a good enough polling API service! 😓

    Yeah I read that in another thread. Figured I'd be that guy and just create something myself 😛

  • Much appreciated of course 😄

  • @julian ofcourse... 🙂 Hopefully with 0.4 there'll be some new hooks and stuff that will make this a lot easier to maintain. Will require some brainstorming to come up with those 😛

  • Maybe markdown can be extended for polls like the checkboxes in github. So creating a poll might be just typing out the below

    [] option 1
    [] option 2
    [] option 3
    

    Obviously it will have to be parsed and rendered and clicks need to be registered. Thinking out loud.

  • @baris That might've been better actually 😄 I'll think about everything and I'll see whatever I end up with using.

  • @Mr_Waffle I think giving the users the options of both a GUI or simple markdown would probably be the best. To us markdown is easy and makes a lot of sense but in general Markdown is still very new and most users have very little idea how to use it.

    Trying to explain to the average forum user how to make a forum poll through markdown could be a nightmare and completely not worth it 😛

  • @Mr_Waffle Poll? Definitely getting my vote. 👍


Suggested Topics