tabs_on_rails 2.0.2 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/.travis.yml +12 -0
- data/Appraisals +11 -0
- data/{CHANGELOG.rdoc → CHANGELOG.md} +30 -18
- data/Gemfile +3 -0
- data/Gemfile.lock +99 -0
- data/LICENSE +1 -1
- data/README.md +86 -0
- data/Rakefile +27 -40
- data/gemfiles/3.0.gemfile +7 -0
- data/gemfiles/3.0.gemfile.lock +91 -0
- data/gemfiles/3.1.gemfile +7 -0
- data/gemfiles/3.1.gemfile.lock +100 -0
- data/gemfiles/3.2.gemfile +7 -0
- data/gemfiles/3.2.gemfile.lock +100 -0
- data/lib/tabs_on_rails.rb +4 -10
- data/lib/tabs_on_rails/action_controller.rb +64 -73
- data/lib/tabs_on_rails/railtie.rb +3 -10
- data/lib/tabs_on_rails/tabs.rb +4 -10
- data/lib/tabs_on_rails/tabs/builder.rb +3 -10
- data/lib/tabs_on_rails/tabs/tabs_builder.rb +3 -10
- data/lib/tabs_on_rails/version.rb +5 -12
- data/tabs_on_rails.gemspec +21 -22
- data/test/dummy.rb +41 -0
- data/test/test_helper.rb +9 -33
- data/test/unit/{controller_mixin_test.rb → action_controller_test.rb} +0 -0
- data/test/unit/tabs/builder_test.rb +2 -18
- data/test/unit/tabs/tabs_builder_test.rb +3 -20
- data/test/unit/tabs_test.rb +17 -24
- metadata +85 -73
- data/README.rdoc +0 -300
- data/test/unit/tabs/block_builder_test.rb +0 -42
@@ -0,0 +1,91 @@
|
|
1
|
+
PATH
|
2
|
+
remote: /Users/weppos/Code/tabs_on_rails
|
3
|
+
specs:
|
4
|
+
tabs_on_rails (2.0.2)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
abstract (1.0.0)
|
10
|
+
actionmailer (3.0.11)
|
11
|
+
actionpack (= 3.0.11)
|
12
|
+
mail (~> 2.2.19)
|
13
|
+
actionpack (3.0.11)
|
14
|
+
activemodel (= 3.0.11)
|
15
|
+
activesupport (= 3.0.11)
|
16
|
+
builder (~> 2.1.2)
|
17
|
+
erubis (~> 2.6.6)
|
18
|
+
i18n (~> 0.5.0)
|
19
|
+
rack (~> 1.2.1)
|
20
|
+
rack-mount (~> 0.6.14)
|
21
|
+
rack-test (~> 0.5.7)
|
22
|
+
tzinfo (~> 0.3.23)
|
23
|
+
activemodel (3.0.11)
|
24
|
+
activesupport (= 3.0.11)
|
25
|
+
builder (~> 2.1.2)
|
26
|
+
i18n (~> 0.5.0)
|
27
|
+
activerecord (3.0.11)
|
28
|
+
activemodel (= 3.0.11)
|
29
|
+
activesupport (= 3.0.11)
|
30
|
+
arel (~> 2.0.10)
|
31
|
+
tzinfo (~> 0.3.23)
|
32
|
+
activeresource (3.0.11)
|
33
|
+
activemodel (= 3.0.11)
|
34
|
+
activesupport (= 3.0.11)
|
35
|
+
activesupport (3.0.11)
|
36
|
+
appraisal (0.4.0)
|
37
|
+
bundler
|
38
|
+
rake
|
39
|
+
arel (2.0.10)
|
40
|
+
builder (2.1.2)
|
41
|
+
erubis (2.6.6)
|
42
|
+
abstract (>= 1.0.0)
|
43
|
+
i18n (0.5.0)
|
44
|
+
json (1.6.5)
|
45
|
+
mail (2.2.19)
|
46
|
+
activesupport (>= 2.3.6)
|
47
|
+
i18n (>= 0.4.0)
|
48
|
+
mime-types (~> 1.16)
|
49
|
+
treetop (~> 1.4.8)
|
50
|
+
mime-types (1.17.2)
|
51
|
+
mocha (0.9.12)
|
52
|
+
polyglot (0.3.3)
|
53
|
+
rack (1.2.5)
|
54
|
+
rack-mount (0.6.14)
|
55
|
+
rack (>= 1.0.0)
|
56
|
+
rack-test (0.5.7)
|
57
|
+
rack (>= 1.0)
|
58
|
+
rails (3.0.11)
|
59
|
+
actionmailer (= 3.0.11)
|
60
|
+
actionpack (= 3.0.11)
|
61
|
+
activerecord (= 3.0.11)
|
62
|
+
activeresource (= 3.0.11)
|
63
|
+
activesupport (= 3.0.11)
|
64
|
+
bundler (~> 1.0)
|
65
|
+
railties (= 3.0.11)
|
66
|
+
railties (3.0.11)
|
67
|
+
actionpack (= 3.0.11)
|
68
|
+
activesupport (= 3.0.11)
|
69
|
+
rake (>= 0.8.7)
|
70
|
+
rdoc (~> 3.4)
|
71
|
+
thor (~> 0.14.4)
|
72
|
+
rake (0.9.2.2)
|
73
|
+
rdoc (3.12)
|
74
|
+
json (~> 1.4)
|
75
|
+
thor (0.14.6)
|
76
|
+
treetop (1.4.10)
|
77
|
+
polyglot
|
78
|
+
polyglot (>= 0.3.1)
|
79
|
+
tzinfo (0.3.31)
|
80
|
+
yard (0.7.5)
|
81
|
+
|
82
|
+
PLATFORMS
|
83
|
+
ruby
|
84
|
+
|
85
|
+
DEPENDENCIES
|
86
|
+
activerecord (~> 3.0)
|
87
|
+
appraisal
|
88
|
+
mocha (~> 0.9.10)
|
89
|
+
rails (>= 3.0)
|
90
|
+
tabs_on_rails!
|
91
|
+
yard
|
@@ -0,0 +1,100 @@
|
|
1
|
+
PATH
|
2
|
+
remote: /Users/weppos/Code/tabs_on_rails
|
3
|
+
specs:
|
4
|
+
tabs_on_rails (2.0.2)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
actionmailer (3.2.1)
|
10
|
+
actionpack (= 3.2.1)
|
11
|
+
mail (~> 2.4.0)
|
12
|
+
actionpack (3.2.1)
|
13
|
+
activemodel (= 3.2.1)
|
14
|
+
activesupport (= 3.2.1)
|
15
|
+
builder (~> 3.0.0)
|
16
|
+
erubis (~> 2.7.0)
|
17
|
+
journey (~> 1.0.1)
|
18
|
+
rack (~> 1.4.0)
|
19
|
+
rack-cache (~> 1.1)
|
20
|
+
rack-test (~> 0.6.1)
|
21
|
+
sprockets (~> 2.1.2)
|
22
|
+
activemodel (3.2.1)
|
23
|
+
activesupport (= 3.2.1)
|
24
|
+
builder (~> 3.0.0)
|
25
|
+
activerecord (3.2.1)
|
26
|
+
activemodel (= 3.2.1)
|
27
|
+
activesupport (= 3.2.1)
|
28
|
+
arel (~> 3.0.0)
|
29
|
+
tzinfo (~> 0.3.29)
|
30
|
+
activeresource (3.2.1)
|
31
|
+
activemodel (= 3.2.1)
|
32
|
+
activesupport (= 3.2.1)
|
33
|
+
activesupport (3.2.1)
|
34
|
+
i18n (~> 0.6)
|
35
|
+
multi_json (~> 1.0)
|
36
|
+
appraisal (0.4.0)
|
37
|
+
bundler
|
38
|
+
rake
|
39
|
+
arel (3.0.0)
|
40
|
+
builder (3.0.0)
|
41
|
+
erubis (2.7.0)
|
42
|
+
hike (1.2.1)
|
43
|
+
i18n (0.6.0)
|
44
|
+
journey (1.0.1)
|
45
|
+
json (1.6.5)
|
46
|
+
mail (2.4.1)
|
47
|
+
i18n (>= 0.4.0)
|
48
|
+
mime-types (~> 1.16)
|
49
|
+
treetop (~> 1.4.8)
|
50
|
+
mime-types (1.17.2)
|
51
|
+
mocha (0.9.12)
|
52
|
+
multi_json (1.0.4)
|
53
|
+
polyglot (0.3.3)
|
54
|
+
rack (1.4.1)
|
55
|
+
rack-cache (1.1)
|
56
|
+
rack (>= 0.4)
|
57
|
+
rack-ssl (1.3.2)
|
58
|
+
rack
|
59
|
+
rack-test (0.6.1)
|
60
|
+
rack (>= 1.0)
|
61
|
+
rails (3.2.1)
|
62
|
+
actionmailer (= 3.2.1)
|
63
|
+
actionpack (= 3.2.1)
|
64
|
+
activerecord (= 3.2.1)
|
65
|
+
activeresource (= 3.2.1)
|
66
|
+
activesupport (= 3.2.1)
|
67
|
+
bundler (~> 1.0)
|
68
|
+
railties (= 3.2.1)
|
69
|
+
railties (3.2.1)
|
70
|
+
actionpack (= 3.2.1)
|
71
|
+
activesupport (= 3.2.1)
|
72
|
+
rack-ssl (~> 1.3.2)
|
73
|
+
rake (>= 0.8.7)
|
74
|
+
rdoc (~> 3.4)
|
75
|
+
thor (~> 0.14.6)
|
76
|
+
rake (0.9.2.2)
|
77
|
+
rdoc (3.12)
|
78
|
+
json (~> 1.4)
|
79
|
+
sprockets (2.1.2)
|
80
|
+
hike (~> 1.2)
|
81
|
+
rack (~> 1.0)
|
82
|
+
tilt (~> 1.1, != 1.3.0)
|
83
|
+
thor (0.14.6)
|
84
|
+
tilt (1.3.3)
|
85
|
+
treetop (1.4.10)
|
86
|
+
polyglot
|
87
|
+
polyglot (>= 0.3.1)
|
88
|
+
tzinfo (0.3.31)
|
89
|
+
yard (0.7.5)
|
90
|
+
|
91
|
+
PLATFORMS
|
92
|
+
ruby
|
93
|
+
|
94
|
+
DEPENDENCIES
|
95
|
+
activerecord (~> 3.1)
|
96
|
+
appraisal
|
97
|
+
mocha (~> 0.9.10)
|
98
|
+
rails (>= 3.0)
|
99
|
+
tabs_on_rails!
|
100
|
+
yard
|
@@ -0,0 +1,100 @@
|
|
1
|
+
PATH
|
2
|
+
remote: /Users/weppos/Code/tabs_on_rails
|
3
|
+
specs:
|
4
|
+
tabs_on_rails (2.0.2)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
actionmailer (3.2.1)
|
10
|
+
actionpack (= 3.2.1)
|
11
|
+
mail (~> 2.4.0)
|
12
|
+
actionpack (3.2.1)
|
13
|
+
activemodel (= 3.2.1)
|
14
|
+
activesupport (= 3.2.1)
|
15
|
+
builder (~> 3.0.0)
|
16
|
+
erubis (~> 2.7.0)
|
17
|
+
journey (~> 1.0.1)
|
18
|
+
rack (~> 1.4.0)
|
19
|
+
rack-cache (~> 1.1)
|
20
|
+
rack-test (~> 0.6.1)
|
21
|
+
sprockets (~> 2.1.2)
|
22
|
+
activemodel (3.2.1)
|
23
|
+
activesupport (= 3.2.1)
|
24
|
+
builder (~> 3.0.0)
|
25
|
+
activerecord (3.2.1)
|
26
|
+
activemodel (= 3.2.1)
|
27
|
+
activesupport (= 3.2.1)
|
28
|
+
arel (~> 3.0.0)
|
29
|
+
tzinfo (~> 0.3.29)
|
30
|
+
activeresource (3.2.1)
|
31
|
+
activemodel (= 3.2.1)
|
32
|
+
activesupport (= 3.2.1)
|
33
|
+
activesupport (3.2.1)
|
34
|
+
i18n (~> 0.6)
|
35
|
+
multi_json (~> 1.0)
|
36
|
+
appraisal (0.4.0)
|
37
|
+
bundler
|
38
|
+
rake
|
39
|
+
arel (3.0.0)
|
40
|
+
builder (3.0.0)
|
41
|
+
erubis (2.7.0)
|
42
|
+
hike (1.2.1)
|
43
|
+
i18n (0.6.0)
|
44
|
+
journey (1.0.1)
|
45
|
+
json (1.6.5)
|
46
|
+
mail (2.4.1)
|
47
|
+
i18n (>= 0.4.0)
|
48
|
+
mime-types (~> 1.16)
|
49
|
+
treetop (~> 1.4.8)
|
50
|
+
mime-types (1.17.2)
|
51
|
+
mocha (0.9.12)
|
52
|
+
multi_json (1.0.4)
|
53
|
+
polyglot (0.3.3)
|
54
|
+
rack (1.4.1)
|
55
|
+
rack-cache (1.1)
|
56
|
+
rack (>= 0.4)
|
57
|
+
rack-ssl (1.3.2)
|
58
|
+
rack
|
59
|
+
rack-test (0.6.1)
|
60
|
+
rack (>= 1.0)
|
61
|
+
rails (3.2.1)
|
62
|
+
actionmailer (= 3.2.1)
|
63
|
+
actionpack (= 3.2.1)
|
64
|
+
activerecord (= 3.2.1)
|
65
|
+
activeresource (= 3.2.1)
|
66
|
+
activesupport (= 3.2.1)
|
67
|
+
bundler (~> 1.0)
|
68
|
+
railties (= 3.2.1)
|
69
|
+
railties (3.2.1)
|
70
|
+
actionpack (= 3.2.1)
|
71
|
+
activesupport (= 3.2.1)
|
72
|
+
rack-ssl (~> 1.3.2)
|
73
|
+
rake (>= 0.8.7)
|
74
|
+
rdoc (~> 3.4)
|
75
|
+
thor (~> 0.14.6)
|
76
|
+
rake (0.9.2.2)
|
77
|
+
rdoc (3.12)
|
78
|
+
json (~> 1.4)
|
79
|
+
sprockets (2.1.2)
|
80
|
+
hike (~> 1.2)
|
81
|
+
rack (~> 1.0)
|
82
|
+
tilt (~> 1.1, != 1.3.0)
|
83
|
+
thor (0.14.6)
|
84
|
+
tilt (1.3.3)
|
85
|
+
treetop (1.4.10)
|
86
|
+
polyglot
|
87
|
+
polyglot (>= 0.3.1)
|
88
|
+
tzinfo (0.3.31)
|
89
|
+
yard (0.7.5)
|
90
|
+
|
91
|
+
PLATFORMS
|
92
|
+
ruby
|
93
|
+
|
94
|
+
DEPENDENCIES
|
95
|
+
activerecord (~> 3.2)
|
96
|
+
appraisal
|
97
|
+
mocha (~> 0.9.10)
|
98
|
+
rails (>= 3.0)
|
99
|
+
tabs_on_rails!
|
100
|
+
yard
|
data/lib/tabs_on_rails.rb
CHANGED
@@ -1,16 +1,9 @@
|
|
1
|
-
|
2
|
-
#
|
1
|
+
#--
|
2
|
+
# Tabs on Rails
|
3
3
|
#
|
4
4
|
# A simple Ruby on Rails plugin for creating and managing Tabs.
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# Category:: Rails
|
8
|
-
# Package:: TabsOnRails
|
9
|
-
# Author:: Simone Carletti <weppos@weppos.net>
|
10
|
-
# License:: MIT License
|
11
5
|
#
|
12
|
-
|
13
|
-
#
|
6
|
+
# Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
|
14
7
|
#++
|
15
8
|
|
16
9
|
|
@@ -19,6 +12,7 @@ require 'tabs_on_rails/version'
|
|
19
12
|
require 'tabs_on_rails/action_controller'
|
20
13
|
require 'tabs_on_rails/railtie'
|
21
14
|
|
15
|
+
|
22
16
|
module TabsOnRails
|
23
17
|
|
24
18
|
NAME = "Tabs on Rails"
|
@@ -1,16 +1,9 @@
|
|
1
|
-
|
2
|
-
#
|
1
|
+
#--
|
2
|
+
# Tabs on Rails
|
3
3
|
#
|
4
4
|
# A simple Ruby on Rails plugin for creating and managing Tabs.
|
5
5
|
#
|
6
|
-
#
|
7
|
-
# Category:: Rails
|
8
|
-
# Package:: TabsOnRails
|
9
|
-
# Author:: Simone Carletti <weppos@weppos.net>
|
10
|
-
# License:: MIT License
|
11
|
-
#
|
12
|
-
#--
|
13
|
-
#
|
6
|
+
# Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
|
14
7
|
#++
|
15
8
|
|
16
9
|
|
@@ -21,11 +14,66 @@ module TabsOnRails
|
|
21
14
|
|
22
15
|
included do
|
23
16
|
extend ClassMethods
|
24
|
-
include InstanceMethods
|
25
17
|
helper HelperMethods
|
26
18
|
helper_method :current_tab, :current_tab?
|
27
19
|
end
|
28
20
|
|
21
|
+
|
22
|
+
protected
|
23
|
+
|
24
|
+
# Sets the value for current tab to given name.
|
25
|
+
# If you need to manage multiple tabs,
|
26
|
+
# then you can pass an optional namespace.
|
27
|
+
#
|
28
|
+
# Examples
|
29
|
+
#
|
30
|
+
# set_tab :homepage
|
31
|
+
# set_tab :dashboard, :menu
|
32
|
+
#
|
33
|
+
# Returns nothing.
|
34
|
+
def set_tab(name, namespace = nil)
|
35
|
+
tab_stack[namespace || :default] = name
|
36
|
+
end
|
37
|
+
|
38
|
+
# Returns the value for current tab in the default namespace,
|
39
|
+
# or nil if no tab has been set before.
|
40
|
+
# You can pass <tt>namespace</tt> to get the value
|
41
|
+
# of the current tab for a different namespace.
|
42
|
+
#
|
43
|
+
# Examples
|
44
|
+
#
|
45
|
+
# current_tab # => nil
|
46
|
+
# current_tab :menu # => nil
|
47
|
+
#
|
48
|
+
# set_tab :homepage
|
49
|
+
# set_tab :dashboard, :menu
|
50
|
+
#
|
51
|
+
# current_tab # => :homepage
|
52
|
+
# current_tab :menu # => :dashboard
|
53
|
+
#
|
54
|
+
# Returns the String/Symbol current tab.
|
55
|
+
def current_tab(namespace = nil)
|
56
|
+
tab_stack[namespace || :default]
|
57
|
+
end
|
58
|
+
|
59
|
+
# Checks if the current tab in <tt>namespace</tt>
|
60
|
+
# matches <tt>name</tt>.
|
61
|
+
#
|
62
|
+
# Returns a Boolean.
|
63
|
+
def current_tab?(name, namespace = nil)
|
64
|
+
current_tab(namespace).to_s == name.to_s
|
65
|
+
end
|
66
|
+
|
67
|
+
# Initializes and/or returns the tab stack.
|
68
|
+
# You won't probably need to use this method directly
|
69
|
+
# unless you are trying to hack the plugin architecture.
|
70
|
+
#
|
71
|
+
# Returns the Hash stack.
|
72
|
+
def tab_stack
|
73
|
+
@tab_stack ||= {}
|
74
|
+
end
|
75
|
+
|
76
|
+
|
29
77
|
module ClassMethods
|
30
78
|
|
31
79
|
# Sets the value for current tab to given name.
|
@@ -59,64 +107,6 @@ module TabsOnRails
|
|
59
107
|
controller.send(:set_tab, name, namespace)
|
60
108
|
end
|
61
109
|
end
|
62
|
-
|
63
|
-
end
|
64
|
-
|
65
|
-
module InstanceMethods
|
66
|
-
protected
|
67
|
-
|
68
|
-
# Sets the value for current tab to given name.
|
69
|
-
# If you need to manage multiple tabs,
|
70
|
-
# then you can pass an optional namespace.
|
71
|
-
#
|
72
|
-
# Examples
|
73
|
-
#
|
74
|
-
# set_tab :homepage
|
75
|
-
# set_tab :dashboard, :menu
|
76
|
-
#
|
77
|
-
# Returns nothing.
|
78
|
-
def set_tab(name, namespace = nil)
|
79
|
-
tab_stack[namespace || :default] = name
|
80
|
-
end
|
81
|
-
|
82
|
-
# Returns the value for current tab in the default namespace,
|
83
|
-
# or nil if no tab has been set before.
|
84
|
-
# You can pass <tt>namespace</tt> to get the value
|
85
|
-
# of the current tab for a different namespace.
|
86
|
-
#
|
87
|
-
# Examples
|
88
|
-
#
|
89
|
-
# current_tab # => nil
|
90
|
-
# current_tab :menu # => nil
|
91
|
-
#
|
92
|
-
# set_tab :homepage
|
93
|
-
# set_tab :dashboard, :menu
|
94
|
-
#
|
95
|
-
# current_tab # => :homepage
|
96
|
-
# current_tab :menu # => :dashboard
|
97
|
-
#
|
98
|
-
# Returns the String/Symbol current tab.
|
99
|
-
def current_tab(namespace = nil)
|
100
|
-
tab_stack[namespace || :default]
|
101
|
-
end
|
102
|
-
|
103
|
-
# Checks if the current tab in <tt>namespace</tt>
|
104
|
-
# matches <tt>name</tt>.
|
105
|
-
#
|
106
|
-
# Returns a Boolean.
|
107
|
-
def current_tab?(name, namespace = nil)
|
108
|
-
current_tab(namespace).to_s == name.to_s
|
109
|
-
end
|
110
|
-
|
111
|
-
# Initializes and/or returns the tab stack.
|
112
|
-
# You won't probably need to use this method directly
|
113
|
-
# unless you are trying to hack the plugin architecture.
|
114
|
-
#
|
115
|
-
# Returns the Hash stack.
|
116
|
-
def tab_stack
|
117
|
-
@tab_stack ||= {}
|
118
|
-
end
|
119
|
-
|
120
110
|
end
|
121
111
|
|
122
112
|
module HelperMethods
|
@@ -152,7 +142,7 @@ module TabsOnRails
|
|
152
142
|
#
|
153
143
|
# <ul>
|
154
144
|
# <li><a href="/">Homepage</a></li>
|
155
|
-
# <li class="
|
145
|
+
# <li class="current"><span>Dashboard</span></li>
|
156
146
|
# <li><a href="/account">Account</a></li>
|
157
147
|
# </ul>
|
158
148
|
#
|
@@ -175,12 +165,13 @@ module TabsOnRails
|
|
175
165
|
# <%= tabs_tag do |tab| %>
|
176
166
|
# <%= tab.home 'Homepage', root_path, :style => "padding: 10px" %>
|
177
167
|
# <%= tab.dashboard 'Dashboard', dashboard_path %>
|
168
|
+
# <%= tab.account 'Account', account_path, :class => "custom" %>
|
178
169
|
# <% end %>
|
179
170
|
#
|
180
171
|
# <ul>
|
181
172
|
# <li style="padding: 10px"><a href="/">Homepage</a></li>
|
182
|
-
# <li class="
|
183
|
-
# <li><a href="/account">Account</a></li>
|
173
|
+
# <li class="current"><span>Dashboard</span></li>
|
174
|
+
# <li class="custom"><a href="/account">Account</a></li>
|
184
175
|
# </ul>
|
185
176
|
#
|
186
177
|
# You can pass any option supported by the <li>content_tag</li> Rails helper.
|
@@ -212,7 +203,7 @@ module TabsOnRails
|
|
212
203
|
def tabs_tag(options = {}, &block)
|
213
204
|
Tabs.new(self, { :namespace => :default }.merge(options)).render(&block)
|
214
205
|
end
|
215
|
-
|
216
206
|
end
|
207
|
+
|
217
208
|
end
|
218
209
|
end
|