Sha256: 83b00d15724ab4808f1a8059a15f0cdc482e92d8d46dad085bf07bda22a0455f
Contents?: true
Size: 1.23 KB
Versions: 3
Compression:
Stored size: 1.23 KB
Contents
module AutocompleteHelper def p_autocomplete(name, value = nil, options = {}) output = autocomplete_encode_markup(name, value, options) output += autocomplete_encode_script(name, value, options) end protected def autocomplete_encode_markup(name, value = nil, options = {}) options = options.stringify_keys clientid = sanitize_to_id(name) options.delete('completeSource') options.delete('content') output = tag :input, { "type" => "text", "name" => name, "id" => clientid, "value" => value }.update(options.stringify_keys) output.html_safe end def autocomplete_encode_script(name, value = nil, options = {}) options = options.stringify_keys clientid = sanitize_to_id(name) widgetvar = options.has_key?("widgetVar") ? options["widgetVar"] : "widget_"+clientid options_ui = options options_ui = options_ui.merge(:id => clientid) options_ui = options_ui.to_json script = '$(function() {' script += "PrimeFaces.cw('Autocomplete','#{widgetvar}',#{options_ui})" script += '});' p_javascript_tag(script, "id" => clientid+"_s") end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
prime-rails-0.0.16 | app/helpers/autocomplete_helper.rb |
prime-rails-0.0.15 | app/helpers/autocomplete_helper.rb |
prime-rails-0.0.14 | app/helpers/autocomplete_helper.rb |