Sha256: 18d8ed81ee81729e7f9887a7b67c2a7c98336ee0111ae8891f5a201ad27e05ea

Contents?: true

Size: 1.41 KB

Versions: 34

Compression:

Stored size: 1.41 KB

Contents

module Galakei
  module InputMode
    INPUT_MODES = {
      "alphabet" => {
        :docomo_wap_input_format => "en",
        :other_wap_input_format => 'm',
        :mode => 'alphabet',
        :istyle => '3'
      },
      "hiragana" => {
        :docomo_wap_input_format => 'h',
        :other_wap_input_format => 'M',
        :mode => 'hiragana',
        :istyle => '1'
      },
      "hankaku_kana" => {
        :docomo_wap_input_format => 'hk',
        :other_wap_input_format => 'M',
        :mode => 'hankakukana',
        :istyle => '2'
      },
      "number" => {
        :docomo_wap_input_format => 'n',
        :other_wap_input_format => 'N',
        :mode => 'numeric',
        :istyle => '4'
      }
    }

    def text_field(object_name, method, options = {})
      if request.galakei?
        inputmode = if options[:type] == "number"
          options.delete(:type)
        else
          options.delete(:inputmode)
        end
        if inputmode = INPUT_MODES[inputmode]
          if request.docomo?
            style = inputmode[:docomo_wap_input_format]
            options[:style] = %Q{-wap-input-format:"*<ja:#{style}>"}
          else
            options[:istyle] = inputmode[:istyle]
            options[:mode] = inputmode[:mode]
            options[:style] ||= %Q{-wap-input-format:*#{inputmode[:other_wap_input_format]}}
          end
        end
      end
      super(object_name, method, options)
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
galakei-0.13.0 lib/galakei/input_mode.rb
galakei-0.12.1 lib/galakei/input_mode.rb
galakei-0.12.0 lib/galakei/input_mode.rb
galakei-0.11.3 lib/galakei/input_mode.rb
galakei-0.11.2 lib/galakei/input_mode.rb
galakei-0.11.1 lib/galakei/input_mode.rb
galakei-0.11.0 lib/galakei/input_mode.rb
galakei-0.10.1 lib/galakei/input_mode.rb
galakei-0.10.0 lib/galakei/input_mode.rb
galakei-0.9.1 lib/galakei/input_mode.rb
galakei-0.9.0 lib/galakei/input_mode.rb
galakei-0.8.1 lib/galakei/input_mode.rb
galakei-0.8.0 lib/galakei/input_mode.rb
galakei-0.7.3 lib/galakei/input_mode.rb
galakei-0.7.2 lib/galakei/input_mode.rb
galakei-0.7.1 lib/galakei/input_mode.rb
galakei-0.7.0 lib/galakei/input_mode.rb
galakei-0.6.6 lib/galakei/input_mode.rb
galakei-0.6.5 lib/galakei/input_mode.rb
galakei-0.6.4 lib/galakei/input_mode.rb