tabs_on_rails 2.0.2 → 2.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/.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
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Appraisals
ADDED
@@ -1,7 +1,19 @@
|
|
1
|
-
|
1
|
+
# Changelog
|
2
2
|
|
3
3
|
|
4
|
-
|
4
|
+
## Release 2.1.1
|
5
|
+
|
6
|
+
* FIXED: An invalid replace command caused a bug in 2.1.0.
|
7
|
+
|
8
|
+
|
9
|
+
## Release 2.1.0
|
10
|
+
|
11
|
+
* NEW: Support for Rails 3.2.
|
12
|
+
|
13
|
+
* FIXED: Fixed Rails 3.2 ActiveSupport::Concern deprecation warning (GH-18).
|
14
|
+
|
15
|
+
|
16
|
+
## Release 2.0.2
|
5
17
|
|
6
18
|
* NEW: Added support for nested tabs and ability
|
7
19
|
to pass a block to the #tab_for method (#12, #9, #11).
|
@@ -12,41 +24,41 @@
|
|
12
24
|
* CHANGED: Removed deprecated #has_rdoc= RubyGems attribute.
|
13
25
|
|
14
26
|
|
15
|
-
|
27
|
+
## Release 2.0.1
|
16
28
|
|
17
29
|
* NEW: Added support for rubygems-test.
|
18
30
|
|
19
31
|
|
20
|
-
|
32
|
+
## Release 2.0.0
|
21
33
|
|
22
34
|
Nothing changed. No longer a --pre release.
|
23
35
|
|
24
36
|
|
25
|
-
|
37
|
+
## Release 2.0.0.pre2
|
26
38
|
|
27
39
|
* FIXED: Fixed permission error (#8)
|
28
40
|
|
29
41
|
|
30
|
-
|
42
|
+
## Release 2.0.0.pre
|
31
43
|
|
32
44
|
* CHANGED: Dropped support for Rails 2.
|
33
45
|
|
34
46
|
* CHANGED: Remove "Incomplete `close_tabs' definition" warning. open_tabs/close_tabs can now have zero or more arguments.
|
35
47
|
|
36
48
|
|
37
|
-
|
49
|
+
## Release 1.3.2
|
38
50
|
|
39
51
|
* CHANGED: Use Bundler to declare dependencies.
|
40
52
|
|
41
53
|
* FIXED: Some Rails 2 user can experience a NoMethodError: undefined method `html_safe'.
|
42
54
|
|
43
55
|
|
44
|
-
|
56
|
+
## Release 1.3.1
|
45
57
|
|
46
58
|
* FIXED: Error wrong number of arguments (2 for 3) (closes #3)
|
47
59
|
|
48
60
|
|
49
|
-
|
61
|
+
## Release 1.3.0
|
50
62
|
|
51
63
|
* NEW: Ability to customize the behavior and the style of the li tab item
|
52
64
|
passing a hash of options.
|
@@ -63,7 +75,7 @@ Nothing changed. No longer a --pre release.
|
|
63
75
|
</ul>
|
64
76
|
|
65
77
|
|
66
|
-
|
78
|
+
## Release 1.2.0
|
67
79
|
|
68
80
|
* NEW: Rails 3 compatibility.
|
69
81
|
|
@@ -72,7 +84,7 @@ Nothing changed. No longer a --pre release.
|
|
72
84
|
* CHANGED: TabsOnRails::Tabs::Builder (and all child classes) now has full access to @options hash.
|
73
85
|
|
74
86
|
|
75
|
-
|
87
|
+
## Release 1.1.0
|
76
88
|
|
77
89
|
* FIXED: Incompatibility with release < 1.0.0 caused by open_tabs and close_tabs methods changes compared to 0.8.0.
|
78
90
|
|
@@ -87,7 +99,7 @@ Nothing changed. No longer a --pre release.
|
|
87
99
|
* REMOVED: Deleted empty install.rb file.
|
88
100
|
|
89
101
|
|
90
|
-
|
102
|
+
## Release 1.0.0
|
91
103
|
|
92
104
|
* NEW: Ability to pass arbitrary options to open_tabs and close_tags method. Thanks to aaronchi (closes #315)
|
93
105
|
|
@@ -96,19 +108,19 @@ Nothing changed. No longer a --pre release.
|
|
96
108
|
First stable release.
|
97
109
|
|
98
110
|
|
99
|
-
|
111
|
+
## Release 0.8.2
|
100
112
|
|
101
113
|
* CHANGED: GitHub Gem Building is Defunct. The gem is now hosted on Gemcutter (see http://github.com/blog/515-gem-building-is-defunct)
|
102
114
|
|
103
115
|
|
104
|
-
|
116
|
+
## Release 0.8.1
|
105
117
|
|
106
118
|
* CHANGED: Controller#set_tab now uses #send instead of #instance_eval (better performance and more security)
|
107
119
|
|
108
120
|
* CHANGED: run test against Rails ~> 2.3.0 but ensure compatibility with Rails 2.2.x.
|
109
121
|
|
110
122
|
|
111
|
-
|
123
|
+
## Release 0.8.0
|
112
124
|
|
113
125
|
* FIXED: Invalid usage of the word namescope instead of namespace.
|
114
126
|
|
@@ -123,7 +135,7 @@ First stable release.
|
|
123
135
|
* REMOVED: Deprecated current_tab setter method. Use set_tab instead.
|
124
136
|
|
125
137
|
|
126
|
-
|
138
|
+
## Release 0.3.0
|
127
139
|
|
128
140
|
* NEW: Support for namespaces in order to manage concurrent tab menus (closes #144).
|
129
141
|
|
@@ -136,7 +148,7 @@ First stable release.
|
|
136
148
|
* CHANGED: Calling tabs_tag with a custom builder as first parameter is now deprecated. Use :builder option instead.
|
137
149
|
|
138
150
|
|
139
|
-
|
151
|
+
## Release 0.2.0
|
140
152
|
|
141
153
|
* NEW: The README file is definitely more useful now, filled up with some basic documentation.
|
142
154
|
|
@@ -145,6 +157,6 @@ First stable release.
|
|
145
157
|
* CHANGED: Removed development version warning (closes #145).
|
146
158
|
|
147
159
|
|
148
|
-
|
160
|
+
## Release 0.1.0
|
149
161
|
|
150
162
|
* Initial version
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
tabs_on_rails (2.1.1)
|
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
|
+
appraisal
|
96
|
+
mocha (~> 0.9.10)
|
97
|
+
rails (>= 3.0)
|
98
|
+
tabs_on_rails!
|
99
|
+
yard
|
data/LICENSE
CHANGED
data/README.md
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# Tabs on Rails
|
2
|
+
|
3
|
+
*TabsOnRails* is a simple Rails plugin for creating tabs and navigation menus. It provides helpers for generating navigation menus with a flexible interface.
|
4
|
+
|
5
|
+
|
6
|
+
## Requirements
|
7
|
+
|
8
|
+
* Rails 3
|
9
|
+
|
10
|
+
Please note
|
11
|
+
|
12
|
+
* TabsOnRails 2.x requires Rails 3. Use TabsOnRails 1.3.x with Rails 2.
|
13
|
+
* TabsOnRails doesn't work with Rails 2.1 or lower
|
14
|
+
([comment](http://www.simonecarletti.com/blog/2009/04/tabsonrails/#comment-2901) and [commit](http://github.com/weppos/tabs_on_rails/commit/d5ae9f401e3d0acc87251fa8957a8625e90ba4b3)).
|
15
|
+
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
[RubyGems](http://rubygems.org) is the preferred way to install *TabsOnRails* and the best way if you want install a stable version.
|
20
|
+
|
21
|
+
$ gem install tabs_on_rails
|
22
|
+
|
23
|
+
Specify the Gem dependency in the [Bundler](http://gembundler.com) `Gemfile`.
|
24
|
+
|
25
|
+
gem "tabs_on_rails"
|
26
|
+
|
27
|
+
Use [Bundler](http://gembundler.com) and the [:git option](http://gembundler.com/v1.0/git.html) if you want to grab the latest version from the Git repository.
|
28
|
+
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
|
32
|
+
In your template use the `tabs_tag` helper to create your tab.
|
33
|
+
|
34
|
+
<%= tabs_tag do |tab| %>
|
35
|
+
<%= tab.home 'Homepage', root_path %>
|
36
|
+
<%= tab.dashboard 'Dashboard', dashboard_path %>
|
37
|
+
<%= tab.account 'Account', account_path %>
|
38
|
+
<% end %>
|
39
|
+
|
40
|
+
The example above produces the following HTML output.
|
41
|
+
|
42
|
+
<ul>
|
43
|
+
<li><a href="/">Homepage</a></li>
|
44
|
+
<li><a href="/dashboard">Dashboard</a></li>
|
45
|
+
<li><a href="/account">Account</a></li>
|
46
|
+
</ul>
|
47
|
+
|
48
|
+
The usage is similar to the Rails route file. You create named tabs with the syntax `tab.name_of_tab`. The name you use creating a tab is the same you're going to refer to in your controller when you want to mark a tab as the current tab.
|
49
|
+
|
50
|
+
Now, if the action belongs to `DashboardController`, the template will automatically render the following HTML code.
|
51
|
+
|
52
|
+
<ul>
|
53
|
+
<li><a href="/">Homepage</a></li>
|
54
|
+
<li class="custom"><span>Dashboard</span></li>
|
55
|
+
<li><a href="/account">Account</a></li>
|
56
|
+
</ul>
|
57
|
+
|
58
|
+
Use the `current_tab` helper method if you need to access the value of current tab in your controller or template.
|
59
|
+
|
60
|
+
class DashboardController < ApplicationController
|
61
|
+
set_tab :dashboard
|
62
|
+
end
|
63
|
+
|
64
|
+
# In your view
|
65
|
+
<p>The name of current tab is <%= current_tab %>.</p>
|
66
|
+
|
67
|
+
Read the [documentation](/code/tabs_on_rails/docs/) to learn more about advanced usage, builders and namespaces.
|
68
|
+
|
69
|
+
|
70
|
+
## Credits
|
71
|
+
|
72
|
+
* [Simone Carletti](http://www.simonecarletti.com/) <weppos@weppos.net> - The Author
|
73
|
+
|
74
|
+
|
75
|
+
## Resources
|
76
|
+
|
77
|
+
* [Homepage](http://www.simonecarletti.com/code/tabs_on_rails)
|
78
|
+
* [Documentation](http://www.simonecarletti.com/code/tabs_on_rails/docs/)
|
79
|
+
* [API](http://rubydoc.info/gems/tabs_on_rails)
|
80
|
+
* [Repository](https://github.com/weppos/tabs_on_rails)
|
81
|
+
* [Issue Tracker](http://github.com/weppos/tabs_on_rails/issues)
|
82
|
+
|
83
|
+
|
84
|
+
## License
|
85
|
+
|
86
|
+
*TabsOnRails* is Copyright (c) 2009-2012 Simone Carletti. This is Free Software distributed under the MIT license.
|
data/Rakefile
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require 'rubygems/package_task'
|
3
2
|
require 'bundler'
|
4
|
-
require '
|
5
|
-
require 'rdoc/task'
|
3
|
+
require 'appraisal'
|
6
4
|
|
7
5
|
$:.unshift(File.dirname(__FILE__) + '/lib')
|
8
6
|
require 'tabs_on_rails/version'
|
@@ -11,19 +9,10 @@ require 'tabs_on_rails/version'
|
|
11
9
|
PKG_NAME = ENV['PKG_NAME'] || "tabs_on_rails"
|
12
10
|
PKG_VERSION = ENV['PKG_VERSION'] || TabsOnRails::VERSION
|
13
11
|
|
14
|
-
if ENV['SNAPSHOT'].to_i == 1
|
15
|
-
PKG_VERSION << "." << Time.now.utc.strftime("%Y%m%d%H%M%S")
|
16
|
-
end
|
17
|
-
|
18
12
|
|
19
13
|
# Run test by default.
|
20
14
|
task :default => :test
|
21
15
|
|
22
|
-
# This builds the actual gem. For details of what all these options
|
23
|
-
# mean, and other ones you can add, check the documentation here:
|
24
|
-
#
|
25
|
-
# http://rubygems.org/read/chapter/20
|
26
|
-
#
|
27
16
|
spec = Gem::Specification.new do |s|
|
28
17
|
s.name = PKG_NAME
|
29
18
|
s.version = PKG_VERSION
|
@@ -34,25 +23,19 @@ spec = Gem::Specification.new do |s|
|
|
34
23
|
s.email = "weppos@weppos.net"
|
35
24
|
s.homepage = "http://www.simonecarletti.com/code/tabs_on_rails"
|
36
25
|
|
37
|
-
|
38
|
-
|
39
|
-
s.extra_rdoc_files = Dir.glob("*.rdoc")
|
40
|
-
s.rdoc_options = %w(--main README.rdoc)
|
41
|
-
|
42
|
-
# Add any extra files to include in the gem (like your README)
|
43
|
-
s.files = %w( Rakefile LICENSE init.rb .gemtest ) + Dir.glob("*.{rdoc,gemspec}") + Dir.glob("{lib,test,rails}/**/*")
|
26
|
+
s.files = `git ls-files`.split("\n")
|
27
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
44
28
|
s.require_paths = %w( lib )
|
45
29
|
|
46
|
-
s.add_development_dependency
|
47
|
-
s.add_development_dependency
|
48
|
-
s.add_development_dependency
|
49
|
-
s.add_development_dependency
|
30
|
+
s.add_development_dependency "rails", ">= 3.0"
|
31
|
+
s.add_development_dependency "appraisal"
|
32
|
+
s.add_development_dependency "mocha", "~> 0.9.10"
|
33
|
+
s.add_development_dependency "yard"
|
50
34
|
end
|
51
35
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
# using GitHub, edit as appropriate.
|
36
|
+
|
37
|
+
require 'rubygems/package_task'
|
38
|
+
|
56
39
|
Gem::PackageTask.new(spec) do |pkg|
|
57
40
|
pkg.gem_spec = spec
|
58
41
|
end
|
@@ -75,24 +58,28 @@ desc "Package the library and generates the gemspec"
|
|
75
58
|
task :package => [:gemspec]
|
76
59
|
|
77
60
|
|
78
|
-
|
61
|
+
require 'rake/testtask'
|
62
|
+
|
79
63
|
Rake::TestTask.new do |t|
|
80
64
|
t.libs << "test"
|
81
65
|
t.test_files = FileList["test/**/*_test.rb"]
|
82
|
-
t.verbose =
|
66
|
+
t.verbose = !!ENV["VERBOSE"]
|
67
|
+
t.warning = !!ENV["WARNING"]
|
83
68
|
end
|
84
69
|
|
85
|
-
# Generate documentation
|
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'
|
91
|
-
end
|
92
70
|
|
71
|
+
require 'yard'
|
72
|
+
require 'yard/rake/yardoc_task'
|
93
73
|
|
94
|
-
|
95
|
-
|
96
|
-
ENV["username"] || raise(ArgumentError, "Missing ssh username")
|
97
|
-
sh "rsync -avz --delete rdoc/ #{ENV["username"]}@code:/var/www/apps/code/#{PKG_NAME}/api"
|
74
|
+
YARD::Rake::YardocTask.new(:yardoc) do |y|
|
75
|
+
y.options = ["--output-dir", "yardoc"]
|
98
76
|
end
|
77
|
+
|
78
|
+
namespace :yardoc do
|
79
|
+
desc "Remove YARD products"
|
80
|
+
task :clobber do
|
81
|
+
rm_r "yardoc" rescue nil
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
task :clobber => "yardoc:clobber"
|