yui-on-rails 0.1.0 → 0.1.1
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.
- data/VERSION +1 -1
- data/lib/yui-on-rails/tabs.rb +71 -25
- data/yui-on-rails.gemspec +56 -0
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/yui-on-rails/tabs.rb
CHANGED
@@ -1,37 +1,83 @@
|
|
1
1
|
# FlickadayYui
|
2
2
|
module YuiOnRails
|
3
3
|
module Tabs
|
4
|
-
|
5
|
-
|
4
|
+
def tabs_for(*options, &block)
|
5
|
+
tabs = YuiOnRails::Tabs::TabsRenderer.new(*options, &block)
|
6
|
+
tabs_html = tabs.render
|
7
|
+
return concat(tabs_html)
|
8
|
+
end
|
6
9
|
|
7
|
-
|
10
|
+
class TabsRenderer
|
11
|
+
|
12
|
+
def initialize( options={}, &block )
|
8
13
|
raise ArgumentError, "Missing block" unless block_given?
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
@@tab_content = []
|
14
|
-
@@tab_titles = []
|
14
|
+
@template = eval( 'self', block.binding )
|
15
|
+
@options = options
|
16
|
+
@tabs = []
|
17
|
+
yield self
|
15
18
|
end
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
21
|
-
return links
|
19
|
+
|
20
|
+
def create(tab_id,tab_text,options={},&block)
|
21
|
+
raise "Block needed for TabsRenderer#CREATE" unless block_given?
|
22
|
+
@tabs << [ tab_id, tab_text, options, block ]
|
22
23
|
end
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
|
25
|
+
def render
|
26
|
+
content_tag(:div,(render_tabs+render_bodies),{:id=>:tabs}.merge(@options))
|
27
|
+
end
|
28
|
+
|
29
|
+
private # ---------------------------------------------------------------------------
|
30
|
+
def render_tabs
|
31
|
+
content_tag :ul do
|
32
|
+
@tabs.collect do |tab|
|
33
|
+
content_tag( :li, link_to( content_tag( :span, tab[1] ), "##{tab[0]}" ) )
|
34
|
+
end.join
|
27
35
|
end
|
28
|
-
return content
|
29
36
|
end
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
37
|
+
|
38
|
+
def render_bodies
|
39
|
+
@tabs.collect do |tab|
|
40
|
+
content_tag( :div, capture( &tab[3] ), tab[2].merge( :id => tab[0] ) )
|
41
|
+
end.join.to_s
|
35
42
|
end
|
43
|
+
|
44
|
+
def method_missing( *args, &block )
|
45
|
+
@template.send( *args, &block )
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
#@@tab_content = []
|
51
|
+
#@@tab_titles = []
|
52
|
+
|
53
|
+
#def yui_tabs(id,&block)
|
54
|
+
# raise ArgumentError, "Missing block" unless block_given?
|
55
|
+
# capture(&block)
|
56
|
+
# concat(content_tag(:div, :class=>"yui-navset tabber", :id=>id) do
|
57
|
+
# content_tag(:ul, yui_get_links, :class=>"yui-nav")+content_tag(:div,yui_get_content,:class=>"yui-content")
|
58
|
+
# end,block.binding)
|
59
|
+
# @@tab_content = []
|
60
|
+
# @@tab_titles = []
|
61
|
+
#end
|
62
|
+
#def yui_get_links
|
63
|
+
# links = ""
|
64
|
+
# @@tab_titles.each_with_index do |title,index|
|
65
|
+
# links += content_tag(:li,link_to(content_tag(:em, title), "#tab#{index}"),:class=>"#{index==0 ? "selected" : ""}")
|
66
|
+
# end
|
67
|
+
# return links
|
68
|
+
#end
|
69
|
+
#def yui_get_content
|
70
|
+
# content = ""
|
71
|
+
# @@tab_content.each_with_index do |cont, index|
|
72
|
+
# content += content_tag(:div, cont.to_s, :id=>"tab#{index}")
|
73
|
+
# end
|
74
|
+
# return content
|
75
|
+
#end
|
76
|
+
#def yui_tab(title, &block)
|
77
|
+
# raise ArgumentError, "Missing block" if title.blank?
|
78
|
+
# raise ArgumentError, "Missing block" unless block_given?
|
79
|
+
# @@tab_content << capture(&block)
|
80
|
+
# @@tab_titles << title
|
81
|
+
#end
|
36
82
|
end
|
37
83
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{yui-on-rails}
|
8
|
+
s.version = "0.1.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["jeff durand"]
|
12
|
+
s.date = %q{2010-04-17}
|
13
|
+
s.description = %q{Quite a few helpers for yui.}
|
14
|
+
s.email = %q{jeff.durand@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"lib/yui-on-rails.rb",
|
27
|
+
"lib/yui-on-rails/tabs.rb",
|
28
|
+
"rails/init.rb",
|
29
|
+
"test/helper.rb",
|
30
|
+
"test/test_yui-on-rails.rb",
|
31
|
+
"yui-on-rails.gemspec"
|
32
|
+
]
|
33
|
+
s.homepage = %q{http://github.com/johnnyiller/yui-on-rails}
|
34
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
35
|
+
s.require_paths = ["lib"]
|
36
|
+
s.rubygems_version = %q{1.3.6}
|
37
|
+
s.summary = %q{Helpers for yui and rails}
|
38
|
+
s.test_files = [
|
39
|
+
"test/helper.rb",
|
40
|
+
"test/test_yui-on-rails.rb"
|
41
|
+
]
|
42
|
+
|
43
|
+
if s.respond_to? :specification_version then
|
44
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
45
|
+
s.specification_version = 3
|
46
|
+
|
47
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
48
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
49
|
+
else
|
50
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
51
|
+
end
|
52
|
+
else
|
53
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- jeff durand
|
@@ -50,6 +50,7 @@ files:
|
|
50
50
|
- rails/init.rb
|
51
51
|
- test/helper.rb
|
52
52
|
- test/test_yui-on-rails.rb
|
53
|
+
- yui-on-rails.gemspec
|
53
54
|
has_rdoc: true
|
54
55
|
homepage: http://github.com/johnnyiller/yui-on-rails
|
55
56
|
licenses: []
|