tabs_on_rails 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +11 -0
- data/README.rdoc +1 -1
- data/Rakefile +15 -38
- data/lib/tabs_on_rails/action_controller.rb +18 -10
- data/lib/tabs_on_rails/railtie.rb +5 -15
- data/lib/tabs_on_rails/tabs.rb +9 -5
- data/lib/tabs_on_rails/tabs/builder.rb +7 -7
- data/lib/tabs_on_rails/tabs/tabs_builder.rb +7 -7
- data/lib/tabs_on_rails/version.rb +1 -1
- data/tabs_on_rails.gemspec +16 -14
- data/test/test_helper.rb +0 -3
- data/test/{tabs_on_rails → unit}/controller_mixin_test.rb +21 -0
- data/test/unit/tabs/block_builder_test.rb +42 -0
- data/test/{tabs_on_rails → unit}/tabs/builder_test.rb +1 -1
- data/test/{tabs_on_rails → unit}/tabs/tabs_builder_test.rb +0 -0
- data/test/{tabs_on_rails → unit}/tabs_test.rb +15 -0
- data/test/views/working/with_item_block.html.erb +6 -0
- metadata +30 -19
data/CHANGELOG.rdoc
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
= Changelog
|
2
2
|
|
3
3
|
|
4
|
+
== Release 2.0.2
|
5
|
+
|
6
|
+
* NEW: Added support for nested tabs and ability
|
7
|
+
to pass a block to the #tab_for method (#12, #9, #11).
|
8
|
+
|
9
|
+
However, the default TabsBuilder builder does not implement it.
|
10
|
+
Create a custom builder and specify how the block should be rendered.
|
11
|
+
|
12
|
+
* CHANGED: Removed deprecated #has_rdoc= RubyGems attribute.
|
13
|
+
|
14
|
+
|
4
15
|
== Release 2.0.1
|
5
16
|
|
6
17
|
* NEW: Added support for rubygems-test.
|
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -1,11 +1,8 @@
|
|
1
1
|
require 'rubygems'
|
2
|
+
require 'rubygems/package_task'
|
3
|
+
require 'bundler'
|
2
4
|
require 'rake/testtask'
|
3
|
-
require '
|
4
|
-
begin
|
5
|
-
require 'hanna/rdoctask'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rake/rdoctask'
|
8
|
-
end
|
5
|
+
require 'rdoc/task'
|
9
6
|
|
10
7
|
$:.unshift(File.dirname(__FILE__) + '/lib')
|
11
8
|
require 'tabs_on_rails/version'
|
@@ -30,16 +27,13 @@ task :default => :test
|
|
30
27
|
spec = Gem::Specification.new do |s|
|
31
28
|
s.name = PKG_NAME
|
32
29
|
s.version = PKG_VERSION
|
33
|
-
s.summary = "A simple Ruby on Rails plugin for creating and
|
30
|
+
s.summary = "A simple Ruby on Rails plugin for creating tabs and navigation menus."
|
31
|
+
s.description = "TabsOnRails is a simple Rails plugin for creating tabs and navigation menus."
|
32
|
+
|
34
33
|
s.author = "Simone Carletti"
|
35
34
|
s.email = "weppos@weppos.net"
|
36
35
|
s.homepage = "http://www.simonecarletti.com/code/tabs_on_rails"
|
37
|
-
s.description = <<-EOD
|
38
|
-
TabsOnRails is a simple Ruby on Rails plugin for creating and managing Tabs. \
|
39
|
-
It provides helpers for creating tabs with a flexible interface.
|
40
|
-
EOD
|
41
36
|
|
42
|
-
s.has_rdoc = true
|
43
37
|
# You should probably have a README of some kind. Change the filename
|
44
38
|
# as appropriate
|
45
39
|
s.extra_rdoc_files = Dir.glob("*.rdoc")
|
@@ -47,15 +41,11 @@ spec = Gem::Specification.new do |s|
|
|
47
41
|
|
48
42
|
# Add any extra files to include in the gem (like your README)
|
49
43
|
s.files = %w( Rakefile LICENSE init.rb .gemtest ) + Dir.glob("*.{rdoc,gemspec}") + Dir.glob("{lib,test,rails}/**/*")
|
50
|
-
s.require_paths =
|
44
|
+
s.require_paths = %w( lib )
|
51
45
|
|
52
|
-
# If you want to depend on other gems, add them here, along with any
|
53
|
-
# relevant versions
|
54
|
-
# s.add_dependency("some_other_gem", "~> 0.1.0")
|
55
|
-
|
56
|
-
# If your tests use any gems, include them here
|
57
46
|
s.add_development_dependency("bundler")
|
58
|
-
s.add_development_dependency("
|
47
|
+
s.add_development_dependency("hanna-nouveau")
|
48
|
+
s.add_development_dependency("rails", "~> 3.0.6")
|
59
49
|
s.add_development_dependency("mocha", "~> 0.9.10")
|
60
50
|
end
|
61
51
|
|
@@ -63,7 +53,7 @@ end
|
|
63
53
|
# .gemspec file, which is useful if something (i.e. GitHub) will
|
64
54
|
# be automatically building a gem for this project. If you're not
|
65
55
|
# using GitHub, edit as appropriate.
|
66
|
-
|
56
|
+
Gem::PackageTask.new(spec) do |pkg|
|
67
57
|
pkg.gem_spec = spec
|
68
58
|
end
|
69
59
|
|
@@ -93,24 +83,11 @@ Rake::TestTask.new do |t|
|
|
93
83
|
end
|
94
84
|
|
95
85
|
# Generate documentation
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
begin
|
104
|
-
require "rcov/rcovtask"
|
105
|
-
|
106
|
-
desc "Create a code coverage report"
|
107
|
-
Rcov::RcovTask.new do |t|
|
108
|
-
t.test_files = FileList["test/**/*_test.rb"]
|
109
|
-
t.ruby_opts << "-Itest -x mocha,rcov,Rakefile"
|
110
|
-
t.verbose = true
|
111
|
-
end
|
112
|
-
rescue LoadError
|
113
|
-
task :clobber_rcov
|
86
|
+
RDoc::Task.new do |rdoc|
|
87
|
+
rdoc.main = "README.rdoc"
|
88
|
+
rdoc.rdoc_files.include("*.rdoc", "lib/**/*.rb")
|
89
|
+
rdoc.rdoc_dir = "rdoc"
|
90
|
+
rdoc.generator = 'hanna'
|
114
91
|
end
|
115
92
|
|
116
93
|
|
@@ -17,14 +17,13 @@
|
|
17
17
|
module TabsOnRails
|
18
18
|
|
19
19
|
module ActionController
|
20
|
+
extend ActiveSupport::Concern
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
helper_method :current_tab, :current_tab?
|
27
|
-
end
|
22
|
+
included do
|
23
|
+
extend ClassMethods
|
24
|
+
include InstanceMethods
|
25
|
+
helper HelperMethods
|
26
|
+
helper_method :current_tab, :current_tab?
|
28
27
|
end
|
29
28
|
|
30
29
|
module ClassMethods
|
@@ -67,20 +66,23 @@ module TabsOnRails
|
|
67
66
|
protected
|
68
67
|
|
69
68
|
# Sets the value for current tab to given name.
|
70
|
-
# If you need to manage multiple tabs,
|
69
|
+
# If you need to manage multiple tabs,
|
70
|
+
# then you can pass an optional namespace.
|
71
71
|
#
|
72
72
|
# Examples
|
73
73
|
#
|
74
74
|
# set_tab :homepage
|
75
75
|
# set_tab :dashboard, :menu
|
76
76
|
#
|
77
|
+
# Returns nothing.
|
77
78
|
def set_tab(name, namespace = nil)
|
78
79
|
tab_stack[namespace || :default] = name
|
79
80
|
end
|
80
81
|
|
81
82
|
# Returns the value for current tab in the default namespace,
|
82
83
|
# or nil if no tab has been set before.
|
83
|
-
# You can pass <tt>namespace</tt> to get the value
|
84
|
+
# You can pass <tt>namespace</tt> to get the value
|
85
|
+
# of the current tab for a different namespace.
|
84
86
|
#
|
85
87
|
# Examples
|
86
88
|
#
|
@@ -93,11 +95,15 @@ module TabsOnRails
|
|
93
95
|
# current_tab # => :homepage
|
94
96
|
# current_tab :menu # => :dashboard
|
95
97
|
#
|
98
|
+
# Returns the String/Symbol current tab.
|
96
99
|
def current_tab(namespace = nil)
|
97
100
|
tab_stack[namespace || :default]
|
98
101
|
end
|
99
102
|
|
100
|
-
#
|
103
|
+
# Checks if the current tab in <tt>namespace</tt>
|
104
|
+
# matches <tt>name</tt>.
|
105
|
+
#
|
106
|
+
# Returns a Boolean.
|
101
107
|
def current_tab?(name, namespace = nil)
|
102
108
|
current_tab(namespace).to_s == name.to_s
|
103
109
|
end
|
@@ -105,6 +111,8 @@ module TabsOnRails
|
|
105
111
|
# Initializes and/or returns the tab stack.
|
106
112
|
# You won't probably need to use this method directly
|
107
113
|
# unless you are trying to hack the plugin architecture.
|
114
|
+
#
|
115
|
+
# Returns the Hash stack.
|
108
116
|
def tab_stack
|
109
117
|
@tab_stack ||= {}
|
110
118
|
end
|
@@ -16,23 +16,13 @@
|
|
16
16
|
|
17
17
|
module TabsOnRails
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
# initializer "tabs_on_rails.initialize" do
|
22
|
-
# ActiveSupport.on_load :action_controller do
|
23
|
-
# ::ActionController::Base.send :include, TabsOnRails::ActionController
|
24
|
-
# end
|
25
|
-
# end
|
19
|
+
class Railtie < Rails::Railtie
|
20
|
+
initializer "tabs_on_rails.initialize" do
|
26
21
|
end
|
27
22
|
end
|
28
23
|
|
29
24
|
end
|
30
25
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
# There should be a better way to do this!
|
35
|
-
# I can't rely on Railtie#initializer because TabsOnRails::ActionController
|
36
|
-
# provides class methods which should be available when the class
|
37
|
-
# is evaluated.
|
38
|
-
ActionController::Base.send :include, TabsOnRails::ActionController
|
26
|
+
ActiveSupport.on_load(:action_controller) do
|
27
|
+
include TabsOnRails::ActionController
|
28
|
+
end
|
data/lib/tabs_on_rails/tabs.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
#
|
1
|
+
#
|
2
2
|
# = Tabs on Rails
|
3
3
|
#
|
4
4
|
# A simple Ruby on Rails plugin for creating and managing Tabs.
|
5
|
-
#
|
5
|
+
#
|
6
6
|
#
|
7
7
|
# Category:: Rails
|
8
8
|
# Package:: TabsOnRails
|
@@ -37,11 +37,15 @@ module TabsOnRails
|
|
37
37
|
end # end
|
38
38
|
end # end
|
39
39
|
end
|
40
|
-
|
41
|
-
def method_missing(*args)
|
42
|
-
@builder.tab_for(*args)
|
40
|
+
|
41
|
+
def method_missing(*args, &block)
|
42
|
+
@builder.tab_for(*args, &block)
|
43
43
|
end
|
44
44
|
|
45
|
+
|
46
|
+
# Renders the tab stack using the current builder.
|
47
|
+
#
|
48
|
+
# Returns the String HTML content.
|
45
49
|
def render(&block)
|
46
50
|
raise LocalJumpError, "no block given" unless block_given?
|
47
51
|
|
@@ -1,8 +1,8 @@
|
|
1
|
-
#
|
1
|
+
#
|
2
2
|
# = Tabs on Rails
|
3
3
|
#
|
4
4
|
# A simple Ruby on Rails plugin for creating and managing Tabs.
|
5
|
-
#
|
5
|
+
#
|
6
6
|
#
|
7
7
|
# Category:: Rails
|
8
8
|
# Package:: TabsOnRails
|
@@ -17,14 +17,14 @@
|
|
17
17
|
module TabsOnRails
|
18
18
|
class Tabs
|
19
19
|
|
20
|
-
#
|
20
|
+
#
|
21
21
|
# = Builder
|
22
22
|
#
|
23
23
|
# The Builder class represents the interface for any custom Builder.
|
24
|
-
#
|
24
|
+
#
|
25
25
|
# To create a custom Builder, extend this class
|
26
26
|
# and implement the following abstract methods:
|
27
|
-
#
|
27
|
+
#
|
28
28
|
# * <tt>tab_for</tt>
|
29
29
|
#
|
30
30
|
# Optionally, you can override the following methods to customize
|
@@ -48,11 +48,11 @@ module TabsOnRails
|
|
48
48
|
# Returns true if +tab+ is the +current_tab+.
|
49
49
|
#
|
50
50
|
# Examples
|
51
|
-
#
|
51
|
+
#
|
52
52
|
# class MyController < ApplicationController
|
53
53
|
# tab :foo
|
54
54
|
# end
|
55
|
-
#
|
55
|
+
#
|
56
56
|
# current_tab? :foo # => true
|
57
57
|
# current_tab? 'foo' # => true
|
58
58
|
# current_tab? :bar # => false
|
@@ -1,8 +1,8 @@
|
|
1
|
-
#
|
1
|
+
#
|
2
2
|
# = Tabs on Rails
|
3
3
|
#
|
4
4
|
# A simple Ruby on Rails plugin for creating and managing Tabs.
|
5
|
-
#
|
5
|
+
#
|
6
6
|
#
|
7
7
|
# Category:: Rails
|
8
8
|
# Package:: TabsOnRails
|
@@ -19,22 +19,22 @@ module TabsOnRails
|
|
19
19
|
|
20
20
|
#
|
21
21
|
# = Tabs Builder
|
22
|
-
#
|
22
|
+
#
|
23
23
|
# The TabsBuilder is and example of custom Builder.
|
24
24
|
#
|
25
25
|
class TabsBuilder < Builder
|
26
26
|
|
27
27
|
# Returns a link_to +tab+ with +name+ and +options+ if +tab+ is not the current tab,
|
28
28
|
# a simple tab name wrapped by a span tag otherwise.
|
29
|
-
#
|
29
|
+
#
|
30
30
|
# current_tab? :foo # => true
|
31
|
-
#
|
31
|
+
#
|
32
32
|
# tab_for :foo, 'Foo', foo_path
|
33
33
|
# # => "<li class="current"><span>Foo</span></li>"
|
34
|
-
#
|
34
|
+
#
|
35
35
|
# tab_for :bar, 'Bar', bar_path
|
36
36
|
# # => "<li><a href="/link/to/bar">Bar</a></li>"
|
37
|
-
#
|
37
|
+
#
|
38
38
|
# You can pass a hash of <tt>item_options</tt>
|
39
39
|
# to customize the behavior and the style of the li element.
|
40
40
|
#
|
data/tabs_on_rails.gemspec
CHANGED
@@ -2,37 +2,39 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{tabs_on_rails}
|
5
|
-
s.version = "2.0.
|
5
|
+
s.version = "2.0.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
-
s.authors = [
|
9
|
-
s.date = %q{2011-
|
10
|
-
s.description = %q{
|
11
|
-
}
|
8
|
+
s.authors = [%q{Simone Carletti}]
|
9
|
+
s.date = %q{2011-06-29}
|
10
|
+
s.description = %q{TabsOnRails is a simple Rails plugin for creating tabs and navigation menus.}
|
12
11
|
s.email = %q{weppos@weppos.net}
|
13
|
-
s.extra_rdoc_files = [
|
14
|
-
s.files = [
|
12
|
+
s.extra_rdoc_files = [%q{CHANGELOG.rdoc}, %q{README.rdoc}]
|
13
|
+
s.files = [%q{Rakefile}, %q{LICENSE}, %q{init.rb}, %q{.gemtest}, %q{CHANGELOG.rdoc}, %q{README.rdoc}, %q{tabs_on_rails.gemspec}, %q{lib/tabs_on_rails}, %q{lib/tabs_on_rails/action_controller.rb}, %q{lib/tabs_on_rails/railtie.rb}, %q{lib/tabs_on_rails/tabs}, %q{lib/tabs_on_rails/tabs/builder.rb}, %q{lib/tabs_on_rails/tabs/tabs_builder.rb}, %q{lib/tabs_on_rails/tabs.rb}, %q{lib/tabs_on_rails/version.rb}, %q{lib/tabs_on_rails.rb}, %q{test/test_helper.rb}, %q{test/unit}, %q{test/unit/controller_mixin_test.rb}, %q{test/unit/tabs}, %q{test/unit/tabs/block_builder_test.rb}, %q{test/unit/tabs/builder_test.rb}, %q{test/unit/tabs/tabs_builder_test.rb}, %q{test/unit/tabs_test.rb}, %q{test/views}, %q{test/views/working}, %q{test/views/working/default.html.erb}, %q{test/views/working/with_item_block.html.erb}, %q{test/views/working/with_item_options.html.erb}, %q{test/views/working/with_open_close_tabs.html.erb}]
|
15
14
|
s.homepage = %q{http://www.simonecarletti.com/code/tabs_on_rails}
|
16
|
-
s.rdoc_options = [
|
17
|
-
s.require_paths = [
|
18
|
-
s.rubygems_version = %q{1.
|
19
|
-
s.summary = %q{A simple Ruby on Rails plugin for creating and
|
15
|
+
s.rdoc_options = [%q{--main}, %q{README.rdoc}]
|
16
|
+
s.require_paths = [%q{lib}]
|
17
|
+
s.rubygems_version = %q{1.8.3}
|
18
|
+
s.summary = %q{A simple Ruby on Rails plugin for creating tabs and navigation menus.}
|
20
19
|
|
21
20
|
if s.respond_to? :specification_version then
|
22
21
|
s.specification_version = 3
|
23
22
|
|
24
23
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
25
24
|
s.add_development_dependency(%q<bundler>, [">= 0"])
|
26
|
-
s.add_development_dependency(%q<
|
25
|
+
s.add_development_dependency(%q<hanna-nouveau>, [">= 0"])
|
26
|
+
s.add_development_dependency(%q<rails>, ["~> 3.0.6"])
|
27
27
|
s.add_development_dependency(%q<mocha>, ["~> 0.9.10"])
|
28
28
|
else
|
29
29
|
s.add_dependency(%q<bundler>, [">= 0"])
|
30
|
-
s.add_dependency(%q<
|
30
|
+
s.add_dependency(%q<hanna-nouveau>, [">= 0"])
|
31
|
+
s.add_dependency(%q<rails>, ["~> 3.0.6"])
|
31
32
|
s.add_dependency(%q<mocha>, ["~> 0.9.10"])
|
32
33
|
end
|
33
34
|
else
|
34
35
|
s.add_dependency(%q<bundler>, [">= 0"])
|
35
|
-
s.add_dependency(%q<
|
36
|
+
s.add_dependency(%q<hanna-nouveau>, [">= 0"])
|
37
|
+
s.add_dependency(%q<rails>, ["~> 3.0.6"])
|
36
38
|
s.add_dependency(%q<mocha>, ["~> 0.9.10"])
|
37
39
|
end
|
38
40
|
end
|
data/test/test_helper.rb
CHANGED
@@ -113,6 +113,18 @@ class WorkingMixinTestController < ActionController::Base
|
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
+
|
117
|
+
class BlockBuilder < TabsOnRails::Tabs::TabsBuilder
|
118
|
+
def tab_for(tab, name, options, item_options = {}, &block)
|
119
|
+
item_options[:class] = item_options[:class].to_s.split(" ").push("current").join(" ") if current_tab?(tab)
|
120
|
+
content = @context.link_to_unless(current_tab?(tab), name, options) do
|
121
|
+
@context.content_tag(:span, name)
|
122
|
+
end
|
123
|
+
content += @context.capture(&block) if block_given?
|
124
|
+
@context.content_tag(:li, content, item_options)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
116
128
|
end
|
117
129
|
|
118
130
|
class WorkingMixinTest < ActionController::TestCase
|
@@ -142,6 +154,15 @@ class WorkingMixinTest < ActionController::TestCase
|
|
142
154
|
</ul>}, @response.body)
|
143
155
|
end
|
144
156
|
|
157
|
+
def test_render_with_item_block
|
158
|
+
get :action_dashboard, :template => "with_item_block"
|
159
|
+
assert_dom_equal(%Q{<ul>
|
160
|
+
<li class="custom current"><span>Dashboard</span></li>
|
161
|
+
<li class="custom"><a href="/w">Welcome</a>
|
162
|
+
<img src="#image" />
|
163
|
+
</li></ul>}, @response.body)
|
164
|
+
end
|
165
|
+
|
145
166
|
|
146
167
|
def test_set_tab
|
147
168
|
get :action_dashboard
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class BlockBuilderTest < ActionView::TestCase
|
4
|
+
tests TabsOnRails::ActionController::HelperMethods
|
5
|
+
|
6
|
+
include ActionView::Helpers::TagHelper
|
7
|
+
include ActionView::Helpers::UrlHelper
|
8
|
+
|
9
|
+
def current_tab(namespace)
|
10
|
+
case namespace
|
11
|
+
when nil, :default
|
12
|
+
:dashboard
|
13
|
+
when :foospace
|
14
|
+
:footab
|
15
|
+
else
|
16
|
+
:elsetab
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class BlockBuilder < TabsOnRails::Tabs::TabsBuilder
|
21
|
+
def tab_for(tab, name, options, item_options = {}, &block)
|
22
|
+
item_options[:class] = item_options[:class].to_s.split(" ").push("current").join(" ") if current_tab?(tab)
|
23
|
+
content = @context.link_to(name, options)
|
24
|
+
content += @context.capture(&block) if block_given?
|
25
|
+
@context.content_tag(:li, content, item_options)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def setup
|
30
|
+
@klass = BlockBuilder
|
31
|
+
@builder = @klass.new(self)
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_tab_for_with_block
|
35
|
+
expected = %Q{<li class="current"><a href="http://dashboard.com/">Foo Bar</a><p>More Content</p></li>}
|
36
|
+
actual = @builder.tab_for(:dashboard, 'Foo Bar', 'http://dashboard.com/') do
|
37
|
+
content_tag(:p, "More Content")
|
38
|
+
end
|
39
|
+
|
40
|
+
assert_dom_equal expected, actual
|
41
|
+
end
|
42
|
+
end
|
@@ -27,7 +27,7 @@ class BuilderTest < ActiveSupport::TestCase
|
|
27
27
|
def test_initialize_without_context
|
28
28
|
assert_raise(ArgumentError) { TabsOnRails::Tabs::Builder.new }
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
def test_initialize_with_context
|
32
32
|
assert_nothing_raised { TabsOnRails::Tabs::Builder.new(@template) }
|
33
33
|
end
|
File without changes
|
@@ -30,6 +30,15 @@ class TabsTest < ActiveSupport::TestCase
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
BlockBuilder = Class.new(TabsOnRails::Tabs::Builder) do
|
34
|
+
def tab_for(tab, name, options, item_options = {}, &block)
|
35
|
+
item_options[:class] = item_options[:class].to_s.split(" ").push("current").join(" ") if current_tab?(tab)
|
36
|
+
content = @context.link_to(name, options)
|
37
|
+
content += @context.capture(&block) if block_given?
|
38
|
+
@context.content_tag(:li, content, item_options)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
33
42
|
|
34
43
|
def setup
|
35
44
|
@template = Template.new
|
@@ -83,4 +92,10 @@ class TabsTest < ActiveSupport::TestCase
|
|
83
92
|
end
|
84
93
|
end
|
85
94
|
|
95
|
+
|
96
|
+
def test_tab_for
|
97
|
+
assert_equal %Q{<li><a href="#">Welcome</a></li>},
|
98
|
+
@tabs.welcome('Welcome', '#')
|
99
|
+
end
|
100
|
+
|
86
101
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: tabs_on_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 2.0.
|
5
|
+
version: 2.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Simone Carletti
|
@@ -10,12 +10,10 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
14
|
-
default_executable:
|
13
|
+
date: 2011-06-29 00:00:00 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: bundler
|
18
|
-
prerelease: false
|
19
17
|
requirement: &id001 !ruby/object:Gem::Requirement
|
20
18
|
none: false
|
21
19
|
requirements:
|
@@ -23,30 +21,42 @@ dependencies:
|
|
23
21
|
- !ruby/object:Gem::Version
|
24
22
|
version: "0"
|
25
23
|
type: :development
|
24
|
+
prerelease: false
|
26
25
|
version_requirements: *id001
|
27
26
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
29
|
-
prerelease: false
|
27
|
+
name: hanna-nouveau
|
30
28
|
requirement: &id002 !ruby/object:Gem::Requirement
|
31
29
|
none: false
|
32
30
|
requirements:
|
33
|
-
- - "
|
31
|
+
- - ">="
|
34
32
|
- !ruby/object:Gem::Version
|
35
|
-
version:
|
33
|
+
version: "0"
|
36
34
|
type: :development
|
35
|
+
prerelease: false
|
37
36
|
version_requirements: *id002
|
38
37
|
- !ruby/object:Gem::Dependency
|
39
|
-
name:
|
40
|
-
prerelease: false
|
38
|
+
name: rails
|
41
39
|
requirement: &id003 !ruby/object:Gem::Requirement
|
42
40
|
none: false
|
43
41
|
requirements:
|
44
42
|
- - ~>
|
45
43
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.
|
44
|
+
version: 3.0.6
|
47
45
|
type: :development
|
46
|
+
prerelease: false
|
48
47
|
version_requirements: *id003
|
49
|
-
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: mocha
|
50
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.9.10
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *id004
|
59
|
+
description: TabsOnRails is a simple Rails plugin for creating tabs and navigation menus.
|
50
60
|
email: weppos@weppos.net
|
51
61
|
executables: []
|
52
62
|
|
@@ -70,15 +80,16 @@ files:
|
|
70
80
|
- lib/tabs_on_rails/tabs.rb
|
71
81
|
- lib/tabs_on_rails/version.rb
|
72
82
|
- lib/tabs_on_rails.rb
|
73
|
-
- test/tabs_on_rails/controller_mixin_test.rb
|
74
|
-
- test/tabs_on_rails/tabs/builder_test.rb
|
75
|
-
- test/tabs_on_rails/tabs/tabs_builder_test.rb
|
76
|
-
- test/tabs_on_rails/tabs_test.rb
|
77
83
|
- test/test_helper.rb
|
84
|
+
- test/unit/controller_mixin_test.rb
|
85
|
+
- test/unit/tabs/block_builder_test.rb
|
86
|
+
- test/unit/tabs/builder_test.rb
|
87
|
+
- test/unit/tabs/tabs_builder_test.rb
|
88
|
+
- test/unit/tabs_test.rb
|
78
89
|
- test/views/working/default.html.erb
|
90
|
+
- test/views/working/with_item_block.html.erb
|
79
91
|
- test/views/working/with_item_options.html.erb
|
80
92
|
- test/views/working/with_open_close_tabs.html.erb
|
81
|
-
has_rdoc: true
|
82
93
|
homepage: http://www.simonecarletti.com/code/tabs_on_rails
|
83
94
|
licenses: []
|
84
95
|
|
@@ -103,9 +114,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
114
|
requirements: []
|
104
115
|
|
105
116
|
rubyforge_project:
|
106
|
-
rubygems_version: 1.
|
117
|
+
rubygems_version: 1.8.3
|
107
118
|
signing_key:
|
108
119
|
specification_version: 3
|
109
|
-
summary: A simple Ruby on Rails plugin for creating and
|
120
|
+
summary: A simple Ruby on Rails plugin for creating tabs and navigation menus.
|
110
121
|
test_files: []
|
111
122
|
|