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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0b8c171fc1cd2510c422ae2e359386eac13e14a11437674208960480d35167b
4
- data.tar.gz: 7779d13c5a369aec5c1b15b10916e78a197cb3d7a3d31b1bc3284dedb1376563
3
+ metadata.gz: ecce74ed3cfecf92336b00a39382a3f08421677a5d19960c9258d75b408ff3ae
4
+ data.tar.gz: 502e141e6a43ff40a0b5c1d3b5df7a6595de3ba8d9cb87b1cbb24036f2b919e6
5
5
  SHA512:
6
- metadata.gz: fccc06d01e6e46ee9e33d67d1842705a87567dab8d8ac6d6dbce18449e478d9353937cb14ab1887b3fce71e34528c1462014f5e22531b1e7e7ee8ea9c60def9a
7
- data.tar.gz: b2574bbfd27950f1bec5234a09937f78570b9cd41a0a7cbab02c8e3f79c1d126b5140a5daf38897a684fd488bae7e5f9ca7ef5364d656d343d5b8269d6b79a6c
6
+ metadata.gz: 3638e8d509347594f2e5491a5a3ebd024795f0dce99113946b656e029f1e5c27ef4fb019c45949b0954c010fe90b3485d8f630f34f7025b09d34395f5cf4565d
7
+ data.tar.gz: f352adbb8fdc083faf28e2bce76e3f7763c208c4d00fd328532a9e24fafe4fcf324d05ab3c96389ecc7c3ac4c4d00134d5a3acfa77b3bf8f188ebc9270e1d597
data/README.md CHANGED
@@ -1,10 +1,13 @@
1
1
  # Bootstrap4Helper
2
+
2
3
  Short description and motivation.
3
4
 
4
5
  ## Usage
6
+
5
7
  How to use my plugin.
6
8
 
7
9
  ## Installation
10
+
8
11
  Add this line to your application's Gemfile:
9
12
 
10
13
  ```ruby
@@ -12,17 +15,21 @@ gem 'bootstrap4_helper'
12
15
  ```
13
16
 
14
17
  And then execute:
18
+
15
19
  ```bash
16
20
  $ bundle
17
21
  ```
18
22
 
19
23
  Or install it yourself as:
24
+
20
25
  ```bash
21
26
  $ gem install bootstrap4_helper
22
27
  ```
23
28
 
24
29
  ## Contributing
30
+
25
31
  Contribution directions go here.
26
32
 
27
33
  ## License
34
+
28
35
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -8,19 +8,16 @@ end
8
8
 
9
9
  require 'bootstrap4_helper/initialize'
10
10
 
11
- # @todo
12
- # - We need a configuration system so people can specify what DOM elements to
13
- # use when building components. Like, so we want <h1> for Card Headers or just
14
- # <div>'s.
11
+ # This is the module that will get included in your partials.
12
+ #
15
13
  #
16
14
  module Bootstrap4Helper
17
- # @description
18
- # - Creates a single Accordion element. The header component
15
+ # Creates a single Accordion element. The header component
19
16
  # already provides the DOM element to link the Collapse area.
20
17
  # You just need to provide the text or additional markup, if
21
18
  # you want it.
22
19
  #
23
- # <code>
20
+ # ```erb
24
21
  # <%= accordion_helper do |a| %>
25
22
  # <%= a.header do %>
26
23
  # // Some HTML or Ruby
@@ -29,20 +26,19 @@ module Bootstrap4Helper
29
26
  # // Some HTML or Ruby
30
27
  # <% end %>
31
28
  # <% end %>
32
- # </code>
29
+ # ```
33
30
  #
34
- # @param [Mixed] args
31
+ # @param [Hash] opts
35
32
  # @return [Accordion]
36
33
  #
37
34
  def accordion_helper(opts = {}, &block)
38
35
  Accordion.new(self, opts, &block)
39
36
  end
40
37
 
41
- # @description
42
- # - Creates a group of Accordions that stay in sync with each other.
38
+ # Creates a group of Accordions that stay in sync with each other.
43
39
  # One opens, the other closes.
44
40
  #
45
- # <code>
41
+ # ```erb
46
42
  # <%= accordion_group_helper do |grp| %>
47
43
  # <%= grp.accordion do |a| %>
48
44
  # <%= a.header class: 'text-white bg-primary' do %>
