Suggestions needed for poll plugin
-
This topic is old!
Find the plugin here: https://community.nodebb.org/topic/1549/nodebb-plugin-poll-poll-plugin
So I've picked up the development of the poll plugin again, but I need some opinions.
The poll plugin will look for a specific markup. There will still be a modal that will help you easily create a poll, but it'll convert that to the specific markup.
My proposed markup is as follows:Multiple choice:
[Poll title] [] Option one [] Option two
Single option:
[Poll title] () Option one () Option two
I currently have the following "flow" in mind:
- Post gets saved (
filter:post.save
), poll is recognized before MD parses it - Poll is saved to database and markup is removed from post
- Using
action:post.gotTopic
, a poll is retrieved and client renders it
My first question is, is there a demand for a "max votes per user" option? If so, it'd probably would be added to the markup like
[Poll title:4]
, where the 4 is the maximum amount of votes a user can select on a multiple choice poll.Other than that, what do you guys want from this? Please keep things possible
- Post gets saved (
-
That looks good to me.
-
Haha you should make a poll and see what people think
...My first question is, is there a demand for a "max votes per user" option?
I would just keep it simple and then re-iterate to meet demand, that's if I were in your shoes anyways.
Also, this discussion might have some good insight for you
-
@psychobunny thanks!
So what are you thoughts on the syntax? Something like in the first post or more something along the lines of:
[poll] - Option - Option [/poll]
The benefit of this one is that it allows for more "freedom" regarding possible settings.
-
Not sure really, I'd pick something that plays nice with Markdown with HTML sanitation turned on (default)
ie.
- Option - Option
If the poll's parse hook comes after Markdown, MD will turn this into bullet points before the poll plugin touches it. But if the parse hook is before MD, it would sanitize and zap all your HTML
Some things for you to think about when building this (future proofing)
- Poll expiration time
- Display results setting: always vs require vote first vs show only after poll expires or is manually stopped
- A button to end the poll
- Option to allow retracting/recasting votes
-
@psychobunny thanks, I'll keep that in mind.
I currently have the following "flow" in mind:
- Post gets saved (
filter:post.save
), poll is recognized before MD parses it - Poll is saved to database and markup is removed from post
- Using
action:post.gotTopic
, a poll is retrieved and client renders it
- Post gets saved (
-
Ah okay, makes sense. I thought you were rendering it in
filter:post.parse
, yours is a better strategy then. As far as your original question I'd say the second one feels neater I guess, but whatever works better for you -
@psychobunny doesn't really matter yet, but I also agree that the second will be the better option. It's both cleaner and can be extended easier.
-
So anyone feel like designing / creating some visuals? Specifically the poll view Would include both the vote and results screen.
-
@Carl I have this very ugly and quick mockup for testing purposes:
http://i.imgur.com/Lm1jv48.pngI've chosen to "embed" them inside the first post for theme compatibility reasons. In my opinion it would look best just above the first post, but I can't guarantee compatibility with all themes that way.
-
By the way... I got voting working
-
@Schamper Looks nice!