Extract inline_label to a method, tidy up

This commit is contained in:
Carlos Antonio da Silva 2012-04-30 11:24:01 -03:00
parent 51fe90c2ba
commit 5f9dd605c0
1 changed files with 5 additions and 1 deletions

View File

@ -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.