module FormtasticBootstrap module Inputs class LookupInput < FormtasticBootstrap::Inputs::StringInput def to_html lookup_feedback_fields = Array.new lookup_feedback_fields<0) lookup_url = options[:lookup][:route]+"?fill="+lookup_feedback_fields.join(",") input_wrapping do #options[:lookup].inspect if options[:lookup].present? #ihtml_display = input_html_options ihtml_display = input_html_options ihtml_display[:readonly]=true ihtml_display[:style]="background-color: white;border: 1px solid #CCC;" if !input_html_options[:readonly] ihtml_display[:id]=options[:lookup][:display] str = builder.text_field(options[:lookup][:display], ihtml_display) << 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 = str + template.content_tag(:div,iframe,:id=>'div_'+method.to_s,:class=>"modal hide fade",:style=>"display: none; ") label_html << template.content_tag(:div,str,:style=>"margin:0;padding:0;display:inline") end end def label_html_options {}.tap do |opts| opts[:for] ||= input_html_options[:id] opts[:class] = [opts[:class]] end end #def input_html_options # super.reject { |k, v| [:min, :max, :step].include?(k) } #end def wrapper_html_options super.merge(:class => "#{super[:class]}" ) end #def input_html_options #super.merge(:class => "datePicker") #end end end end