yui-on-rails 0.1.11 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.11
1
+ 0.1.12
data/lib/yui-on-rails.rb CHANGED
@@ -1,2 +1,3 @@
1
1
  require File.join(File.dirname(__FILE__), *%w[yui-on-rails tabs])
2
- require File.join(File.dirname(__FILE__), *%w[yui-on-rails prototype_helper])
2
+ require File.join(File.dirname(__FILE__), *%w[yui-on-rails prototype_helper])
3
+ require File.join(File.dirname(__FILE__), *%w[yui-on-rails radio_buttons])
@@ -0,0 +1,42 @@
1
+ module YuiOnRails
2
+ module RadioButtons
3
+ def radio_buttons_for(*options, &block)
4
+ radio_buttons = YuiOnRails::RadioButtons::RadioButtonsRenderer.new(*options, &block)
5
+ radios_html = radio_buttons.render
6
+ return concat(radios_html)
7
+ end
8
+
9
+ class RadioButtonsRenderer
10
+
11
+ def initialize( options={}, &block )
12
+ raise ArgumentError, "Missing block" unless block_given?
13
+ @template = eval( 'self', block.binding )
14
+ @options = options
15
+ @radio_buttons = []
16
+ yield self
17
+ end
18
+
19
+ def create(button_name,button_text,options={})
20
+ raise "You must provide a button name dummy.#CREATE" if button_name.blank?
21
+ @radio_buttons << [button_name,button_text, options]
22
+ end
23
+
24
+ def render
25
+ content_tag(:div,render_bodies,{:id=>"button_group", :class=>"yui-buttongroup"}.merge(@options))
26
+ end
27
+
28
+ private # ---------------------------------------------------------------------------
29
+ def render_bodies
30
+ #content_tag :div, :class=>"yui-content" do
31
+ @radio_buttons.collect do |radio_button|
32
+ radio_button_tag(radio_buttons[0], radio_buttons[1], false, radio_buttons[2])
33
+ end.join.to_s
34
+ #end
35
+ end
36
+ def method_missing( *args, &block )
37
+ @template.send( *args, &block )
38
+ end
39
+
40
+ end
41
+ end
42
+ end
data/yui-on-rails.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{yui-on-rails}
8
- s.version = "0.1.11"
8
+ s.version = "0.1.12"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["jeff durand"]
12
- s.date = %q{2010-04-18}
12
+ s.date = %q{2010-04-28}
13
13
  s.description = %q{Quite a few helpers for yui.}
14
14
  s.email = %q{jeff.durand@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
27
27
  "generators/yui_on_rails_generator.rb",
28
28
  "lib/yui-on-rails.rb",
29
29
  "lib/yui-on-rails/prototype_helper.rb",
30
+ "lib/yui-on-rails/radio_buttons.rb",
30
31
  "lib/yui-on-rails/tabs.rb",
31
32
  "rails/init.rb",
32
33
  "test/helper.rb",
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 11
9
- version: 0.1.11
8
+ - 12
9
+ version: 0.1.12
10
10
  platform: ruby
11
11
  authors:
12
12
  - jeff durand
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-18 00:00:00 -04:00
17
+ date: 2010-04-28 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -49,6 +49,7 @@ files:
49
49
  - generators/yui_on_rails_generator.rb
50
50
  - lib/yui-on-rails.rb
51
51
  - lib/yui-on-rails/prototype_helper.rb
52
+ - lib/yui-on-rails/radio_buttons.rb
52
53
  - lib/yui-on-rails/tabs.rb
53
54
  - rails/init.rb
54
55
  - test/helper.rb