@@ -62,58 +58,55 @@ module Bootstrap4Helper
62
58
  # <% end %>
63
59
  # <% end %>
64
60
  # <% end $>
65
- # </code>
61
+ # ```
66
62
  #
67
- # @param [Mixed] args
63
+ # @param [Mixed] args
68
64
  # @return [Accordion]
69
65
  #
70
66
  def accordion_group_helper(*args, &block)
71
67
  AccordionGroup.new(self, *args, &block)
72
68
  end
73
69
 
74
- # @description
75
- # - Creates an Alert component.
70
+ # Creates an Alert component.
76
71
  #
77
- # <code>
72
+ # ```erb
78
73
  # <%= alert_helper :danger, dismissble: true do %>
79
74
  # Something went wrong with your model data...
80
75
  # <% end %>
81
- # </code>
76
+ # ```
82
77
  #
83
- # @params [Symbol|String|Hash|NilClass] *args
78
+ # @param [Mixed] args
84
79
  # @return [String]
85
80
  #
86
81
  def alert_helper(*args, &block)
87
82
  Alert.new(self, *args, &block)
88
83
  end
89
84
 
90
- # @description
91
- # - Creates a badge component. Bades have a context variable. Providing nothing
85
+ # Creates a badge component. Bades have a context variable. Providing nothing
92
86
  # will give you the `secondary` context.
93
87
  #
94
- # <code>
88
+ # ```erb
95
89
  # <li>
96
90
  # Messages: <%= badge_helper(:primary) { @messages.count } %>
97
91
  # </li>
98
92
  # <li>
99
93
  # Notifications: <%= badge_healper { @notifications.count } %>
100
94
  # </li>
101
- # </code>
95
+ # ```
102
96
  #
103
- # @params [Symbol|String|Hash|NilClass] *args
97
+ # @param [Mixed] args
104
98
  # @return [String]
105
99
  #
106
100
  def badge_helper(*args, &block)
107
101
  Badge.new(self, *args, &block)
108
102
  end
109
103
 
110
- # @description
111
- # - Creates a Card component.
104
+ # Creates a Card component.
112
105
  #
113
106
  #
114
- # <code>
107
+ # ```erb
115
108
  #
116
- # - Regular
109
+ # <%# Regular %>
117
110
  #
118
111
  # <%= card_helper do |c| %>
119
112
  # <%= c.header class: 'text-white bg-primary' do %>
@@ -133,7 +126,7 @@ module Bootstrap4Helper
133
126
  # <% end %>
134
127
  # <% end %>
135
128
  #
136
- # - Horizontal
129
+ # <%# Horizontal %>
137
130
  #
138
131
  # <div class="row">
139
132
  # <div class="col-sm mt-3 mb-3">
@@ -155,19 +148,18 @@ module Bootstrap4Helper
155
148
  # <% end %>
156
149
  # </div>
157
150
  # </div>
158
- # </code>
151
+ # ```
159
152
  #
160
- # @param [Hash] opts
153
+ # @param [Hash] opts
161
154
  # @return [String]
162
155
  #
163
156
  def card_helper(opts = {}, &block)
164
157
  Card.new(self, opts, &block)
165
158
  end
166
159
 
167
- # @description
168
- # - Builds a card group.
160
+ # Builds a card group.
169
161
  #
170
- # <code>
162
+ # ```erb
171
163
  # <%= card_group_helper do |group| %>
172
164
  # <%= group.card do |c| %>
173
165
  # <%= c.body do %>
@@ -214,19 +206,18 @@ module Bootstrap4Helper
214
206
  # <% end %>
215
207
  # <% end %>
216
208
  # <% end %>
217
- # </code>
209
+ # ```
218
210
  #
219
- # @param [Hash] opts
211
+ # @param [Hash] opts
220
212
  # @return [String]
221
213
  #
222
214
  def card_group_helper(opts = {}, &block)
223
215
  CardGroup.new(self, opts, &block)
224
216
  end
225
217
 
226
- # @description
227
- # - Builds a card deck.
218
+ # Builds a card deck.
228
219
  #
229
- # <code>
220
+ # ```erb
230
221
  # <%= card_deck_helper do |deck| %>
231
222
  # <%= deck.card do |c| %>
232
223
  # <%= c.body do %>
