Class: FlexaFormtasticBootstrap::Inputs::LookupInput
- Inherits:
-
Formtastic::Inputs::StringInput
- Object
- Formtastic::Inputs::StringInput
- FlexaFormtasticBootstrap::Inputs::LookupInput
- Includes:
- Base, Base::Stringish
- Defined in:
- lib/flexa_formtastic_bootstrap/inputs/lookup_input.rb
Overview
class LookupInput < FlexaFormtasticBootstrap::Inputs::StringInput
Instance Method Summary collapse
Methods included from Base::Wrapping
#clearfix_div_wrapping, #generic_input_wrapping, #inline_inputs_div_wrapping, #input_div_wrapping, #prepended_input_wrapping
Methods included from Base::Html
Methods included from Base::Hints
Methods included from Base::Errors
#error_first_html, #error_html, #error_list_html, #error_none_html, #error_sentence_html
Instance Method Details
#label_html_options ⇒ Object
39 40 41 42 43 44 |
# File 'lib/flexa_formtastic_bootstrap/inputs/lookup_input.rb', line 39 def {}.tap do |opts| opts[:for] ||= [:id] opts[:class] = [opts[:class]] end end |
#to_html ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/flexa_formtastic_bootstrap/inputs/lookup_input.rb', line 8 def to_html lookup_feedback_fields = Array.new lookup_feedback_fields<<method lookup_feedback_fields<<[:lookup][:display] lookup_feedback_fields = lookup_feedback_fields+[:lookup][:fill].to_a if ([:lookup][:fill].present?&&[:lookup][:fill].count>0) lookup_url = [:lookup][:route]+"?fill="+lookup_feedback_fields.join(",") generic_input_wrapping do ihtml_display = ihtml_display[:readonly]=true if ![:readonly] ihtml_display[:class] = "readonly" end ihtml_display[:style]="background-color: white;border: 1px solid #CCC;" if ![:readonly] ihtml_display[:id]=[:lookup][:display] str = builder.text_field([:lookup][:display], ihtml_display) if ![:readonly] str = str << template.link_to(template.content_tag("i", "",:class=>"icon-search icon-white"),"#"+'div_'+method.to_s, {:target=>"_blank",:class=>"btn btn-info btnlookup","data-toggle"=>"modal"})<< builder.hidden_field(method, {:id=>method}) iframe = template.content_tag(:iframe,"",:src=>lookup_url,:marginheight=>0,:height=>"350",:width=>"100%",:frameborder=>"0") str << template.content_tag(:div,iframe,:id=>'div_'+method.to_s,:class=>"modal hide fade",:style=>"display: none; ") end #se for usar sem o Bootstrap voltar para a linha abaixo #label_html << template.content_tag(:div,str,:style=>"margin:0;padding:0;display:inline") template.content_tag(:div,str,:style=>"margin:0;padding:0;display:inline") end end |
#wrapper_html_options ⇒ Object
46 47 48 |
# File 'lib/flexa_formtastic_bootstrap/inputs/lookup_input.rb', line 46 def super.merge(:class => "#{super[:class]}" ) end |