Sha256: 0bb1c0e2065ea9892d16467c1ba572ee020ee675752b971c0d98d46168860023
Contents?: true
Size: 1.23 KB
Versions: 13
Compression:
Stored size: 1.23 KB
Contents
module Formtastic module Inputs class BlazeToggleInput < Formtastic::Inputs::BooleanInput include Formtastic::Inputs::Base # def to_html # input_wrapping do # # hidden_field_html << # label_html << # builder.check_box( method, input_html_options ) # # label_with_nested_checkbox # end # end def to_html input_wrapping do toggle_label << hidden_field_html << toggle_checkbox end end def toggle_label builder.label( method ) end def toggle_checkbox builder.label( method, label_with_embedded_checkbox, label_html_options ) end def label_html_options super.merge( for: input_html_options[:id], class: ['c-toggle', input_html_options[:toggle_class] ] - ['label'] ) end def label_with_embedded_checkbox check_box_html << "" << toggle_html # << label_text end def toggle_html template.content_tag( :div, Formtastic::Util.html_safe( template.content_tag( :div, '', class: 'c-toggle__handle' ) ), class: 'c-toggle__track' ) end end end end
Version data entries
13 entries across 13 versions & 1 rubygems