• @Mr_Waffle

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

  • Plugin & Theme Dev

    @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.

  • Plugin & Theme Dev

    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?

  • Plugin & Theme Dev

    @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.

  • GNU/Linux Admin

    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! 😓

  • Plugin & Theme Dev

    @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 😛

  • GNU/Linux Admin

    Much appreciated of course 😄

  • Plugin & Theme Dev

    @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 😛

  • NodeBB Admin

    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.

  • Plugin & Theme Dev

    @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. 👍

  • Plugin & Theme Dev

    @Chris said:

    @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 😛

    Ye my idea would be to let the GUI insert the correct markdown.


  • Awesome work @mr_waffle!

    I do wonder what happens to a poll if the original topic is deleted?
    Does everything get cleaned up correctly, or are you going to end up with ghost polls?

  • Plugin & Theme Dev

    @San1ty Will keep that in mind.


  • @San1ty

    But that would not be an issue if polls are always original topics, rather than being also included in replies (posts). The problem, is how do you limit its use to OP only?


  • @planner Agreed polls should always be an OP.


  • @San1ty Options options options, I for one would also like to allow my users to post polls depending on what category they're in. I'm unsure on how extensible the permissions system in NodeBB is, might be worth making one of the most advanced ones in existence because I've always felt they're limited.


Suggested Topics

| | | |