Sha256: 1d840da520f2ced0a5cc0a766edff6a9577b513e6e7f1bfd4799852b539e70be
Contents?: true
Size: 1.95 KB
Versions: 20
Compression:
Stored size: 1.95 KB
Contents
module FlexaFormtasticBootstrap module Inputs class LookupInput < FlexaFormtasticBootstrap::Inputs::StringInput def to_html lookup_feedback_fields = Array.new lookup_feedback_fields<<method lookup_feedback_fields<<options[:lookup][:display] lookup_feedback_fields = lookup_feedback_fields+options[:lookup][:fill].to_a if (options[:lookup][:fill].present?&&options[:lookup][:fill].count>0) lookup_url = options[:lookup][:route]+"?fill="+lookup_feedback_fields.join(",") generic_input_wrapping do 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 << template.content_tag(:div,iframe,:id=>'div_'+method.to_s,:class=>"modal hide fade",:style=>"display: none; ") #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 def label_html_options {}.tap do |opts| opts[:for] ||= input_html_options[:id] opts[:class] = [opts[:class]] end end def wrapper_html_options super.merge(:class => "#{super[:class]}" ) end end end end
Version data entries
20 entries across 20 versions & 1 rubygems