@@ -273,19 +264,18 @@ module Bootstrap4Helper
273
264
  # <% end %>
274
265
  # <% end %>
275
266
  # <% end %>
276
- # </code>
267
+ # ```
277
268
  #
278
- # @param [Hash] opts
269
+ # @param [Hash] opts
279
270
  # @return [String]
280
271
  #
281
272
  def card_deck_helper(opts = {}, &block)
282
273
  CardDeck.new(self, opts, &block)
283
274
  end
284
275
 
285
- # @description
286
- # - Builds a card column.
276
+ # Builds a card column.
287
277
  #
288
- # <code>
278
+ # ```erb
289
279
  # <%= card_column_helper do |column| %>
290
280
  # <%= column.card do |c| %>
291
281
  # <%= c.body do %>
@@ -332,20 +322,19 @@ module Bootstrap4Helper
332
322
  # <% end %>
333
323
  # <% end %>
334
324
  # <% end %>
335
- # </code>
325
+ # ```
336
326
  #
337
- # @param [Hash] opts
327
+ # @param [Hash] opts
338
328
  # @return [String]
339
329
  #
340
330
  def card_column_helper(opts = {}, &block)
341
331
  CardColumn.new(self, opts, &block)
342
332
  end
343
333
 
344
- # @description
345
- # - Generates a Dropdown component. Default type `:dropdown`. For inline buttons, use
334
+ # Generates a Dropdown component. Default type `:dropdown`. For inline buttons, use
346
335
  # `:group`.
347
336
  #
348
- # <code>
337
+ # ```erb
349
338
  # <%= dropdown_helper do |dropdown| %>
350
339
  # <%= dropdown.button(:primary) { "Action" } %>
351
340
  # <%= dropdown.menu do |menu| %>
@@ -395,19 +384,18 @@ module Bootstrap4Helper
395
384
  # <%= menu.link "Forgot password", "#" %>
396
385
  # <% end %>
397
386
  # <% end %>
398
- # </code>
387
+ # ```
399
388
  #
400
- # @param [Mixed] args
389
+ # @param [Mixed] args
401
390
  # @return [String]
402
391
  #
403
392
  def dropdown_helper(*args, &block)
404
393
  Dropdown.new(self, *args, &block)
405
394
  end
406
395
 
407
- # @description
408
- # - Generates Modal windows.
396
+ # Generates Modal windows.
409
397
  #
410
- # <code>
398
+ # ```erb
411
399
  # <%= modal_helper id: 'exampleModal' do |m| %>
412
400
  # <%= m.header do %>
413
401
  # <%= m.title { 'Example Modal' } %>
@@ -425,19 +413,18 @@ module Bootstrap4Helper
425
413
  # <% end %>
426
414
  # <% end %>
427
415
  # <% end %>
428
- # </code>
416
+ # ```
429
417
  #
430
- # @param [Hash] opts
418
+ # @param [Hash] opts
431
419
  # @return [String]
432
420
  #
433
421
  def modal_helper(opts = {}, &block)
434
422
  Modal.new(self, opts, &block)
435
423
  end
436
424
 
437
- # @description
438
- # - Generates Nav components.
425
+ # Generates Nav components.
439
426
  #
440
- # <code>
427
+ # ```erb
441
428
  # <%= nav_helper do |nav| %>
442
429
  # <%= nav.link "Item 1", "https://www.google.com" %>
443
430
  # <%= nav.link "Item 2", "#" %>
@@ -452,19 +439,18 @@ module Bootstrap4Helper
452
439
  # <%= menu.link 'Records', '#' %>
453
440
  # <% end %>
454
441
  # <% end %>
455
- # </code>
442
+ # ```
456
443
  #
457
- # @param [Hash] opts
444
+ # @param [Hash] opts
458
445
  # @return [String]
459
446
  #
460
447
  def nav_helper(opts = {}, &block)
461
448
  Nav.new(self, opts, &block)
462
449
  end
463
450
 
464
- # @description
465
- # - Generates a Tab component.
451
+ # Generates a Tab component.
466
452
  #
467
- # <code>
453
+ # ```erb
468
454
  # <%= tab_helper do |tab| %>
469
455
  # <%= tab.nav do |nav| %>
470
456
  # <%= nav.item :item1 do %>
