Remove redundant "participation not allowed" code

Very similar code is present in the `votes.js` file. Since the only
elements with the `js-participation-not-allowed` class also matched the
`div.supports div.participation-not-allowed` selector, for these
elements the events were executed twice.

So we can get rid of the `js-participation` class alongside all the
JavaScript code referencing it.
This commit is contained in:
Javi Martín
2022-01-12 15:32:31 +01:00
parent f11fd2b13e
commit 9a625fe59f
5 changed files with 5 additions and 22 deletions

View File

@@ -1,15 +0,0 @@
(function() {
"use strict";
App.AllowParticipation = {
initialize: function() {
$(document).on({
"mouseenter focus": function() {
$(this).find(".js-participation-not-allowed").show();
},
mouseleave: function() {
$(this).find(".js-participation-not-allowed").hide();
}
}, ".js-participation");
}
};
}).call(this);

View File

@@ -66,7 +66,6 @@
//= require tags
//= require users
//= require votes
//= require allow_participation
//= require advanced_search
//= require registration_form
//= require suggest
@@ -124,7 +123,6 @@ var initialize_modules = function() {
App.Comments.initialize();
App.Users.initialize();
App.Votes.initialize();
App.AllowParticipation.initialize();
App.Tags.initialize();
App.FoundationExtras.initialize();
App.LocationChanger.initialize();

View File

@@ -1,4 +1,4 @@
<div class="js-participation supports ballot">
<div class="supports ballot">
<% if voted? %>
<div class="remove supported">
<span class="icon-check-circle"
@@ -36,7 +36,7 @@
<% end %>
<% if reason.present? && !voted? %>
<div class="js-participation-not-allowed participation-not-allowed" style="display:none">
<div class="participation-not-allowed" style="display:none">
<p>
<small>
<%= sanitize(t("budgets.ballots.reasons_for_not_balloting.#{reason}",

View File

@@ -1,4 +1,4 @@
<div class="supports js-participation">
<div class="supports">
<span class="total-supports <%= "no-button" unless voting_allowed? || user_voted_for? %>">
<%= t("budgets.investments.investment.supports", count: investment.total_votes) %>
@@ -36,7 +36,7 @@
<% if reason.present? && !user_voted_for? %>
<div tabindex="0">
<div class="js-participation-not-allowed participation-not-allowed" style="display:none" aria-hidden="false">
<div class="participation-not-allowed" style="display:none" aria-hidden="false">
<p>
<small>
<%= sanitize(t("votes.budget_investments.#{reason}",

View File

@@ -39,7 +39,7 @@
<% elsif investment.should_show_vote_count? %>
<div id="<%= dom_id(investment) %>_votes"
class="small-12 medium-3 column text-center">
<div class="supports js-participation">
<div class="supports">
<span class="total-supports no-button">
<%= t("budgets.investments.investment.supports",
count: investment.total_votes) %>