Sha256: d170d0eb957eddfe6270e54213ae6e0c7fc5c6595b7f4bd01f8897e3be933492

Contents?: true

Size: 740 Bytes

Versions: 2

Compression:

Stored size: 740 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", "<%= voting.difference > 0 ? 'positive' : 'negative' %>");

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

});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
neutral-0.0.2 app/views/neutral/votes/destroy.js.erb
neutral-0.0.1 app/views/neutral/votes/destroy.js.erb