@@ -505,19 +491,22 @@ module Bootstrap4Helper
505
491
  # <% end %>
506
492
  # <% end %>
507
493
  # <% end %>
508
- # </code>
494
+ # ```
495
+ # @param [Mixed] args
496
+ # @return [String]
509
497
  #
510
498
  def tab_helper(*args, &block)
511
499
  Tab.new(self, *args, &block)
512
500
  end
513
501
 
514
- # @description
515
- # - Generates spinner annimations.
502
+ # Generates spinner annimations.
516
503
  #
517
- # <code>
504
+ # ```erb
518
505
  # <%= spinner_helper class: 'text-warning' %>
519
506
  # <%= spinner_helper type: :grow, class: 'text-danger', id: 'loadingRecords' %>
520
- # </code>
507
+ # ```
508
+ # @param [Mixed] args
509
+ # @return [String]
521
510
  #
522
511
  def spinner_helper(*args, &block)
523
512
  Spinner.new(self, *args, &block)
@@ -1,9 +1,6 @@
1
- # @root
2
- #
3
- #
4
1
  module Bootstrap4Helper
5
- # @description
6
- # - Builds a Accordion out of the collapse component of Bootstrap 4.
2
+ # Builds a Accordion out of the collapse component of Bootstrap 4.
3
+ #
7
4
  #
8
5
  class Accordion < Component
9
6
  CARD_METHODS = %i[
@@ -12,11 +9,16 @@ module Bootstrap4Helper
12
9
  image_overlay
13
10
  ].freeze
14
11
 
15
- # @description
12
+ # Class constructor
16
13
  # -
17
14
  #
18
15
  # @param [ActionView] template
19
16
  # @param [Hash] opts
17
+ # @option opts [String] :id
18
+ # @option opts [String] :class
19
+ # @option opts [Hash] :data
20
+ # @option opts [String] :parent
21
+ # @option opts [String] :target
20
22
  #
21
23
  def initialize(template, opts = {}, &block)
22
24
  super(template)
@@ -30,11 +32,10 @@ module Bootstrap4Helper
30
32
  @card = Card.new(@template)
31
33
  end
32
34
 
33
- # @description
34
- # - Builds a header component for the accordion, which is actually the header
35
+ # Builds a header component for the accordion, which is actually the header
35
36
  # of a Card.
36
37
  #
37
- # @param [Hash] opts
38
+ # @param [Hash] opts
38
39
  # @return [String]
39
40
  #
40
41
  def header(opts = {}, &block)
@@ -49,15 +50,13 @@ module Bootstrap4Helper
49
50
  end
50
51
  end
51
52
 
52
- # @description
53
- # - Builds the body component for the accordion, which is actually the body
53
+ # Builds the body component for the accordion, which is actually the body
54
54
  # of a Card.
55
55
  #
56
- # @note
57
- # - The `@parent` gets used to set the parent element for the accordion. This
58
- # gets used primarily in the `AccordionGroup`.
56
+ # @note The `@parent` gets used to set the parent element for the accordion. This
57
+ # gets used primarily in the `AccordionGroup`.
59
58
  #
60
- # @param [Hash] opts
59
+ # @param [Hash] opts
61
60
  # @return [String]
62
61
  #
63
62
  def body(opts = {}, &block)
@@ -68,8 +67,7 @@ module Bootstrap4Helper
68
67
  end
69
68
  end
70
69
 
71
- # @description
72
- # - Because Accordions are basically `Cards` with a wrapper, we might as
70
+ # Because Accordions are basically `Cards` with a wrapper, we might as
73
71
  # well catch common `Card` methods and send them to the card object. No
74
72
  # point in creating similar methods for `Accordions`.
75
73
  #
@@ -84,15 +82,14 @@ module Bootstrap4Helper
84
82
  end
85
83
  end
86
84
 
87
- # @description
88
- # -
85
+ # Checks if the Object reponds to missing.
86
+ #
89
87
  #
90
88
  def respond_to_missing?(method, include_private = false)
91
89
  CARD_METHODS.include?(method) || super
92
90
  end
93
91
 
94
- # @description
95
- # - Leaving off the the default `accordion` class because with only 1 accordion,
92
+ # Leaving off the default `accordion` class because with only 1 accordion,
96
93
  # there is no bottom.
97
94
  #
98
95
  # @return [String]