tabs_for 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +41 -40
- data/README.md +2 -0
- data/app/helpers/tabs_for/rails/tabs_for_helper.rb +28 -23
- data/lib/tabs_for/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72e301e7aababf373d0035296f9267601cda7d09
|
4
|
+
data.tar.gz: ceb43f2ddeef6e185bda8cab00c21708cb8344ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59151874011f4f23203aed05df29eb7dede8cb45e681be7163bc0d4e84f3c3c8162583a047ddadec8ba5df38e598db93ad613e96fdba803d80a4477c86bfc92c
|
7
|
+
data.tar.gz: 944cbfcd34e6be723b56d7b79357237b2ad929e9633efb9dc18d252479036f940034e75544d29b6562404df83772d76fc6d867e87e41b570cab66dab335562e7
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
tabs_for (0.2.
|
4
|
+
tabs_for (0.2.1)
|
5
5
|
font-awesome-rails (~> 4.0)
|
6
6
|
rails (>= 3.2, < 5.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actionmailer (4.2.
|
12
|
-
actionpack (= 4.2.
|
13
|
-
actionview (= 4.2.
|
14
|
-
activejob (= 4.2.
|
11
|
+
actionmailer (4.2.5)
|
12
|
+
actionpack (= 4.2.5)
|
13
|
+
actionview (= 4.2.5)
|
14
|
+
activejob (= 4.2.5)
|
15
15
|
mail (~> 2.5, >= 2.5.4)
|
16
16
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
17
|
-
actionpack (4.2.
|
18
|
-
actionview (= 4.2.
|
19
|
-
activesupport (= 4.2.
|
17
|
+
actionpack (4.2.5)
|
18
|
+
actionview (= 4.2.5)
|
19
|
+
activesupport (= 4.2.5)
|
20
20
|
rack (~> 1.6)
|
21
21
|
rack-test (~> 0.6.2)
|
22
22
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
23
23
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
24
|
-
actionview (4.2.
|
25
|
-
activesupport (= 4.2.
|
24
|
+
actionview (4.2.5)
|
25
|
+
activesupport (= 4.2.5)
|
26
26
|
builder (~> 3.1)
|
27
27
|
erubis (~> 2.7.0)
|
28
28
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
29
29
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
30
|
-
activejob (4.2.
|
31
|
-
activesupport (= 4.2.
|
30
|
+
activejob (4.2.5)
|
31
|
+
activesupport (= 4.2.5)
|
32
32
|
globalid (>= 0.3.0)
|
33
|
-
activemodel (4.2.
|
34
|
-
activesupport (= 4.2.
|
33
|
+
activemodel (4.2.5)
|
34
|
+
activesupport (= 4.2.5)
|
35
35
|
builder (~> 3.1)
|
36
|
-
activerecord (4.2.
|
37
|
-
activemodel (= 4.2.
|
38
|
-
activesupport (= 4.2.
|
36
|
+
activerecord (4.2.5)
|
37
|
+
activemodel (= 4.2.5)
|
38
|
+
activesupport (= 4.2.5)
|
39
39
|
arel (~> 6.0)
|
40
|
-
activesupport (4.2.
|
40
|
+
activesupport (4.2.5)
|
41
41
|
i18n (~> 0.7)
|
42
42
|
json (~> 1.7, >= 1.7.7)
|
43
43
|
minitest (~> 5.1)
|
@@ -45,17 +45,18 @@ GEM
|
|
45
45
|
tzinfo (~> 1.1)
|
46
46
|
arel (6.0.3)
|
47
47
|
builder (3.2.2)
|
48
|
-
coveralls (0.8.
|
48
|
+
coveralls (0.8.9)
|
49
49
|
json (~> 1.8)
|
50
50
|
rest-client (>= 1.6.8, < 2)
|
51
51
|
simplecov (~> 0.10.0)
|
52
52
|
term-ansicolor (~> 1.3)
|
53
53
|
thor (~> 0.19.1)
|
54
|
+
tins (~> 1.6.0)
|
54
55
|
docile (1.1.5)
|
55
|
-
domain_name (0.5.
|
56
|
+
domain_name (0.5.25)
|
56
57
|
unf (>= 0.0.5, < 1.0.0)
|
57
58
|
erubis (2.7.0)
|
58
|
-
font-awesome-rails (4.
|
59
|
+
font-awesome-rails (4.5.0.0)
|
59
60
|
railties (>= 3.2, < 5.0)
|
60
61
|
globalid (0.3.6)
|
61
62
|
activesupport (>= 4.1.0)
|
@@ -67,25 +68,25 @@ GEM
|
|
67
68
|
nokogiri (>= 1.5.9)
|
68
69
|
mail (2.6.3)
|
69
70
|
mime-types (>= 1.16, < 3)
|
70
|
-
mime-types (2.
|
71
|
+
mime-types (2.99)
|
71
72
|
mini_portile (0.6.2)
|
72
|
-
minitest (5.8.
|
73
|
-
netrc (0.
|
74
|
-
nokogiri (1.6.6.
|
73
|
+
minitest (5.8.3)
|
74
|
+
netrc (0.11.0)
|
75
|
+
nokogiri (1.6.6.4)
|
75
76
|
mini_portile (~> 0.6.0)
|
76
77
|
rack (1.6.4)
|
77
78
|
rack-test (0.6.3)
|
78
79
|
rack (>= 1.0)
|
79
|
-
rails (4.2.
|
80
|
-
actionmailer (= 4.2.
|
81
|
-
actionpack (= 4.2.
|
82
|
-
actionview (= 4.2.
|
83
|
-
activejob (= 4.2.
|
84
|
-
activemodel (= 4.2.
|
85
|
-
activerecord (= 4.2.
|
86
|
-
activesupport (= 4.2.
|
80
|
+
rails (4.2.5)
|
81
|
+
actionmailer (= 4.2.5)
|
82
|
+
actionpack (= 4.2.5)
|
83
|
+
actionview (= 4.2.5)
|
84
|
+
activejob (= 4.2.5)
|
85
|
+
activemodel (= 4.2.5)
|
86
|
+
activerecord (= 4.2.5)
|
87
|
+
activesupport (= 4.2.5)
|
87
88
|
bundler (>= 1.3.0, < 2.0)
|
88
|
-
railties (= 4.2.
|
89
|
+
railties (= 4.2.5)
|
89
90
|
sprockets-rails
|
90
91
|
rails-deprecated_sanitizer (1.0.3)
|
91
92
|
activesupport (>= 4.2.0.alpha)
|
@@ -95,9 +96,9 @@ GEM
|
|
95
96
|
rails-deprecated_sanitizer (>= 1.0.1)
|
96
97
|
rails-html-sanitizer (1.0.2)
|
97
98
|
loofah (~> 2.0)
|
98
|
-
railties (4.2.
|
99
|
-
actionpack (= 4.2.
|
100
|
-
activesupport (= 4.2.
|
99
|
+
railties (4.2.5)
|
100
|
+
actionpack (= 4.2.5)
|
101
|
+
activesupport (= 4.2.5)
|
101
102
|
rake (>= 0.8.7)
|
102
103
|
thor (>= 0.18.1, < 2.0)
|
103
104
|
rake (10.4.2)
|
@@ -110,13 +111,13 @@ GEM
|
|
110
111
|
json (~> 1.8)
|
111
112
|
simplecov-html (~> 0.10.0)
|
112
113
|
simplecov-html (0.10.0)
|
113
|
-
sprockets (3.
|
114
|
-
rack (
|
114
|
+
sprockets (3.4.0)
|
115
|
+
rack (> 1, < 3)
|
115
116
|
sprockets-rails (2.3.3)
|
116
117
|
actionpack (>= 3.0)
|
117
118
|
activesupport (>= 3.0)
|
118
119
|
sprockets (>= 2.8, < 4.0)
|
119
|
-
sqlite3 (1.3.
|
120
|
+
sqlite3 (1.3.11)
|
120
121
|
term-ansicolor (1.3.2)
|
121
122
|
tins (~> 1.0)
|
122
123
|
thor (0.19.1)
|
data/README.md
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
[fontawesomerails]: https://github.com/bokmann/font-awesome-rails
|
5
5
|
[coveralls]: https://coveralls.io/r/blacktangent/tabs_for
|
6
6
|
[rubygems]: https://rubygems.org/gems/tabs_for
|
7
|
+
[gemnasium]: https://gemnasium.com/blacktangent/tabs_for
|
7
8
|
|
8
9
|
# TabsFor
|
9
10
|
|
@@ -11,6 +12,7 @@
|
|
11
12
|
[![Code Climate](https://codeclimate.com/github/blacktangent/tabs_for/badges/gpa.svg)][codeclimate]
|
12
13
|
[![Test Coverage](http://img.shields.io/coveralls/blacktangent/tabs_for/master.svg)][coveralls]
|
13
14
|
[![Gem Version](http://img.shields.io/gem/v/tabs_for.svg)][rubygems]
|
15
|
+
[![Dependency Status](https://gemnasium.com/blacktangent/tabs_for.png)][gemnasium]
|
14
16
|
|
15
17
|
ActiveView Helper for creating tabs with Bootstrap.
|
16
18
|
|
@@ -3,9 +3,9 @@ module TabsFor
|
|
3
3
|
module TabsForHelper
|
4
4
|
|
5
5
|
def tabs_for(object, &block)
|
6
|
-
content_tag(:ul, :
|
6
|
+
content_tag(:ul, class: 'nav nav-tabs', role: 'tablist') do
|
7
7
|
capture TabBuilder.new(object, self), &block
|
8
|
-
end + content_tag(:div, :
|
8
|
+
end + content_tag(:div, class: 'tab-content') do
|
9
9
|
capture PaneBuilder.new(object, self), &block
|
10
10
|
end
|
11
11
|
end
|
@@ -16,7 +16,8 @@ module TabsFor
|
|
16
16
|
attr_accessor :object, :template, :output_buffer
|
17
17
|
|
18
18
|
def initialize(object, template)
|
19
|
-
@object
|
19
|
+
@object = object
|
20
|
+
@template = template
|
20
21
|
end
|
21
22
|
|
22
23
|
private
|
@@ -32,40 +33,44 @@ module TabsFor
|
|
32
33
|
|
33
34
|
def tab(attribute, options = {})
|
34
35
|
content = if options[:label]
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
36
|
+
options.delete(:label)
|
37
|
+
elsif object.respond_to? attribute
|
38
|
+
human_name attribute
|
39
|
+
else
|
40
|
+
attribute.to_s.titleize
|
41
|
+
end
|
41
42
|
|
42
43
|
options[:id] ||= identifier(attribute)
|
43
44
|
|
44
45
|
if options[:size]
|
45
|
-
content +=
|
46
|
+
content += ' ' + content_tag(:span, options[:size], class: 'badge')
|
46
47
|
end
|
47
48
|
|
48
49
|
content_tag(:li, apply_options(attribute, options)) do
|
49
|
-
link_to
|
50
|
-
options[:icon]
|
50
|
+
link_to '#' + identifier(attribute), apply_link_options(attribute) do
|
51
|
+
if options[:icon]
|
52
|
+
wrap_with_icon(content.html_safe, options)
|
53
|
+
else
|
54
|
+
content.html_safe
|
55
|
+
end
|
51
56
|
end
|
52
57
|
end
|
53
58
|
end
|
54
59
|
|
55
60
|
private
|
56
61
|
|
57
|
-
def apply_link_options(attribute
|
62
|
+
def apply_link_options(attribute)
|
58
63
|
{
|
59
|
-
|
60
|
-
|
61
|
-
:
|
64
|
+
'aria-controls' => identifier(attribute),
|
65
|
+
'data-toggle' => 'tab',
|
66
|
+
role: 'tab'
|
62
67
|
}
|
63
68
|
end
|
64
69
|
|
65
70
|
def apply_options(attribute, options)
|
66
71
|
{
|
67
|
-
:
|
68
|
-
:
|
72
|
+
role: 'presentation',
|
73
|
+
class: options[:active] ? 'active' : nil
|
69
74
|
}
|
70
75
|
end
|
71
76
|
|
@@ -82,12 +87,12 @@ module TabsFor
|
|
82
87
|
class PaneBuilder < ViewBuilder
|
83
88
|
|
84
89
|
def tab(attribute, options = {}, &block)
|
85
|
-
content =
|
90
|
+
content = ''.html_safe
|
86
91
|
|
87
92
|
if options[:help]
|
88
93
|
content += tag(:br)
|
89
94
|
content += content_tag(:p) do
|
90
|
-
content_tag(:i, " #{options[:help]}".html_safe, class:
|
95
|
+
content_tag(:i, " #{options[:help]}".html_safe, class: 'fa fa-info-circle')
|
91
96
|
end
|
92
97
|
end
|
93
98
|
|
@@ -100,9 +105,9 @@ module TabsFor
|
|
100
105
|
|
101
106
|
def apply_options(attribute, options)
|
102
107
|
{
|
103
|
-
:
|
104
|
-
:
|
105
|
-
:
|
108
|
+
role: 'tabpanel',
|
109
|
+
class: 'tab-pane' + (options[:active] ? ' active' : ''),
|
110
|
+
id: options[:id] ? options[:id] : identifier(attribute)
|
106
111
|
}
|
107
112
|
end
|
108
113
|
|
data/lib/tabs_for/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tabs_for
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ole J. Rosendahl
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|