From 9a625fe59fe313d370aaff64639aa048a35d4b23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 12 Jan 2022 15:32:31 +0100 Subject: [PATCH] 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. --- app/assets/javascripts/allow_participation.js | 15 --------------- app/assets/javascripts/application.js | 2 -- .../budgets/investments/ballot_component.html.erb | 4 ++-- .../budgets/investments/votes_component.html.erb | 4 ++-- .../budgets/investments/_investment.html.erb | 2 +- 5 files changed, 5 insertions(+), 22 deletions(-) delete mode 100644 app/assets/javascripts/allow_participation.js diff --git a/app/assets/javascripts/allow_participation.js b/app/assets/javascripts/allow_participation.js deleted file mode 100644 index b6223a47c..000000000 --- a/app/assets/javascripts/allow_participation.js +++ /dev/null @@ -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); diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 71b2ac9ce..0521eac84 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -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(); diff --git a/app/components/budgets/investments/ballot_component.html.erb b/app/components/budgets/investments/ballot_component.html.erb index 0bf6ee56a..4d3868666 100644 --- a/app/components/budgets/investments/ballot_component.html.erb +++ b/app/components/budgets/investments/ballot_component.html.erb @@ -1,4 +1,4 @@ -
+
<% if voted? %>
<% if reason.present? && !voted? %> -