Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Commit

Permalink
Hardcode classes for radios / checkboxes
Browse files Browse the repository at this point in the history
These are dynamically inserted, but adding them statically makes for a better perf story – the custom inputs can render immediately instead of waiting for the JS to kick in.
  • Loading branch information
Robin Whittleton committed Nov 29, 2016
1 parent 00b49b7 commit 8551ea0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/verify_form_builder.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
class VerifyFormBuilder < ActionView::Helpers::FormBuilder
# Our custom radio / checkbox implementation
def custom_radio_button key, value, text, attributes = {}
label "#{key}_#{value.to_s.parameterize}", class: 'block-label' do
label "#{key}_#{value.to_s.parameterize}", class: 'block-label selection-button-radio' do
input = radio_button key, value, attributes
"#{input} #{text}".html_safe
end
end

def custom_check_box key, attributes, true_value, false_value, text
label key, class: 'block-label' do
label key, class: 'block-label selection-button-checkbox' do
input = check_box key, attributes, true_value, false_value
"#{input} #{text}".html_safe
end
Expand Down

0 comments on commit 8551ea0

Please sign in to comment.