bootstrap4_helper 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bootstrap4_helper/constants.rb +1 -0
- data/lib/bootstrap4_helper/input_group.rb +54 -0
- data/lib/bootstrap4_helper/version.rb +1 -1
- data/lib/bootstrap4_helper.rb +24 -0
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a23f132c519e3621ae8a9ce0c6b9cdd4a253ec17377cd5dee9874993140e7f0
|
4
|
+
data.tar.gz: 72d27fda2a64db784d5bd8f248f4a59d9ce8621d01ba98007f262ffa66873478
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f487e7dcbbe737c7ca67ae673234e71003262974d692dcf7e3eaad45d0efc4b888183e4ae51c72b28ce1e9ce436880889c7ee5b2dd3694c48d42e50c3f10e01b
|
7
|
+
data.tar.gz: 9437852eaf93cac4e7769f7f04359a86233a122f231ba78db1540e8e4cf9803325d856a2ba9175e33a2b650c5cfc4b252d8bb5d85145c11845b902dba72554d0
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module Bootstrap4Helper
|
2
|
+
# The InputGroup helper is meant to help you rapidly build Bootstrap input
|
3
|
+
# group components quickly and easily.
|
4
|
+
#
|
5
|
+
class InputGroup < Component
|
6
|
+
VALID_TYPES = %i[append prepend].freeze
|
7
|
+
|
8
|
+
# Class constructor
|
9
|
+
#
|
10
|
+
# @param [Class] template - Template in which your are binding too.
|
11
|
+
# @param [Symbol] type - Whether the component is prepend or append.
|
12
|
+
# @param [Hash] opts
|
13
|
+
# @return [InputGroup]
|
14
|
+
#
|
15
|
+
def initialize(template, type = :prepend, opts = {}, &block)
|
16
|
+
super(template)
|
17
|
+
|
18
|
+
@type = VALID_TYPES.include?(type) ? type : :prepend
|
19
|
+
@id = opts.fetch(:id, nil)
|
20
|
+
@class = opts.fetch(:class, '')
|
21
|
+
@data = opts.fetch(:data, {})
|
22
|
+
@content = block || proc { '' }
|
23
|
+
end
|
24
|
+
|
25
|
+
# This is the element that actually houses the icon or text used
|
26
|
+
# in the input group.
|
27
|
+
#
|
28
|
+
# @param [Hash] opts
|
29
|
+
# @return [String]
|
30
|
+
#
|
31
|
+
def text(opts = {}, &block)
|
32
|
+
opts[:class] = (opts[:class] || '') << " input-group-#{@type}"
|
33
|
+
|
34
|
+
content_tag :div, opts do
|
35
|
+
content_tag :span, class: 'input-group-text', &block
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Used to render out the InputGroup component.
|
40
|
+
#
|
41
|
+
# @return [String]
|
42
|
+
#
|
43
|
+
def to_s
|
44
|
+
content_tag(
|
45
|
+
:div,
|
46
|
+
id: @id,
|
47
|
+
class: "input-group #{@class}",
|
48
|
+
data: @data
|
49
|
+
) do
|
50
|
+
@content.call(self)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/lib/bootstrap4_helper.rb
CHANGED
@@ -457,6 +457,30 @@ module Bootstrap4Helper
|
|
457
457
|
PageHeader.new(self, opts, &block)
|
458
458
|
end
|
459
459
|
|
460
|
+
# Generates a input group component.
|
461
|
+
#
|
462
|
+
# ```erb
|
463
|
+
# <%= input_group_helper do |ig| %>
|
464
|
+
# <%= ig.text do %>
|
465
|
+
# <i class="fas fa-at"></i>
|
466
|
+
# <% end %>
|
467
|
+
# <input type="text" value="" name="email" placeholder="Email" class="form-control" />
|
468
|
+
# <% end %>
|
469
|
+
#
|
470
|
+
# <%= input_group_helper :append do |ig| %>
|
471
|
+
# <input type="text" value="" name="email" placeholder="Email" class="form-control" />
|
472
|
+
# <%= ig.text { "@" } %>
|
473
|
+
# <% end %>
|
474
|
+
# ```
|
475
|
+
#
|
476
|
+
# @param [Symbol] type
|
477
|
+
# @param [Hash] opts
|
478
|
+
# @return [String]
|
479
|
+
#
|
480
|
+
def input_group_helper(type = :prepend, opts = {}, &block)
|
481
|
+
InputGroup.new(self, type, opts, &block)
|
482
|
+
end
|
483
|
+
|
460
484
|
# Generates a Tab component.
|
461
485
|
#
|
462
486
|
# ```erb
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstrap4_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert David
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -44,6 +44,20 @@ dependencies:
|
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 4.3.1
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: font-awesome-sass
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
47
61
|
- !ruby/object:Gem::Dependency
|
48
62
|
name: jquery-rails
|
49
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,14 +78,14 @@ dependencies:
|
|
64
78
|
requirements:
|
65
79
|
- - "~>"
|
66
80
|
- !ruby/object:Gem::Version
|
67
|
-
version: 5.2
|
81
|
+
version: '5.2'
|
68
82
|
type: :development
|
69
83
|
prerelease: false
|
70
84
|
version_requirements: !ruby/object:Gem::Requirement
|
71
85
|
requirements:
|
72
86
|
- - "~>"
|
73
87
|
- !ruby/object:Gem::Version
|
74
|
-
version: 5.2
|
88
|
+
version: '5.2'
|
75
89
|
- !ruby/object:Gem::Dependency
|
76
90
|
name: redcarpet
|
77
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -154,6 +168,7 @@ files:
|
|
154
168
|
- lib/bootstrap4_helper/dropdown.rb
|
155
169
|
- lib/bootstrap4_helper/dropdown/menu.rb
|
156
170
|
- lib/bootstrap4_helper/initialize.rb
|
171
|
+
- lib/bootstrap4_helper/input_group.rb
|
157
172
|
- lib/bootstrap4_helper/modal.rb
|
158
173
|
- lib/bootstrap4_helper/nav.rb
|
159
174
|
- lib/bootstrap4_helper/page_header.rb
|