rails-bootstrap-tabs 0.2.7 → 0.3.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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7aa709496bbc9dd15155a760d7007a3278d3834301cf286623db176d64742217
|
4
|
+
data.tar.gz: 5717a97dbfd3952f2fc7d97899c8bf39178f41630533b213a173d036ad113db3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03b6d1ddb76bb0904982a3716222ce9409978a395b65033eeccc6ca37cd47d3dd290a759a7f65ad37e2b5e44fcf6834e26e5cb0b30e8a4b769c7a396c961e7d9
|
7
|
+
data.tar.gz: 41bda3b73759ba05f98fc258a8804ee1db3d1f69f34ce54f9f88afb4a694f181021596b15b2d7481b8040dc703aa2705e1f57d5c557a5d096495f4017a0884ca
|
@@ -5,6 +5,8 @@ module RailsBootstrapTabs::Helpers
|
|
5
5
|
RailsBootstrapTabs::Renderers::TabsBootstrap3Renderer
|
6
6
|
elsif RailsBootstrapTabs.bootstrap_version == 4
|
7
7
|
RailsBootstrapTabs::Renderers::TabsBootstrap4Renderer
|
8
|
+
elsif RailsBootstrapTabs.bootstrap_version == 5
|
9
|
+
RailsBootstrapTabs::Renderers::TabsBootstrap5Renderer
|
8
10
|
else
|
9
11
|
raise "Unknown bootstrap version: #{RailsBootstrapTabs.bootstrap_version}!"
|
10
12
|
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module RailsBootstrapTabs::Renderers
|
2
|
+
class TabsBootstrap5Renderer < TabsRenderer
|
3
|
+
def render_tabs_wrapper
|
4
|
+
if @options[:nav_markup]
|
5
|
+
content_tag :nav do
|
6
|
+
content_tag :div, class: 'nav nav-tabs', role: 'tablist' do
|
7
|
+
yield
|
8
|
+
end
|
9
|
+
end
|
10
|
+
else
|
11
|
+
content_tag :ul, class: 'nav nav-tabs', role: 'tablist' do
|
12
|
+
yield
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def render_tab(tab)
|
18
|
+
options = tab.options
|
19
|
+
link_class = 'nav-link'
|
20
|
+
link_class << ' active' if options[:active]
|
21
|
+
link_class << " #{options[:link_class]}" if options[:link_class]
|
22
|
+
if options[:nav_markup]
|
23
|
+
button_tag data: { 'bs-toggle': 'tab', 'bs-target': "##{options[:anchor]}" }, class: link_class, role: 'tab' do
|
24
|
+
yield
|
25
|
+
end
|
26
|
+
else
|
27
|
+
content_tag :li, class: 'nav-item', role: 'presentation' do
|
28
|
+
button_tag data: { 'bs-toggle': 'tab', 'bs-target': "##{options[:anchor]}" }, class: link_class, role: 'tab' do
|
29
|
+
yield
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def render_panes_wrapper(options)
|
36
|
+
content_class = 'tab-content'
|
37
|
+
content_class << " #{options[:content_class]}" if options[:content_class]
|
38
|
+
|
39
|
+
content_tag :div, class: content_class do
|
40
|
+
yield
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def render_pane(tab)
|
45
|
+
options = tab.options
|
46
|
+
pane_class = 'tab-pane'
|
47
|
+
pane_class << ' active' if options[:active]
|
48
|
+
if options[:fade_effect]
|
49
|
+
pane_class << ' fade'
|
50
|
+
pane_class << ' show' if options[:active]
|
51
|
+
pane_class << ' in' unless options[:active]
|
52
|
+
end
|
53
|
+
content_tag :div, id: options[:anchor].to_s, class: pane_class, role: 'tabpanel' do
|
54
|
+
yield
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/lib/rails-bootstrap-tabs.rb
CHANGED
@@ -3,6 +3,7 @@ module RailsBootstrapTabs
|
|
3
3
|
autoload :TabsRenderer, 'rails-bootstrap-tabs/renderers/tabs_renderer'
|
4
4
|
autoload :TabsBootstrap3Renderer, 'rails-bootstrap-tabs/renderers/tabs_bootstrap3_renderer'
|
5
5
|
autoload :TabsBootstrap4Renderer, 'rails-bootstrap-tabs/renderers/tabs_bootstrap4_renderer'
|
6
|
+
autoload :TabsBootstrap5Renderer, 'rails-bootstrap-tabs/renderers/tabs_bootstrap5_renderer'
|
6
7
|
end
|
7
8
|
end
|
8
9
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-bootstrap-tabs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Reshetnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 3.6.0
|
47
|
-
description:
|
47
|
+
description: It reduce starting efforts to make Bootstrap tabs work
|
48
48
|
email:
|
49
49
|
- resivalex@gmail.com
|
50
50
|
executables: []
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- lib/rails-bootstrap-tabs/rails/engine.rb
|
57
57
|
- lib/rails-bootstrap-tabs/renderers/tabs_bootstrap3_renderer.rb
|
58
58
|
- lib/rails-bootstrap-tabs/renderers/tabs_bootstrap4_renderer.rb
|
59
|
+
- lib/rails-bootstrap-tabs/renderers/tabs_bootstrap5_renderer.rb
|
59
60
|
- lib/rails-bootstrap-tabs/renderers/tabs_renderer.rb
|
60
61
|
- lib/rails-bootstrap-tabs/version.rb
|
61
62
|
homepage: https://github.com/resivalex/rails-bootstrap-tabs
|
@@ -77,8 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
78
|
- !ruby/object:Gem::Version
|
78
79
|
version: '0'
|
79
80
|
requirements: []
|
80
|
-
|
81
|
-
rubygems_version: 2.7.7
|
81
|
+
rubygems_version: 3.1.4
|
82
82
|
signing_key:
|
83
83
|
specification_version: 4
|
84
84
|
summary: A Rails plugin to build bootstrap tabs
|