poll tool



  • Hello

    I would like to delve deeper into the matter nodebb.

    I want to create a poll tool.

    1. when you create a new theme to a button "create poll" appear.

    2. Then comes a pop-up window to where you can make a survey.
           - And answers
           - Can be extended

    It would have three databases are created.
     1. the poll: Poll ID, Poll title, Poll creator username, Poll creator user ID
    2. the reply: answer ID, answering title, Poll ID
    3. the user vote: user id, answer ID, Poll ID

    the poll created will appear in the post.
    each registered user can vote.

    then it should be present in the menu or anywhere a list of polls.

    the profile of the users an extra pad could be created where his polls are to be seen in outline.

    the result list could still make pretty with charts .. but that's second

    I would like to tinker.
    Who can I ask me for questions about the system NodeBB?

    or are there any tutorials anchor the work with the NodeBB?



  • So you want to create plugin? You can watch https://community.nodebb.org/topic/218/how-to-guide-for-writing-your-first-plugin and the whole category for information


  • Plugin & Theme Dev



  • Thank you for the link.
    I've installed the tool to me.

    when I click "Allow guests to View Poll Results" it will not be saved!

    NodeBB 0.7.x

    If I reload the tick out again.

    I also gepeostet it at github.


  • Plugin & Theme Dev

    @ogerly don't think the plugin was updated for NodeBB v0.7.x. It's not compatible with 0.7.x



  • I think that plugin is outdated. I'm working on [poll] bbcode as part of my bbcodes plugin, but it is not finished yet



  • So the tool is running.
    following error, I've found.
    the poll will be created.
    when you save the text is not new reloaded.
    Here are the screenshots

    Bildschirmfoto vom 2015-08-06 10:08:53.png

    Bildschirmfoto vom 2015-08-06 10:08:53.png



  • @ogerly said:

    So the tool is running.
    following error, I've found.
    the poll will be created.
    when you save the text is not new reloaded.
    Here are the screenshots

    Bildschirmfoto vom 2015-08-06 10:08:53.png

    Bildschirmfoto vom 2015-08-06 10:08:53.png

    Yes.. This is an error with nodeBB 0.7.2.
    On @exodo, we have fixed it, just change the file public/js/poll/main.js with this code:

    (function() {
    	window.Poll = {
    		load: function(data) {
    			$(window).one('action:ajaxify.contentLoaded', function () {
    				Poll.sockets.emit.load(data, function(err, poll) {
    					if (!err) {
    						Poll.view.init(poll, function(pollView) {
    							if (parseInt(poll.info.deleted, 10) === 1 || parseInt(poll.info.ended, 10) === 1) {
    								Poll.view.showMessage({
    									title: 'Voting unavailable',
    									content: 'This poll has ended or has been marked as deleted. You can still view the results.'
    								}, pollView);
    							}
    						});
    					} else if (err.message != 'Not logged in') {
    						app.alertError('Something went wrong while getting the poll!');
    					}
    				});
    			});
    		}
    	};
    })();
    
    

    Really, the change is only in the line:

    Poll.sockets.emit.load(data, function(err, poll) {
    

    And then, change the file templates/poll/notify.tpl with:

    <script>Poll.load({pollid})</script>
    

    After that, It should work well 🙂


Log in to reply
 

Suggested Topics

  • 1
  • 1
  • 10
  • 2
  • 12
| |