galakei 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,51 @@
1
+ module Galakei
2
+ module InputMode
3
+ INPUT_MODES = {
4
+ "alphabet" => {
5
+ :docomo_wap_input_format => "en",
6
+ :other_wap_input_format => 'm',
7
+ :mode => 'alphabet',
8
+ :istyle => '3'
9
+ },
10
+ "hiragana" => {
11
+ :docomo_wap_input_format => 'h',
12
+ :other_wap_input_format => 'M',
13
+ :mode => 'hiragana',
14
+ :istyle => '1'
15
+ },
16
+ "hankaku_kana" => {
17
+ :docomo_wap_input_format => 'hk',
18
+ :other_wap_input_format => 'M',
19
+ :mode => 'hankakukana',
20
+ :istyle => '2'
21
+ },
22
+ "number" => {
23
+ :docomo_wap_input_format => 'n',
24
+ :other_wap_input_format => 'N',
25
+ :mode => 'numeric',
26
+ :istyle => '4'
27
+ }
28
+ }
29
+
30
+ def text_field(object_name, method, options = {})
31
+ if request.galakei?
32
+ inputmode = if options[:type] == "number"
33
+ options.delete(:type)
34
+ else
35
+ options.delete(:inputmode)
36
+ end
37
+ if inputmode = INPUT_MODES[inputmode]
38
+ if request.docomo?
39
+ style = inputmode[:docomo_wap_input_format]
40
+ options[:style] = %Q{-wap-input-format:"*<ja:#{style}>"}
41
+ else
42
+ options[:istyle] = inputmode[:istyle]
43
+ options[:mode] = inputmode[:mode]
44
+ options[:style] ||= %Q{-wap-input-format:*#{inputmode[:other_wap_input_format]};}
45
+ end
46
+ end
47
+ end
48
+ super(object_name, method, options)
49
+ end
50
+ end
51
+ end
@@ -11,6 +11,9 @@ module Galakei
11
11
  filters << :SessionIdParameter if app.config.galakei.session_id_parameter
12
12
  filters.each {|f| Galakei::Filter.const_get(f).inject(self) }
13
13
  end
14
+ ActiveSupport.on_load :action_view do
15
+ include Galakei::InputMode
16
+ end
14
17
  end
15
18
  end
16
19
  end
@@ -0,0 +1,17 @@
1
+ require "action_dispatch/middleware/session/abstract_store"
2
+
3
+ module ActionDispatch
4
+ module Session
5
+ class AbstractStore
6
+ private
7
+ def extract_session_id(env)
8
+ stale_session_check! do
9
+ request = Rack::Request.new(env)
10
+ sid = request.cookies[@key]
11
+ sid ||= request.params[@key] unless @cookie_only
12
+ sid
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
data/lib/galakei.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  if defined?(Rails)
2
2
  require 'galakei/railtie'
3
+ require 'galakei/use_rack_request_to_extract_sid'
3
4
  require 'docomo_css/railtie'
4
5
  end
5
6
  require 'galakei/request'
@@ -7,6 +8,7 @@ require 'galakei/request'
7
8
  module Galakei
8
9
  autoload :Email, "galakei/email"
9
10
  autoload :HelperMethods, "galakei/helper_methods"
11
+ autoload :InputMode, "galakei/input_mode"
10
12
  module Filter
11
13
  autoload :Base, "galakei/filter/base"
12
14
  autoload :ContentType, "galakei/filter/content_type"
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
7
+ - 2
8
8
  - 0
9
- version: 0.1.0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Paul McMahon
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-03 00:00:00 +09:00
18
+ date: 2011-03-04 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -81,9 +81,11 @@ files:
81
81
  - lib/galakei/filter/session_id_parameter.rb
82
82
  - lib/galakei/filter/views.rb
83
83
  - lib/galakei/helper_methods.rb
84
+ - lib/galakei/input_mode.rb
84
85
  - lib/galakei/railtie.rb
85
86
  - lib/galakei/request.rb
86
87
  - lib/galakei/shoulda_macros.rb
88
+ - lib/galakei/use_rack_request_to_extract_sid.rb
87
89
  - lib/galakei.rb
88
90
  has_rdoc: true
89
91
  homepage: http://www.mobalean.com