Permalink
Browse files

Only label a checkbox once

By default, put the label inside the html <label>
If for some reason it's desired to go outside, specify the :label_outside option
  • Loading branch information...
1 parent 9b483c8 commit 22af072a124d147350130abedf2456ba6cce39cb @cluesque cluesque committed Dec 2, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/formtastic-bootstrap/inputs/boolean_input.rb
@@ -6,7 +6,7 @@ class BooleanInput < Formtastic::Inputs::BooleanInput
def to_html
control_group_wrapping do
- control_label_html <<
+ options[:label_outside] ? control_label_html : "".html_safe <<
hidden_field_html <<
controls_wrapping do
label_with_nested_checkbox
@@ -17,7 +17,7 @@ def to_html
def label_with_nested_checkbox
builder.label(
method,
- label_text_with_embedded_checkbox,
+ options[:label_outside] ? check_box_html : label_text_with_embedded_checkbox,
label_html_options.tap do |options|
options[:class] << "checkbox"
end

0 comments on commit 22af072

Please sign in to comment.