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.
@@ -1,17 +1,16 @@
1
- # @root
2
- #
3
- #
4
1
  module Bootstrap4Helper
5
- # @description
6
- # -
2
+ # Builds a Nav Component that can be used in other components.
3
+ #
7
4
  #
8
5
  class Nav < Component
9
- # @description
10
- # -
6
+ # Class constructor
11
7
  #
12
- # @param [ActionView] template
13
- # @param [NilClass|String|Symbol|Hash] context_or_options
14
- # @param [Hash]
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
- # @description
29
- # - Adds an nav-item to the nav component. this method gets used when the nav-item
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
- # @description
58
- # - Use this when the nav item is nothing more than a hyperlink.
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
- # @description
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
- # @description
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,5 +1,5 @@
1
1
  module Bootstrap4Helper
2
- # @description
2
+ # Simple Railtie to hook out module into ActionView.
3
3
  #
4
4
  #
5
5
  class Railtie < ::Rails::Railtie
@@ -1,16 +1,18 @@
1
- # @root
2
- #
3
- #
4
1
  module Bootstrap4Helper
5
- # @description
6
- # - a simple CSS spinner component.
2
+ # Builds a simple CSS spinner component.
3
+ #
7
4
  #
8
5
  class Spinner < Component
9
- # @description
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
- # @description
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
- # @description
2
+ # Builds a Tab component.
6
3
  #
7
4
  #
8
5
  class Tab < Component
9
- # @description
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
- # @param [Hash]
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
- # @description
27
- # - Builds a custom Nav component for the tabs.
27
+ # Builds a custom Nav component for the tabs.
28
28
  #
29
- # @param [Hash] opts
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
- # @description
45
- # - Builds the Content object for the Tab.
46
+ # Builds the Content object for the Tab.
46
47
  #
47
- # @param [Hash] opts
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
- # @description
55
- # - This has a weird interaction. Because this object doesn't actually return any wrapping
56
- # string or DOM element, we want to return nil, so that only the output buffer on the sub components are returned.
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
- # @description
14
- # -
7
+ # Class constructor
15
8
  #
16
9
  # @param [ActionView] template
17
- # @param [NilClass|String|Symbol|Hash] context_or_options
18
- # @param [Hash]
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
- # @description
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 :div, id: source, class: "tab-pane #{klass}", role: 'tabpanel', &block
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
- # @description
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
@@ -1,3 +1,3 @@
1
1
  module Bootstrap4Helper
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.1'.freeze
3
3
  end
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.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: 2019-11-08 00:00:00.000000000 Z
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: 4.2.11
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: 4.2.11
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
- rubygems_version: 3.0.1
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