bootstrap4_helper 1.0.0 → 1.0.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 +4 -4
- data/README.md +7 -0
- data/lib/bootstrap4_helper.rb +58 -69
- data/lib/bootstrap4_helper/accordion.rb +18 -21
- data/lib/bootstrap4_helper/accordion_group.rb +9 -13
- data/lib/bootstrap4_helper/alert.rb +6 -31
- data/lib/bootstrap4_helper/badge.rb +8 -13
- data/lib/bootstrap4_helper/card.rb +52 -39
- data/lib/bootstrap4_helper/card_column.rb +3 -6
- data/lib/bootstrap4_helper/card_deck.rb +3 -6
- data/lib/bootstrap4_helper/card_group.rb +3 -6
- data/lib/bootstrap4_helper/card_grouping.rb +6 -8
- data/lib/bootstrap4_helper/component.rb +28 -32
- data/lib/bootstrap4_helper/configuration.rb +7 -9
- data/lib/bootstrap4_helper/constants.rb +2 -5
- data/lib/bootstrap4_helper/dropdown.rb +23 -20
- data/lib/bootstrap4_helper/dropdown/menu.rb +42 -25
- data/lib/bootstrap4_helper/initialize.rb +2 -7
- data/lib/bootstrap4_helper/modal.rb +54 -37
- data/lib/bootstrap4_helper/nav.rb +32 -19
- data/lib/bootstrap4_helper/railtie.rb +1 -1
- data/lib/bootstrap4_helper/spinner.rb +12 -9
- data/lib/bootstrap4_helper/tab.rb +20 -16
- data/lib/bootstrap4_helper/tab/content.rb +24 -17
- data/lib/bootstrap4_helper/version.rb +1 -1
- metadata +50 -7
@@ -1,17 +1,16 @@
|
|
1
|
-
# @root
|
2
|
-
#
|
3
|
-
#
|
4
1
|
module Bootstrap4Helper
|
5
|
-
#
|
6
|
-
#
|
2
|
+
# Builds a Nav Component that can be used in other components.
|
3
|
+
#
|
7
4
|
#
|
8
5
|
class Nav < Component
|
9
|
-
#
|
10
|
-
# -
|
6
|
+
# Class constructor
|
11
7
|
#
|
12
|
-
# @param [ActionView]
|
13
|
-
# @param [
|
14
|
-
# @
|
8
|
+
# @param [ActionView] template
|
9
|
+
# @param [Hash] opts
|
10
|
+
# @option opts [String] :id
|
11
|
+
# @option opts [String] :class
|
12
|
+
# @option opts [Hash] :data
|
13
|
+
# @option opts [Hash] :child
|
15
14
|
#
|
16
15
|
def initialize(template, opts = {}, &block)
|
17
16
|
super(template)
|
@@ -25,14 +24,19 @@ module Bootstrap4Helper
|
|
25
24
|
@dropdown = Dropdown.new(@template)
|
26
25
|
end
|
27
26
|
|
28
|
-
#
|
29
|
-
|
27
|
+
# rubocop:disable Metrics/MethodLength
|
28
|
+
|
29
|
+
# Adds an nav-item to the nav component. this method gets used when the nav-item
|
30
30
|
# links to content in a tab or something.
|
31
31
|
#
|
32
32
|
# @param [Symbol|String] target
|
33
33
|
# @param [Hash] opts
|
34
|
+
# @option opts [String] :id
|
35
|
+
# @option opts [String] :class
|
36
|
+
# @option opts [Hash] :data
|
37
|
+
# @option opts [Hash] :aria
|
38
|
+
# @return [String]
|
34
39
|
#
|
35
|
-
# rubocop:disable Metrics/MethodLength
|
36
40
|
def item(target, opts = {})
|
37
41
|
id = opts.fetch(:id, nil)
|
38
42
|
klass = opts.fetch(:class, '')
|
@@ -54,8 +58,12 @@ module Bootstrap4Helper
|
|
54
58
|
end
|
55
59
|
# rubocop:enable Metrics/MethodLength
|
56
60
|
|
57
|
-
#
|
58
|
-
#
|
61
|
+
# Use this when the nav item is nothing more than a hyperlink.
|
62
|
+
#
|
63
|
+
# @param [String|NilClass] name
|
64
|
+
# @param [Hash|NilClass] options
|
65
|
+
# @param [Hash|NilClass] html_options
|
66
|
+
# @return [String]
|
59
67
|
#
|
60
68
|
def link(name = nil, options = nil, html_options = nil, &block)
|
61
69
|
html_options = (html_options || {}).merge(class: 'nav-link')
|
@@ -63,11 +71,15 @@ module Bootstrap4Helper
|
|
63
71
|
@template.link_to(name, options, html_options, &block)
|
64
72
|
end
|
65
73
|
|
66
|
-
#
|
67
|
-
# - Creates a dropdown menu for the nav.
|
74
|
+
# Creates a dropdown menu for the nav.
|
68
75
|
#
|
69
76
|
# @param [NilClass|Symbol|String] name
|
70
77
|
# @param [Hash] opts
|
78
|
+
# @option opts [String] :id
|
79
|
+
# @option opts [String] :class
|
80
|
+
# @option opts [Hash] :data
|
81
|
+
# @option opts [Hash] :aria
|
82
|
+
# @return [String]
|
71
83
|
#
|
72
84
|
def dropdown(name, opts = {}, &block)
|
73
85
|
id = opts.fetch(:id, nil)
|
@@ -88,8 +100,9 @@ module Bootstrap4Helper
|
|
88
100
|
end
|
89
101
|
end
|
90
102
|
|
91
|
-
#
|
92
|
-
#
|
103
|
+
# String representation of the object.
|
104
|
+
#
|
105
|
+
# @return [String]
|
93
106
|
#
|
94
107
|
def to_s
|
95
108
|
content_tag :ul, id: @id, class: "nav #{@class}" do
|
@@ -1,16 +1,18 @@
|
|
1
|
-
# @root
|
2
|
-
#
|
3
|
-
#
|
4
1
|
module Bootstrap4Helper
|
5
|
-
#
|
6
|
-
#
|
2
|
+
# Builds a simple CSS spinner component.
|
3
|
+
#
|
7
4
|
#
|
8
5
|
class Spinner < Component
|
9
|
-
#
|
10
|
-
#
|
6
|
+
# Class constructor
|
7
|
+
#
|
8
|
+
# @note The different support types are: `:border` and `:grow`
|
11
9
|
#
|
12
10
|
# @param [ActionView] template
|
13
11
|
# @param [Hash] opts
|
12
|
+
# @option opts [Symbol] :type
|
13
|
+
# @option opts [String] :id
|
14
|
+
# @option opts [String] :class
|
15
|
+
# @option opts [Hash] :data
|
14
16
|
#
|
15
17
|
def initialize(template, opts = {}, &block)
|
16
18
|
super(template)
|
@@ -22,8 +24,9 @@ module Bootstrap4Helper
|
|
22
24
|
@content = block || proc { '' }
|
23
25
|
end
|
24
26
|
|
25
|
-
#
|
26
|
-
#
|
27
|
+
# String representation of the object.
|
28
|
+
#
|
29
|
+
# @return [String]
|
27
30
|
#
|
28
31
|
def to_s
|
29
32
|
content_tag(
|
@@ -1,17 +1,18 @@
|
|
1
|
-
# @root
|
2
|
-
#
|
3
|
-
#
|
4
1
|
module Bootstrap4Helper
|
5
|
-
#
|
2
|
+
# Builds a Tab component.
|
6
3
|
#
|
7
4
|
#
|
8
5
|
class Tab < Component
|
9
|
-
#
|
10
|
-
#
|
6
|
+
# Class constructor
|
7
|
+
#
|
8
|
+
# @note The support types are: `:tabs` and `:pills`
|
11
9
|
#
|
12
10
|
# @param [ActionView] template
|
13
11
|
# @param [Hash] opts
|
14
|
-
# @
|
12
|
+
# @option opts [Symbol] :type
|
13
|
+
# @option opts [String] :id
|
14
|
+
# @option opts [String] :class
|
15
|
+
# @option opts [Hash] :data
|
15
16
|
#
|
16
17
|
def initialize(template, opts = {}, &block)
|
17
18
|
super(template)
|
@@ -23,10 +24,11 @@ module Bootstrap4Helper
|
|
23
24
|
@content = block || proc { '' }
|
24
25
|
end
|
25
26
|
|
26
|
-
#
|
27
|
-
# - Builds a custom Nav component for the tabs.
|
27
|
+
# Builds a custom Nav component for the tabs.
|
28
28
|
#
|
29
|
-
# @param
|
29
|
+
# @param [Hash] opts
|
30
|
+
# @option opts [String] :class
|
31
|
+
# @option opts [Hash] :data
|
30
32
|
# @return [Nav]
|
31
33
|
#
|
32
34
|
def nav(opts = {}, &block)
|
@@ -41,19 +43,21 @@ module Bootstrap4Helper
|
|
41
43
|
Nav.new(@template, opts, &block)
|
42
44
|
end
|
43
45
|
|
44
|
-
#
|
45
|
-
# - Builds the Content object for the Tab.
|
46
|
+
# Builds the Content object for the Tab.
|
46
47
|
#
|
47
|
-
# @param
|
48
|
+
# @param [Hash] opts
|
49
|
+
# @option opts [String] :id
|
50
|
+
# @option opts [String] :class
|
51
|
+
# @option opts [Hash] :data
|
48
52
|
# @return [Tab::Content]
|
49
53
|
#
|
50
54
|
def content(opts = {}, &block)
|
51
55
|
Content.new(@template, opts, &block)
|
52
56
|
end
|
53
57
|
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
58
|
+
# This has a weird interaction. Because this object doesn't actually return any wrapping
|
59
|
+
# string or DOM element, we want to return nil, so that only the output buffer on the sub components are
|
60
|
+
# returned.
|
57
61
|
# If we return the return value of the block, we will get the last element added to the input
|
58
62
|
# buffer as an unescaped string.
|
59
63
|
#
|
@@ -1,21 +1,16 @@
|
|
1
|
-
# @root
|
2
|
-
#
|
3
|
-
#
|
4
1
|
module Bootstrap4Helper
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
2
|
class Tab
|
9
|
-
#
|
3
|
+
# Build a Content component to be used with Tabs
|
10
4
|
#
|
11
5
|
#
|
12
6
|
class Content < Component
|
13
|
-
#
|
14
|
-
# -
|
7
|
+
# Class constructor
|
15
8
|
#
|
16
9
|
# @param [ActionView] template
|
17
|
-
# @param [
|
18
|
-
# @
|
10
|
+
# @param [Hash] opts
|
11
|
+
# @option opts [String] :id
|
12
|
+
# @option opts [String] :class
|
13
|
+
# @option opts [Hash] :data
|
19
14
|
#
|
20
15
|
def initialize(template, opts = {}, &block)
|
21
16
|
super(template)
|
@@ -26,19 +21,31 @@ module Bootstrap4Helper
|
|
26
21
|
@content = block || proc { '' }
|
27
22
|
end
|
28
23
|
|
29
|
-
#
|
30
|
-
#
|
24
|
+
# Builds the pane for the tab.
|
25
|
+
#
|
26
|
+
# @param [Symbol] source
|
27
|
+
# @param [Hash] opts
|
28
|
+
# @option opts [String] :class
|
29
|
+
# @option opts [Hash] :data
|
30
|
+
# @return [String]
|
31
31
|
#
|
32
32
|
def pane(source, opts = {}, &block)
|
33
|
-
id = opts.fetch(:id, nil)
|
34
33
|
klass = opts.fetch(:class, '')
|
35
34
|
data = opts.fetch(:data, {})
|
36
35
|
|
37
|
-
content_tag
|
36
|
+
content_tag(
|
37
|
+
:div,
|
38
|
+
id: source,
|
39
|
+
class: "tab-pane #{klass}",
|
40
|
+
role: 'tabpanel',
|
41
|
+
data: data,
|
42
|
+
&block
|
43
|
+
)
|
38
44
|
end
|
39
45
|
|
40
|
-
#
|
41
|
-
#
|
46
|
+
# String representation of the object.
|
47
|
+
#
|
48
|
+
# @return [String]
|
42
49
|
#
|
43
50
|
def to_s
|
44
51
|
content_tag :div, id: @id, class: "tab-content #{@class}" do
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstrap4_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert David
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "<"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 6.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "<"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 6.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bootstrap
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +66,48 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 5.2.3
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: redcarpet
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: solargraph
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
69
111
|
- !ruby/object:Gem::Dependency
|
70
112
|
name: sqlite3
|
71
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -133,7 +175,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
175
|
- !ruby/object:Gem::Version
|
134
176
|
version: '0'
|
135
177
|
requirements: []
|
136
|
-
|
178
|
+
rubyforge_project:
|
179
|
+
rubygems_version: 2.7.6
|
137
180
|
signing_key:
|
138
181
|
specification_version: 4
|
139
182
|
summary: Library for rapidly building bootstrap 4 components
|