Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple polls on the same page #35

Open
lesterchan opened this issue Feb 2, 2015 · 10 comments
Open

Allow multiple polls on the same page #35

lesterchan opened this issue Feb 2, 2015 · 10 comments
Labels

Comments

@lesterchan
Copy link
Owner

Changes has to be made to not use id but class like .poll-1 and not #poll-id alongside with javascript changes that find the context of the poll button being clicked.

https://wordpress.org/support/topic/weird-things-happen-when-the-same-poll-is-showing-in-content-and-sidebar?replies=3#post-6512375

@lesterchan lesterchan added the bug label Feb 2, 2015
@espellcaste
Copy link

@lesterchan Any idea from the top of the head what changes would be needed, in case someone wishes to send a pull request?

@lesterchan
Copy link
Owner Author

@espellcaste lots of changing. First you need to modify the template to ensure that id="polls-{id}" is no longer being used, instead it should be class="polls-{id}" after that you need to modify the JS file to find the .polls-{id} being rated

@bitinn
Copy link

bitinn commented Feb 9, 2015

would love to see this, for years (I mean literally, been using this since 2006) i couldn't figure out a proper way to do this.

would it be easier to have a logic that hides the sidebar poll, when i manually added it to main content?

@espellcaste
Copy link

Got it @lesterchan! It seems not that complicated... I'm gonna try to suggest something in the future. =)

@bitinn
Copy link

bitinn commented Feb 10, 2015

I would suggest data-id instead of class.

@espellcaste
Copy link

Any advantages in this approach @bitinn?

@bitinn
Copy link

bitinn commented Feb 10, 2015

@espellcaste generally speaking, separating class name from javascript is a good idea, both for separation of concerns and ease of maintenance. In our case the poll id serve no actual styling purpose, but is used as selector in jquery, since repeat id is no-go, data-* attributes works best.

with data-id i expect not much needed to be changed, but I haven't looked into this plugin lately, so maybe @lesterchan can offer some suggestions.

@lesterchan
Copy link
Owner Author

I agree. I would go with data-poll_id= and .poll-. Some people want specified style for a poll, so i think have a specific class is good as well.

@espellcaste
Copy link

Good point @bitinn. I agree @lesterchan.

@archon810
Copy link

@lesterchan Any updates on this after 4 years? :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants