Sha256: f02450d90642a6d91adbc45dabebe21ed537ca1090f10441b22f19a76858e359

Contents?: true

Size: 756 Bytes

Versions: 8

Compression:

Stored size: 756 Bytes

Contents

$(document).ready(function() {

  neutral = $("div.neutral").find("<%= by_url %>").parent();

  neutral.find("a[class!='remove']").data('method', 'post');
  neutral.find("a[class!='remove']").attr('data-method', 'post');
  neutral.find("a.positive").attr('href', '<%= votes_path(1) %>');
  neutral.find("a.negative").attr('href', '<%= votes_path(0) %>');

  neutral.find("span.positive").html("<%= voting.positive.nonzero? %>");
  neutral.find("span.negative").html("<%= voting.negative.nonzero? %>");
  neutral.find("span.difference").html("<%= voting.difference.nonzero?.try(:abs) %>");

  neutral.find("span.difference").attr("class", "<%= "difference #{voting.difference > 0 ? 'positive' : 'negative'}" %>");

  neutral.find("a.remove").remove();

});

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
neutral-0.0.10 app/views/neutral/votes/destroy.js.erb
neutral-0.0.9 app/views/neutral/votes/destroy.js.erb
neutral-0.0.8 app/views/neutral/votes/destroy.js.erb
neutral-0.0.7 app/views/neutral/votes/destroy.js.erb
neutral-0.0.6 app/views/neutral/votes/destroy.js.erb
neutral-0.0.5 app/views/neutral/votes/destroy.js.erb
neutral-0.0.4 app/views/neutral/votes/destroy.js.erb
neutral-0.0.3 app/views/neutral/votes/destroy.js.erb