From 789476e6ab5dca24099e16b65610fe87abed4b2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 8 Jan 2019 20:34:55 +0100 Subject: [PATCH] Synchronize percentage for new progress bars According to the HTML specification: > The default value is the minimum plus half the difference between the > minimum and the maximum, unless the maximum is less than the minimum, > in which case the default value is the minimum. So for new progress bars, we had a numeric value of `nil` and a range value of `50`, meaning the input fields weren't in sync. Manually triggering the event on the progress, while not an ideal solution (ideally we would be able to define `0` as default), sets the value of the numeric field. --- app/assets/javascripts/forms.js.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/assets/javascripts/forms.js.coffee b/app/assets/javascripts/forms.js.coffee index aa7c4818f..3562335a4 100644 --- a/app/assets/javascripts/forms.js.coffee +++ b/app/assets/javascripts/forms.js.coffee @@ -28,6 +28,8 @@ App.Forms = input: -> $("[name='#{this.name}']").val($(this).val()) + $("[name='progress_bar[percentage]'][type='range']").trigger("input") + hideOrShowFieldsAfterSelection: -> $("[name='progress_bar[kind]']").on change: ->