Sha256: ac4e6f98062c56d2f505b5fa7d1956058fda7fa00138a88999dcfcfcccbbf1f0

Contents?: true

Size: 1014 Bytes

Versions: 37

Compression:

Stored size: 1014 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__votes", $comment);
  var $upVote = $(".comment__votes--up", $votes);
  var $downVote = $(".comment__votes--down", $votes);

  $(".comment__votes--count", $upVote).text(upVotes);
  $(".comment__votes--count", $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

37 entries across 37 versions & 1 rubygems

Version Path
decidim-comments-0.27.9 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.27.8 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.27.7 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.27.6 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.26.10 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.26.9 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.27.5 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.26.8 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.27.4 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.27.3 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.26.7 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.26.5 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.27.2 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.27.1 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.26.4 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.27.0 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.26.3 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.27.0.rc2 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.27.0.rc1 app/views/decidim/comments/votes/create.js.erb
decidim-comments-0.26.2 app/views/decidim/comments/votes/create.js.erb