diff --git a/app/assets/javascripts/admin/votation_types/fields.js b/app/assets/javascripts/admin/votation_types/fields.js index 85649e675..378d7474b 100644 --- a/app/assets/javascripts/admin/votation_types/fields.js +++ b/app/assets/javascripts/admin/votation_types/fields.js @@ -2,16 +2,18 @@ "use strict"; App.AdminVotationTypesFields = { adjustForm: function() { - if ($(this).val() === "unique") { - $(".max-votes").hide(); - $(".description-unique").show(); - $(".description-multiple").hide(); - $(".votation-type-max-votes").prop("disabled", true); - } else { + var select_field = $(this); + + $("[data-vote-type]").hide(0, function() { + $("[data-vote-type=" + select_field.val() + "]").show(); + }); + + if (select_field.val() === "multiple") { $(".max-votes").show(); - $(".description-unique").hide(); - $(".description-multiple").show(); $(".votation-type-max-votes").prop("disabled", false); + } else { + $(".max-votes").hide(); + $(".votation-type-max-votes").prop("disabled", true); } }, initialize: function() { diff --git a/app/components/admin/votation_types/fields_component.html.erb b/app/components/admin/votation_types/fields_component.html.erb index f55d74579..89183ee8b 100644 --- a/app/components/admin/votation_types/fields_component.html.erb +++ b/app/components/admin/votation_types/fields_component.html.erb @@ -4,12 +4,9 @@