Sha256: 9814a09b4479831b8b8bbfecc44da9f4ae6c5bbfbc633e7328214214ec3dedda

Contents?: true

Size: 1008 Bytes

Versions: 8

Compression:

Stored size: 1008 Bytes

Contents

(function() {
  var commentId = <%= comment.id.to_json %>;
  var upVotes = <%= comment.up_votes.count.to_json %>;
  var downVotes = <%= comment.down_votes.count.to_json %>;
  var $comment = $("#comment_" + commentId);
  var $votes = $("> .comment__footer > .comment__footer-grid .comment__votes", $comment);
  var $upVote = $(".js-comment__votes--up", $votes);
  var $downVote = $(".js-comment__votes--down", $votes);

  $("span", $upVote).text(upVotes);
  $("span", $downVote).text(downVotes);

  $upVote.removeClass("is-vote-selected is-vote-notselected").removeAttr("disabled");
  $downVote.removeClass("is-vote-selected is-vote-notselected").removeAttr("disabled");

<% if comment.up_voted_by?(current_user) %>
  $upVote.addClass("is-vote-selected");
  $downVote.addClass("is-vote-notselected").attr("disabled", "disabled");
<% elsif comment.down_voted_by?(current_user) %>
  $upVote.addClass("is-vote-notselected").attr("disabled", "disabled");
  $downVote.addClass("is-vote-selected");
<% end %>
}());

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
decidim-comments-0.28.5 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.28.4 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.28.3 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.28.2 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.28.1 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.28.0 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.28.0.rc5 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.28.0.rc4 app/views/decidim/comments/votes/create.js.erb