webs 0.1.43 → 0.1.44

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
3
3
  require 'rake'
4
4
  require 'echoe'
5
5
 
6
- Echoe.new('webs', '0.1.43') do |p|
6
+ Echoe.new('webs', '0.1.44') do |p|
7
7
  p.description = "Reusable webs stuff."
8
8
  p.url = "https://colczak@github.com/websdev/websgem.git"
9
9
  p.author = "Chuck Olczak"
@@ -1,3 +1,4 @@
1
+ if Rails::VERSION::STRING[0].to_i < 3
1
2
  # adds the fw:intl tag to options values
2
3
  module ActionView
3
4
  module Helpers
@@ -37,4 +38,53 @@ module ActionView
37
38
  end
38
39
  end
39
40
 
41
+ else
42
+ # ======================================================================================
43
+ # RAILS 3
44
+ #
40
45
 
46
+ module ActionView
47
+ module Helpers
48
+ class FormBuilder
49
+ def intl_select(method, choices, options = {}, html_options = {})
50
+ @template.intl_select(@object_name, method, choices, objectify_options(options), @default_options.merge(html_options))
51
+ end
52
+ end
53
+ module FormOptionsHelper
54
+ def intl_options_for_select(container, selected = nil)
55
+ return container if String === container
56
+
57
+ container = container.to_a if Hash === container
58
+ selected, disabled = extract_selected_and_disabled(selected).map do | r |
59
+ Array.wrap(r).map { |item| item.to_s }
60
+ end
61
+
62
+ container.map do |element|
63
+ html_attributes = option_html_attributes(element)
64
+ text, value = option_text_and_value(element).map { |item| item.to_s }
65
+ selected_attribute = ' selected="selected"' if option_value_selected?(value, selected)
66
+ disabled_attribute = ' disabled="disabled"' if disabled && option_value_selected?(value, disabled)
67
+ %(<option value="#{html_escape(value)}"#{selected_attribute}#{disabled_attribute}#{html_attributes}><fw:intl>#{html_escape(text)}</fw:intl></option>)
68
+ end.join("\n").html_safe
69
+ end
70
+ def intl_select(object, method, choices, options = {}, html_options = {})
71
+ InstanceTag.new(object, method, self, options.delete(:object)).to_intl_select_tag(choices, options, html_options)
72
+ end
73
+ end
74
+
75
+ class InstanceTag #:nodoc:
76
+ include FormOptionsHelper
77
+ def to_intl_select_tag(choices, options, html_options)
78
+ html_options = html_options.stringify_keys
79
+ add_default_name_and_id(html_options)
80
+ value = value(object)
81
+ selected_value = options.has_key?(:selected) ? options[:selected] : value
82
+ disabled_value = options.has_key?(:disabled) ? options[:disabled] : nil
83
+ content_tag("select", add_options(intl_options_for_select(choices, :selected => selected_value, :disabled => disabled_value), options, selected_value), html_options)
84
+ end
85
+ end
86
+ end
87
+ end
88
+
89
+
90
+ end
data/lib/webs.rb CHANGED
@@ -7,7 +7,7 @@ require dir + 'helper/params'
7
7
  require dir + 'helper/tags'
8
8
 
9
9
  module Webs
10
- VERSION = '0.1.43'.freeze
10
+ VERSION = '0.1.44'.freeze
11
11
 
12
12
  def self.app_title
13
13
  APP_NAME.titleize
data/webs.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{webs}
5
- s.version = "0.1.43"
5
+ s.version = "0.1.44"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Chuck Olczak"]
9
- s.date = %q{2011-06-08}
9
+ s.date = %q{2011-06-09}
10
10
  s.description = %q{Reusable webs stuff.}
11
11
  s.email = %q{chuck@webs.com}
12
12
  gemfiles = Dir.glob( "**/*.{erb,rb,rdoc}" )
metadata CHANGED
@@ -1,31 +1,22 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: webs
3
- version: !ruby/object:Gem::Version
4
- hash: 77
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.44
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 43
10
- version: 0.1.43
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Chuck Olczak
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-06-08 00:00:00 -04:00
12
+ date: 2011-06-09 00:00:00.000000000 -04:00
19
13
  default_executable:
20
14
  dependencies: []
21
-
22
15
  description: Reusable webs stuff.
23
16
  email: chuck@webs.com
24
17
  executables: []
25
-
26
18
  extensions: []
27
-
28
- extra_rdoc_files:
19
+ extra_rdoc_files:
29
20
  - lib/views/layouts/webs_page.html.erb
30
21
  - lib/views/layouts/webs_utility.html.erb
31
22
  - lib/views/shared/_error_msgs.html.erb
@@ -50,7 +41,7 @@ extra_rdoc_files:
50
41
  - lib/test/webs_test_helper.rb
51
42
  - lib/webs.rb
52
43
  - README.rdoc
53
- files:
44
+ files:
54
45
  - lib/views/layouts/webs_page.html.erb
55
46
  - lib/views/layouts/webs_utility.html.erb
56
47
  - lib/views/shared/_error_msgs.html.erb
@@ -80,42 +71,32 @@ files:
80
71
  has_rdoc: true
81
72
  homepage: http://github.com/websdotcom/websgem
82
73
  licenses: []
83
-
84
74
  post_install_message:
85
- rdoc_options:
75
+ rdoc_options:
86
76
  - --line-numbers
87
77
  - --inline-source
88
78
  - --title
89
79
  - Webs
90
80
  - --main
91
81
  - README.rdoc
92
- require_paths:
82
+ require_paths:
93
83
  - lib
94
- required_ruby_version: !ruby/object:Gem::Requirement
84
+ required_ruby_version: !ruby/object:Gem::Requirement
95
85
  none: false
96
- requirements:
97
- - - ">="
98
- - !ruby/object:Gem::Version
99
- hash: 3
100
- segments:
101
- - 0
102
- version: "0"
103
- required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
91
  none: false
105
- requirements:
106
- - - ">="
107
- - !ruby/object:Gem::Version
108
- hash: 11
109
- segments:
110
- - 1
111
- - 2
112
- version: "1.2"
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '1.2'
113
96
  requirements: []
114
-
115
97
  rubyforge_project: webs
116
98
  rubygems_version: 1.6.2
117
99
  signing_key:
118
100
  specification_version: 3
119
101
  summary: Reusable webs stuff.
120
102
  test_files: []
121
-