tabit 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +20 -0
- data/.travis.yml +2 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +25 -0
- data/LICENSE.md +20 -0
- data/README.md +23 -0
- data/Rakefile +32 -0
- data/init.rb +1 -0
- data/lib/tabit.rb +19 -0
- data/lib/tabit/builder.rb +43 -0
- data/lib/tabit/cell.rb +6 -0
- data/lib/tabit/config.rb +18 -0
- data/lib/tabit/helper.rb +21 -0
- data/lib/tabit/railtie.rb +7 -0
- data/lib/tabit/version.rb +10 -0
- data/tabit.gemspec +63 -0
- metadata +111 -0
data/.rvmrc
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
environment_id="ruby-1.9.3-head@langwhich"
|
4
|
+
|
5
|
+
if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
|
6
|
+
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
|
7
|
+
then
|
8
|
+
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
9
|
+
|
10
|
+
if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
|
11
|
+
then
|
12
|
+
. "${rvm_path:-$HOME/.rvm}/hooks/after_use"
|
13
|
+
fi
|
14
|
+
else
|
15
|
+
if ! rvm --create use "$environment_id"
|
16
|
+
then
|
17
|
+
echo "Failed to create RVM environment '${environment_id}'."
|
18
|
+
return 1
|
19
|
+
fi
|
20
|
+
fi
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
active_link_to (1.0.0)
|
5
|
+
git (1.2.5)
|
6
|
+
jeweler (1.8.3)
|
7
|
+
bundler (~> 1.0)
|
8
|
+
git (>= 1.2.5)
|
9
|
+
rake
|
10
|
+
rdoc
|
11
|
+
json (1.6.5)
|
12
|
+
rake (0.9.2.2)
|
13
|
+
rdoc (3.12)
|
14
|
+
json (~> 1.4)
|
15
|
+
redcarpet (2.1.0)
|
16
|
+
yard (0.7.5)
|
17
|
+
|
18
|
+
PLATFORMS
|
19
|
+
ruby
|
20
|
+
|
21
|
+
DEPENDENCIES
|
22
|
+
active_link_to (~> 1.0.0)
|
23
|
+
jeweler (~> 1.8.3)
|
24
|
+
redcarpet (~> 2.1.0)
|
25
|
+
yard (~> 0.7.5)
|
data/LICENSE.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Langwhich GmbH <http://www.langwhich.com>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# Tabit [![Build Status](https://secure.travis-ci.org/eifion/tabit.png)](https://secure.travis-ci.org/eifion/tabit.png)
|
2
|
+
|
3
|
+
Tabit is a simple tab menu generator. It depends on `active_link_to`
|
4
|
+
helper. If you dont know how to set an item active take a look at it first.
|
5
|
+
|
6
|
+
## Install
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
gem 'tabit'
|
10
|
+
```
|
11
|
+
|
12
|
+
## Usage
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
= tabit 'nav nav-tabs' do |t|
|
16
|
+
= t.add 'Videos', videos_path
|
17
|
+
= t.add 'Movies', movies_path, :active => /movies(\/\d)*(\/edit)*$/
|
18
|
+
= t.add 'Add movie, new_movies_path, :active => :exclusive
|
19
|
+
```
|
20
|
+
|
21
|
+
## Credits
|
22
|
+
|
23
|
+
Copyright (c) 2011 Langwhich GmbH <http://www.langwhich.com>
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'bundler'
|
5
|
+
Bundler.setup(:default, :development)
|
6
|
+
rescue Bundler::BundlerError => e
|
7
|
+
$stderr.puts e.message
|
8
|
+
$stderr.puts 'Run `bundle install` to install missing gems'
|
9
|
+
exit e.status_code
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'rake'
|
13
|
+
require 'jeweler'
|
14
|
+
require 'yard'
|
15
|
+
|
16
|
+
$:.push File.expand_path('../lib', __FILE__)
|
17
|
+
require 'tabit/version'
|
18
|
+
|
19
|
+
Jeweler::Tasks.new do |gem|
|
20
|
+
gem.name = 'tabit'
|
21
|
+
gem.version = Tabit::Version::STRING
|
22
|
+
gem.homepage = 'https://github.com/Langwhich/tabit'
|
23
|
+
gem.license = 'MIT'
|
24
|
+
gem.summary = %Q{Tabit is a simple tab menu generator}
|
25
|
+
gem.email = 'thomas.boerger@langwhich.com'
|
26
|
+
gem.authors = ['Thomas Boerger', 'Tim Rudat']
|
27
|
+
end
|
28
|
+
|
29
|
+
Jeweler::RubygemsDotOrgTasks.new
|
30
|
+
YARD::Rake::YardocTask.new
|
31
|
+
|
32
|
+
task :default => :version
|
data/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'tabit'
|
data/lib/tabit.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'tabit/railtie' if defined? Rails
|
2
|
+
require 'tabit/cell' if defined? Cell
|
3
|
+
|
4
|
+
module Tabit
|
5
|
+
autoload :Version, 'tabit/version'
|
6
|
+
autoload :Config, 'tabit/config'
|
7
|
+
autoload :Railtie, 'tabit/railtie'
|
8
|
+
autoload :Helper, 'tabit/helper'
|
9
|
+
autoload :Builder, 'tabit/builder'
|
10
|
+
|
11
|
+
def self.configure(&block)
|
12
|
+
@configuration = Tabit::Config.new(&block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.configuration
|
16
|
+
@configuration ||= Tabit::Config.new
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Tabit
|
2
|
+
class Builder
|
3
|
+
include ActionView::Helpers::TagHelper
|
4
|
+
include ActionView::Helpers::CaptureHelper
|
5
|
+
|
6
|
+
attr_accessor :output_buffer
|
7
|
+
attr_accessor :template
|
8
|
+
|
9
|
+
def initialize(template)
|
10
|
+
@template = template
|
11
|
+
end
|
12
|
+
|
13
|
+
def add(name, url = nil, options = {})
|
14
|
+
options[:inner] ||= {}
|
15
|
+
options[:outer] ||= {}
|
16
|
+
|
17
|
+
options[:active] ||= configuration.active_detect
|
18
|
+
url ||= '#'
|
19
|
+
|
20
|
+
clazz = template.active_link_to_class(
|
21
|
+
url,
|
22
|
+
{
|
23
|
+
:active => options[:active],
|
24
|
+
:class_active => configuration.active_class
|
25
|
+
}
|
26
|
+
)
|
27
|
+
|
28
|
+
options[:outer][:class] = '' if options[:outer][:class].nil?
|
29
|
+
options[:outer][:class] << " #{clazz}"
|
30
|
+
options[:outer][:class].strip!
|
31
|
+
|
32
|
+
content_tag(:li, name, options[:outer]) do
|
33
|
+
template.link_to name, url, options[:inner]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
protected
|
38
|
+
def configuration
|
39
|
+
Tabit.configuration
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
data/lib/tabit/cell.rb
ADDED
data/lib/tabit/config.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
module Tabit
|
2
|
+
class Config
|
3
|
+
attr_accessor :active_class
|
4
|
+
attr_accessor :active_detect
|
5
|
+
|
6
|
+
attr_accessor :builder_class
|
7
|
+
|
8
|
+
def initialize(&block)
|
9
|
+
@active_class = 'active'
|
10
|
+
@active_detect = :exclusive
|
11
|
+
|
12
|
+
@builder_class = Tabit::Builder
|
13
|
+
|
14
|
+
instance_eval(&block) if block_given?
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
data/lib/tabit/helper.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
module Tabit
|
2
|
+
module Helper
|
3
|
+
include ActionView::Helpers::TagHelper
|
4
|
+
include ActionView::Helpers::UrlHelper
|
5
|
+
include ActionView::Helpers::CaptureHelper
|
6
|
+
|
7
|
+
def tabit(clazz = '', options = {}, &block)
|
8
|
+
options[:class] ||= clazz.blank? ? '' : clazz
|
9
|
+
|
10
|
+
content_tag(:ul, options) do
|
11
|
+
yield(configuration.builder_class.new(self))
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
protected
|
16
|
+
def configuration
|
17
|
+
Tabit.configuration
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
data/tabit.gemspec
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "tabit"
|
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 = ["Thomas Boerger", "Tim Rudat"]
|
12
|
+
s.date = "2012-03-06"
|
13
|
+
s.email = "thomas.boerger@langwhich.com"
|
14
|
+
s.extra_rdoc_files = [
|
15
|
+
"LICENSE.md",
|
16
|
+
"README.md"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
".rvmrc",
|
20
|
+
".travis.yml",
|
21
|
+
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
23
|
+
"LICENSE.md",
|
24
|
+
"README.md",
|
25
|
+
"Rakefile",
|
26
|
+
"init.rb",
|
27
|
+
"lib/tabit.rb",
|
28
|
+
"lib/tabit/builder.rb",
|
29
|
+
"lib/tabit/cell.rb",
|
30
|
+
"lib/tabit/config.rb",
|
31
|
+
"lib/tabit/helper.rb",
|
32
|
+
"lib/tabit/railtie.rb",
|
33
|
+
"lib/tabit/version.rb",
|
34
|
+
"tabit.gemspec"
|
35
|
+
]
|
36
|
+
s.homepage = "https://github.com/Langwhich/tabit"
|
37
|
+
s.licenses = ["MIT"]
|
38
|
+
s.require_paths = ["lib"]
|
39
|
+
s.rubygems_version = "1.8.10"
|
40
|
+
s.summary = "Tabit is a simple tab menu generator"
|
41
|
+
|
42
|
+
if s.respond_to? :specification_version then
|
43
|
+
s.specification_version = 3
|
44
|
+
|
45
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
46
|
+
s.add_runtime_dependency(%q<active_link_to>, ["~> 1.0.0"])
|
47
|
+
s.add_development_dependency(%q<redcarpet>, ["~> 2.1.0"])
|
48
|
+
s.add_development_dependency(%q<yard>, ["~> 0.7.5"])
|
49
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
|
50
|
+
else
|
51
|
+
s.add_dependency(%q<active_link_to>, ["~> 1.0.0"])
|
52
|
+
s.add_dependency(%q<redcarpet>, ["~> 2.1.0"])
|
53
|
+
s.add_dependency(%q<yard>, ["~> 0.7.5"])
|
54
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
55
|
+
end
|
56
|
+
else
|
57
|
+
s.add_dependency(%q<active_link_to>, ["~> 1.0.0"])
|
58
|
+
s.add_dependency(%q<redcarpet>, ["~> 2.1.0"])
|
59
|
+
s.add_dependency(%q<yard>, ["~> 0.7.5"])
|
60
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tabit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Thomas Boerger
|
9
|
+
- Tim Rudat
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2012-03-06 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: active_link_to
|
17
|
+
requirement: &70244308040320 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.0.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *70244308040320
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: redcarpet
|
28
|
+
requirement: &70244308039840 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.1.0
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *70244308039840
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: yard
|
39
|
+
requirement: &70244308039360 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 0.7.5
|
45
|
+
type: :development
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *70244308039360
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: jeweler
|
50
|
+
requirement: &70244308038880 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 1.8.3
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *70244308038880
|
59
|
+
description:
|
60
|
+
email: thomas.boerger@langwhich.com
|
61
|
+
executables: []
|
62
|
+
extensions: []
|
63
|
+
extra_rdoc_files:
|
64
|
+
- LICENSE.md
|
65
|
+
- README.md
|
66
|
+
files:
|
67
|
+
- .rvmrc
|
68
|
+
- .travis.yml
|
69
|
+
- Gemfile
|
70
|
+
- Gemfile.lock
|
71
|
+
- LICENSE.md
|
72
|
+
- README.md
|
73
|
+
- Rakefile
|
74
|
+
- init.rb
|
75
|
+
- lib/tabit.rb
|
76
|
+
- lib/tabit/builder.rb
|
77
|
+
- lib/tabit/cell.rb
|
78
|
+
- lib/tabit/config.rb
|
79
|
+
- lib/tabit/helper.rb
|
80
|
+
- lib/tabit/railtie.rb
|
81
|
+
- lib/tabit/version.rb
|
82
|
+
- tabit.gemspec
|
83
|
+
homepage: https://github.com/Langwhich/tabit
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options: []
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
segments:
|
97
|
+
- 0
|
98
|
+
hash: -4434538890362385537
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ! '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 1.8.10
|
108
|
+
signing_key:
|
109
|
+
specification_version: 3
|
110
|
+
summary: Tabit is a simple tab menu generator
|
111
|
+
test_files: []
|