bootstrap3_helper 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bootstrap3_helper/accordion.rb +25 -6
- data/lib/bootstrap3_helper/tabs/content.rb +12 -3
- data/lib/bootstrap3_helper/tabs/dropdown.rb +19 -5
- data/lib/bootstrap3_helper/tabs/menu.rb +21 -5
- data/lib/bootstrap3_helper/version.rb +1 -1
- data/lib/bootstrap3_helper.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74e356782b2f424f78b9bd3731009d7ba7a1492a392e782c5cade487ea765a26
|
4
|
+
data.tar.gz: 7a8fb76f39fa53b9bdcebf6542239c58448e8caa88b725b5f47c4255ad31d80f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71bad603e6cf3834f68c6f216e1dcc3c0b0e88f76ef4a44c05bc9f101d4eba4271a9312caee0500ae2e317e35485ee9fdd214dc807c4d42422eb9a4acc090c20
|
7
|
+
data.tar.gz: 8f062f014b468ba1b8fb916666556a69b3ddb03cfa9e024738babe7480ffcb4ad55f3507672d69b98abcb55251c4d3ae664f6055bbca1cf2c7de9d21440fb632
|
@@ -67,16 +67,27 @@ module Bootstrap3Helper
|
|
67
67
|
#
|
68
68
|
# rubocop:disable Metrics/MethodLength
|
69
69
|
def header(args = {})
|
70
|
-
id
|
71
|
-
klass
|
72
|
-
data
|
70
|
+
id = args.fetch(:id, nil)
|
71
|
+
klass = args.fetch(:class, '')
|
72
|
+
data = args.fetch(:data, {})
|
73
73
|
|
74
74
|
data[:toggle] = 'collapse'
|
75
75
|
data[:parent] = "##{@parent_id}"
|
76
76
|
|
77
|
-
@header = content_tag
|
77
|
+
@header = content_tag(
|
78
|
+
:div,
|
79
|
+
id: id,
|
80
|
+
role: 'tab',
|
81
|
+
class: 'panel-heading ' + klass
|
82
|
+
) do
|
78
83
|
content_tag :h3, class: 'panel-title' do
|
79
|
-
content_tag
|
84
|
+
content_tag(
|
85
|
+
:a,
|
86
|
+
href: "##{@collapse_id}",
|
87
|
+
role: 'button',
|
88
|
+
data: data,
|
89
|
+
aria: { expanded: @expanded, controls: "##{@collapse_id}" }
|
90
|
+
) do
|
80
91
|
content = yield if block_given?
|
81
92
|
content.to_s.html_safe
|
82
93
|
end
|
@@ -104,19 +115,27 @@ module Bootstrap3Helper
|
|
104
115
|
# @return [nilClass]
|
105
116
|
#
|
106
117
|
#
|
118
|
+
# rubocop:disable Metrics/MethodLength
|
107
119
|
def body(args = {})
|
108
120
|
klass = 'panel-collapse collapse '
|
109
121
|
data = args.fetch(:data, {})
|
110
122
|
klass += args.fetch(:class, '')
|
111
123
|
klass += ' in' if @expanded
|
112
124
|
|
113
|
-
@body = content_tag
|
125
|
+
@body = content_tag(
|
126
|
+
:div,
|
127
|
+
id: @collapse_id,
|
128
|
+
role: 'tabpanel',
|
129
|
+
class: klass,
|
130
|
+
aria: { labelledby: "##{@collapse_id}" }
|
131
|
+
) do
|
114
132
|
content_tag :div, class: 'panel-body', data: data do
|
115
133
|
content = yield if block_given?
|
116
134
|
content.to_s.html_safe
|
117
135
|
end
|
118
136
|
end
|
119
137
|
end
|
138
|
+
# rubocop:enable Metrics/MethodLength
|
120
139
|
|
121
140
|
# @description
|
122
141
|
# - Creates the footer element for the accordion
|
@@ -40,10 +40,19 @@ module Bootstrap3Helper
|
|
40
40
|
# </code>
|
41
41
|
#
|
42
42
|
def item(name, args = {})
|
43
|
-
data
|
44
|
-
klass
|
43
|
+
data = args.fetch(:data, nil)
|
44
|
+
klass = args.fetch(:class, '')
|
45
|
+
active = klass.include? 'active'
|
45
46
|
|
46
|
-
content = content_tag
|
47
|
+
content = content_tag(
|
48
|
+
:div,
|
49
|
+
id: name,
|
50
|
+
class: "tab-pane fade #{active ? 'in' : ''} #{klass}",
|
51
|
+
aria: { hidden: active },
|
52
|
+
data: data,
|
53
|
+
role: 'tabpanel',
|
54
|
+
tabindex: -1
|
55
|
+
) do
|
47
56
|
yield if block_given?
|
48
57
|
end
|
49
58
|
|
@@ -44,19 +44,33 @@ module Bootstrap3Helper
|
|
44
44
|
# }
|
45
45
|
# </code>
|
46
46
|
#
|
47
|
+
# rubocop:disable Metrics/MethodLength
|
47
48
|
def item(name, args = {})
|
48
|
-
id
|
49
|
-
klass
|
50
|
-
data
|
49
|
+
id = args.fetch(:id, nil)
|
50
|
+
klass = args.fetch(:class, '')
|
51
|
+
data = args.fetch(:data, nil)
|
52
|
+
active = klass.include? 'active'
|
51
53
|
|
52
|
-
li = content_tag
|
53
|
-
|
54
|
+
li = content_tag(
|
55
|
+
:li,
|
56
|
+
id: id,
|
57
|
+
class: klass,
|
58
|
+
data: data
|
59
|
+
) do
|
60
|
+
content_tag(
|
61
|
+
:a,
|
62
|
+
href: "##{name}",
|
63
|
+
role: 'tab',
|
64
|
+
data: { toggle: 'tab' },
|
65
|
+
aria: { controls: name, expanded: active }
|
66
|
+
) do
|
54
67
|
block_given? ? yield : name.to_s.titleize
|
55
68
|
end
|
56
69
|
end
|
57
70
|
|
58
71
|
@items.push(li)
|
59
72
|
end
|
73
|
+
# rubocop:enable Metrics/MethodLength
|
60
74
|
|
61
75
|
# @description
|
62
76
|
# - Used to render out the object and get the HTML representation.
|
@@ -50,19 +50,35 @@ module Bootstrap3Helper
|
|
50
50
|
# }
|
51
51
|
# </code>
|
52
52
|
#
|
53
|
+
# rubocop:disable Metrics/MethodLength
|
53
54
|
def item(name, args = {})
|
54
|
-
id
|
55
|
-
data
|
56
|
-
klass
|
55
|
+
id = args.fetch(:id, nil)
|
56
|
+
data = args.fetch(:data, nil)
|
57
|
+
klass = args.fetch(:class, '')
|
58
|
+
active = klass.include? 'active'
|
57
59
|
|
58
|
-
li = content_tag
|
59
|
-
|
60
|
+
li = content_tag(
|
61
|
+
:li,
|
62
|
+
id: id,
|
63
|
+
class: klass,
|
64
|
+
data: data,
|
65
|
+
role: 'presentation'
|
66
|
+
) do
|
67
|
+
content_tag(
|
68
|
+
:a,
|
69
|
+
href: "##{name}",
|
70
|
+
role: 'tab',
|
71
|
+
tabindex: -1,
|
72
|
+
data: { toggle: 'tab' },
|
73
|
+
aria: { controls: "##{name}", expanded: active, selected: active }
|
74
|
+
) do
|
60
75
|
block_given? ? yield : name.to_s.titleize
|
61
76
|
end
|
62
77
|
end
|
63
78
|
|
64
79
|
@items.push(li)
|
65
80
|
end
|
81
|
+
# rubocop:enable Metrics/MethodLength
|
66
82
|
|
67
83
|
# @description
|
68
84
|
# - Used to create menu items that are Dropdowns
|
data/lib/bootstrap3_helper.rb
CHANGED
@@ -162,8 +162,8 @@ module Bootstrap3Helper
|
|
162
162
|
#
|
163
163
|
# @param [String|Symbol] name
|
164
164
|
#
|
165
|
-
def icon_helper(name
|
166
|
-
content_tag :span, '', class:
|
165
|
+
def icon_helper(name)
|
166
|
+
content_tag :span, '', class: "glyphicon glyphicon-#{name}"
|
167
167
|
end
|
168
168
|
|
169
169
|
# @description
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstrap3_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: 2019-07-
|
11
|
+
date: 2019-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -118,7 +118,7 @@ files:
|
|
118
118
|
- lib/bootstrap3_helper/tabs/menu.rb
|
119
119
|
- lib/bootstrap3_helper/version.rb
|
120
120
|
- lib/tasks/bootstrap3_helper_tasks.rake
|
121
|
-
homepage: https://github.com/rdavid369/bootstrap3-helper
|
121
|
+
homepage: https://github.com/rdavid369/bootstrap3-helper
|
122
122
|
licenses:
|
123
123
|
- MIT
|
124
124
|
metadata: {}
|