lib/generators/e9_polls/templates/javascript.js in e9_polls-1.0.4 vs lib/generators/e9_polls/templates/javascript.js in e9_polls-1.0.5

- old
+ new

@@ -2,28 +2,28 @@ $('body.admin table.records a.view-poll-results').colorbox({ transition: 'none', width: '35%', height: '50%', onComplete: function() { - $('#cboxLoadedContent div.poll-question') - .replaceWith(function(i, content) { - return "<h1>" + content + "</h1>"; - }); + $('#cboxLoadedContent div.poll-question').replaceWith(function(i, content) { + return "<h1>" + content + "</h1>"; + }); } }); - $('.renderable.poll form').live('submit', function(e) { + $('.renderable.poll form #poll_submit').live('click', function(e) { e.preventDefault(); - var el = $(this); + var el = $(this).closest('form'); + // return if no selection if (!$("input[@name='poll[vote]']:checked").val()) return; $.ajax({ url: el.attr('action'), - data: el.serializeArray(), dataType: 'json', type: 'POST', + data: el.serializeArray(), success: function(data, status, xhr) { el.closest('.renderable.poll').html(data.html); } }); });