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/assets/stylesheets/polls/form.scss b/app/assets/stylesheets/polls/form.scss index f6129dbf2..eb46dde94 100644 --- a/app/assets/stylesheets/polls/form.scss +++ b/app/assets/stylesheets/polls/form.scss @@ -1,33 +1,42 @@ .poll-form { - fieldset { + fieldset, + .poll-question-open-ended { border: 1px solid $border; border-radius: $global-radius; padding: $line-height; - } - - fieldset + fieldset { - margin-top: calc($line-height / 2); - } - - legend { - @include header-font-size(h3); - float: $global-left; - margin-bottom: 0; + * { - clear: $global-left; + margin-top: calc($line-height / 2); } } + fieldset { + legend { + @include header-font-size(h3); + float: $global-left; + margin-bottom: 0; - label { - @include radio-or-checkbox-and-label-alignment; - font-weight: normal; + + * { + clear: $global-left; + } + } - &:first-of-type::before { - content: "\A"; - margin-top: calc($line-height / 2); - white-space: pre; + label { + @include radio-or-checkbox-and-label-alignment; + font-weight: normal; + + &:first-of-type::before { + content: "\A"; + margin-top: calc($line-height / 2); + white-space: pre; + } + } + } + + .poll-question-open-ended { + label { + @include header-font-size(h3); + line-height: 1.5; } } 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 @@