Generate labels for attribute automatically

I'm not sure why it isn't already done by foundation's form builder. It
doesn't make any sense to change an ID of a form field without changing
the `for` attribute of its label.
This commit is contained in:
Javi Martín
2019-10-03 19:09:28 +02:00
parent 8d9cb4d8e3
commit aec84f6522
5 changed files with 22 additions and 11 deletions

View File

@@ -19,8 +19,10 @@
<% progress_options = { min: ProgressBar::RANGE.min, max: ProgressBar::RANGE.max, step: 1 } %>
<div class="row">
<div class="small-12 medium-6 large-2 column">
<%= f.label :percentage %>
<%= f.text_field :percentage, { type: :range,
id: "percentage_range",
label: false,
class: "column" }.merge(progress_options) %>
</div>