tabit 0.2.1 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Tabit [![Build Status](https://secure.travis-ci.org/Langwhich/tabit)](https://secure.travis-ci.org/Langwhich/tabit.png)
1
+ # Tabit [![Build Status](https://secure.travis-ci.org/Langwhich/tabit.png)](https://secure.travis-ci.org/Langwhich/tabit)
2
2
 
3
3
  Tabit is a simple tab menu generator. It depends on `active_link_to`
4
4
  helper. If you dont know how to set an item active take a look at it first.
@@ -14,11 +14,13 @@ The generated source is compatible to bootstrap tabs with dropdowns.
14
14
 
15
15
  ```ruby
16
16
  = tabit :class => 'nav nav-tabs' do |t1|
17
+ - t1.heading 'Header'
17
18
  - t1.add 'Videos', videos_path
19
+ - t1.divider
18
20
  - t1.add 'Movies', movies_path, :active => /movies(\/\d)*(\/edit)*$/
19
21
  - t1.add 'Movies, movies_path, :active => :exclusive, :type => :dropdown do |t2|
20
22
  - t2.add 'Add movie', new_movie_path, :active => :exclusive
21
- ```
23
+ ```
22
24
 
23
25
  ## Credits
24
26
 
@@ -5,12 +5,18 @@ module Tabit
5
5
 
6
6
  attr_accessor :builder_class
7
7
 
8
+ attr_accessor :heading_class
9
+ attr_accessor :divider_class
10
+
8
11
  def initialize(&block)
9
12
  @active_class = 'active'
10
13
  @active_detect = :exclusive
11
14
 
12
15
  @builder_class = Tabit::Builder
13
16
 
17
+ @heading_class = 'nav-header'
18
+ @divider_class = 'divider'
19
+
14
20
  instance_eval(&block) if block_given?
15
21
  end
16
22
  end
@@ -29,6 +29,30 @@ module Tabit
29
29
  end
30
30
  end
31
31
 
32
+ def heading(name = nil, options = {})
33
+ options[:class] = '' if options[:class].nil?
34
+ options[:class] << " #{configuration.heading_class}"
35
+ options[:class].strip!
36
+
37
+ @children << template.content_tag(
38
+ :li,
39
+ name
40
+ options
41
+ )
42
+ end
43
+
44
+ def divider(name = nil)
45
+ options[:class] = '' if options[:class].nil?
46
+ options[:class] << " #{configuration.divider_class}"
47
+ options[:class].strip!
48
+
49
+ @children << template.content_tag(
50
+ :li,
51
+ name
52
+ options
53
+ )
54
+ end
55
+
32
56
  def to_s
33
57
  clazz = if active?
34
58
  configuration.active_class
@@ -1,7 +1,7 @@
1
1
  module Tabit
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 2
4
+ MINOR = 3
5
5
  PATCH = 1
6
6
  BUILD = nil
7
7
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "tabit"
8
- s.version = "0.2.1"
8
+ s.version = "0.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Thomas Boerger", "Tim Rudat"]
12
- s.date = "2012-04-30"
12
+ s.date = "2012-06-03"
13
13
  s.email = "thomas.boerger@langwhich.com"
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE.md",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tabit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-04-30 00:00:00.000000000 Z
13
+ date: 2012-06-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: active_link_to
@@ -116,7 +116,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
116
116
  version: '0'
117
117
  segments:
118
118
  - 0
119
- hash: -4368168093489379260
119
+ hash: -1463536189257615823
120
120
  required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  none: false
122
122
  requirements: