Sha256: 6d975f63ddb84ec479d827c86c40835fa93ec38b9ea81acbec4cd93298421616

Contents?: true

Size: 1.68 KB

Versions: 60

Compression:

Stored size: 1.68 KB

Contents

<% @proposals.each do |proposal| %>
  (function() {
    var $proposalVotesCount = $('#proposal-<%= proposal.id %>-votes-count');

    if($proposalVotesCount[0]) {
      morphdom($proposalVotesCount[0], '<%= j(render partial: "decidim/proposals/proposals/votes_count", locals: { proposal: proposal, from_proposals_list: @from_proposals_list }).strip.html_safe %>');
    }

    var $proposalVoteButton = $('#proposal-<%= proposal.id %>-vote-button');

    if($proposalVoteButton[0]) {
      morphdom($proposalVoteButton[0], '<%= j(render partial: "decidim/proposals/proposals/vote_button", locals: { proposal: proposal, from_proposals_list: @from_proposals_list }).strip.html_safe %>');
    }
  })();
<% end %>

<% if vote_limit_enabled? %>
  (function() {
    var $remainingVotesCount = $('#remaining-votes-count');
    var $notVotedButtons = $('.card__button.button').not('.success');

    if(!$remainingVotesCount[0]) { return; }

    morphdom($remainingVotesCount[0], '<%= j(render partial: "decidim/proposals/proposals/remaining_votes_count").strip.html_safe %>');

    <% if remaining_votes_count_for(current_user) == 0 %>
      $notVotedButtons.attr('disabled', true);
      $notVotedButtons.val('<%= t("decidim.proposals.proposals.vote_button.no_votes_remaining") %>');
    <% else %>
      $notVotedButtons.attr('disabled', false);
      $notVotedButtons.val('<%= t("decidim.proposals.proposals.vote_button.vote") %>');
    <% end %>
  }());
<% end %>

<% if show_voting_rules? %>
  (function() {
    var $votingRules = $('.voting-rules');
    if(!$votingRules[0]) { return; }
    morphdom($votingRules[0], '<%= j(render partial: "decidim/proposals/proposals/voting_rules").strip.html_safe %>');
  }());
<% end %>

Version data entries

60 entries across 60 versions & 1 rubygems

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