diff --git a/app/assets/javascripts/legislation_admin.js b/app/assets/javascripts/legislation_admin.js index c4692014f..45d8723f4 100644 --- a/app/assets/javascripts/legislation_admin.js +++ b/app/assets/javascripts/legislation_admin.js @@ -2,21 +2,21 @@ "use strict"; App.LegislationAdmin = { initialize: function() { - $("input[type='checkbox'][data-disable-date]").on({ + $(".legislation-process-form").find("[name$='enabled]'],[name$='[published]']").on({ change: function() { - var checkbox, date_selector, parent; + var checkbox; checkbox = $(this); - parent = $(this).parents(".row:eq(0)"); - date_selector = $(this).data("disable-date"); - parent.find("input[type='text'][id^='" + date_selector + "']").each(function() { + + checkbox.closest("fieldset").find("input[type='text']").each(function() { if (checkbox.is(":checked")) { $(this).removeAttr("disabled"); } else { - $(this).val(""); + $(this).prop("disabled", true); } }); } - }); + }).trigger("change"); + $("#nested_question_options").on("cocoon:after-insert", function() { App.Globalize.refresh_visible_translations(); }); diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 7aca741dd..da217b874 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -13,6 +13,7 @@ @import "dashboard"; @import "legislation"; @import "legislation_process"; +@import "legislation_process_form"; @import "community"; @import "stats"; @import "custom"; diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index dabfb2330..c089d3b3d 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -1074,6 +1074,10 @@ form { &.error { margin-bottom: rem-calc(1); } + + &:disabled { + background-color: $input-background-disabled; + } } [type="checkbox"] + label, diff --git a/app/assets/stylesheets/legislation_process_form.scss b/app/assets/stylesheets/legislation_process_form.scss new file mode 100644 index 000000000..14ccdf86e --- /dev/null +++ b/app/assets/stylesheets/legislation_process_form.scss @@ -0,0 +1,35 @@ +.legislation-process-form { + fieldset { + margin: $fieldset-padding 0; + padding-bottom: $fieldset-padding; + position: relative; + + &::after { + border-bottom: $fieldset-border; + bottom: 0; + content: ""; + display: block; + margin-left: rem-calc(16); + position: absolute; + width: calc(100% - #{2 * rem-calc(16)}); + + @include breakpoint(small only) { + margin-left: rem-calc(10); + width: calc(100% - #{2 * rem-calc(10)}); + } + } + + > :last-child { + float: left !important; + } + + legend { + margin-bottom: 0; + + > * { + display: block; + font-weight: normal; + } + } + } +} diff --git a/app/views/admin/legislation/processes/_form.html.erb b/app/views/admin/legislation/processes/_form.html.erb index 9c5945334..16bfb5daf 100644 --- a/app/views/admin/legislation/processes/_form.html.erb +++ b/app/views/admin/legislation/processes/_form.html.erb @@ -1,14 +1,14 @@ <%= render "shared/globalize_locales", resource: @process %> -<%= translatable_form_for [:admin, @process] do |f| %> +<%= translatable_form_for [:admin, @process], html: { class: "legislation-process-form" } do |f| %> <%= render "shared/errors", resource: @process %> -
<%= t("admin.legislation.processes.form.draft_phase_description") %>
-