webs 0.1.42 → 0.1.43

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.42') do |p|
6
+ Echoe.new('webs', '0.1.43') 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"
@@ -0,0 +1,40 @@
1
+ # adds the fw:intl tag to options values
2
+ module ActionView
3
+ module Helpers
4
+ class FormBuilder
5
+ def intl_select(method, choices, options = {}, html_options = {})
6
+ @template.intl_select(@object_name, method, choices, options.merge(:object => @object), html_options)
7
+ end
8
+ end
9
+ module FormOptionsHelper
10
+ def intl_options_for_select(container, selected = nil)
11
+ container = container.to_a if Hash === container
12
+
13
+ options_for_select = container.inject([]) do |options, element|
14
+ text, value = option_text_and_value(element)
15
+ selected_attribute = ' selected="selected"' if option_value_selected?(value, selected)
16
+ options << %(<option value="#{html_escape(value.to_s)}"#{selected_attribute}><fw:intl>#{html_escape(text.to_s)}</fw:intl></option>)
17
+ end
18
+
19
+ options_for_select.join("\n")
20
+ end
21
+ def intl_select(object, method, choices, options = {}, html_options = {})
22
+ InstanceTag.new(object, method, self, nil, options.delete(:object)).to_intl_select_tag(choices, options, html_options)
23
+ end
24
+ end
25
+
26
+ class InstanceTag #:nodoc:
27
+ include FormOptionsHelper
28
+
29
+ def to_intl_select_tag(choices, options, html_options)
30
+ html_options = html_options.stringify_keys
31
+ add_default_name_and_id(html_options)
32
+ value = value(object)
33
+ selected_value = options.has_key?(:selected) ? options[:selected] : value
34
+ content_tag("select", add_options(intl_options_for_select(choices, selected_value), options, selected_value), html_options)
35
+ end
36
+ end
37
+ end
38
+ end
39
+
40
+
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.42'.freeze
10
+ VERSION = '0.1.43'.freeze
11
11
 
12
12
  def self.app_title
13
13
  APP_NAME.titleize
data/webs.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{webs}
5
- s.version = "0.1.42"
5
+ s.version = "0.1.43"
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"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webs
3
3
  version: !ruby/object:Gem::Version
4
- hash: 79
4
+ hash: 77
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 42
10
- version: 0.1.42
9
+ - 43
10
+ version: 0.1.43
11
11
  platform: ruby
12
12
  authors:
13
13
  - Chuck Olczak
@@ -34,6 +34,7 @@ extra_rdoc_files:
34
34
  - lib/views/shared/_webs_info.html.erb
35
35
  - lib/cache/cache.rb
36
36
  - lib/config/initializers/http_accept_patch.rb
37
+ - lib/config/initializers/intl_select.rb
37
38
  - lib/config/initializers/webs_view_path.rb
38
39
  - lib/config/webs_constants.rb
39
40
  - lib/config/webs_initializer.rb
@@ -58,6 +59,7 @@ files:
58
59
  - lib/views/shared/_webs_info.html.erb
59
60
  - lib/cache/cache.rb
60
61
  - lib/config/initializers/http_accept_patch.rb
62
+ - lib/config/initializers/intl_select.rb
61
63
  - lib/config/initializers/webs_view_path.rb
62
64
  - lib/config/webs_constants.rb
63
65
  - lib/config/webs_initializer.rb