Sha256: 7eb5e18eafabd594cb6920889802b92a52e25b7aa9282d5dc9fc8687dc0614f5

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

$(document).ready(function() {

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

  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'}" %>");

  <% if vote.voter_id && Neutral.config.can_change %>

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

  neutral.append('<%= escape_javascript(
    Neutral::VotingBuilder::Elements::Link::Remove.new(
      Neutral::VotingBuilder::Router.new(vote)[:remove],
      Neutral.icons.send(Neutral.config.default_icon_set).send(:remove)).to_s
    )
  %>');

  <% end %>

});

Version data entries

8 entries across 8 versions & 1 rubygems

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