From 5f9dd605c07da9efa8fec5082a9773a68e8a8030 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Mon, 30 Apr 2012 11:24:01 -0300 Subject: [PATCH] Extract inline_label to a method, tidy up --- lib/simple_form/inputs/boolean_input.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/simple_form/inputs/boolean_input.rb b/lib/simple_form/inputs/boolean_input.rb index 92b8e037..c137dfff 100644 --- a/lib/simple_form/inputs/boolean_input.rb +++ b/lib/simple_form/inputs/boolean_input.rb @@ -3,7 +3,6 @@ module SimpleForm class BooleanInput < Base def input if nested_boolean_style? - inline_label = options[:inline_label] == true ? label_text : options[:inline_label] build_hidden_field_for_checkbox + template.label_tag(nil, :class => "checkbox") { build_check_box_without_hidden_field + inline_label @@ -54,6 +53,11 @@ module SimpleForm :disabled => input_html_options[:disabled]) end + def inline_label + inline_label = options[:inline_label] + inline_label == true ? label_text : inline_label + end + # Booleans are not required by default because in most of the cases # it makes no sense marking them as required. The only exception is # Terms of Use usually presented at most sites sign up screen.