bootstrap3_helper 1.0.0 → 3.0.0

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,4 +1,6 @@
1
1
  require 'bootstrap3_helper/version'
2
+ require 'bootstrap3_helper/configuration'
3
+ require 'bootstrap3_helper/initialize'
2
4
 
3
5
  # Implementation files
4
6
  require 'bootstrap3_helper/component'
@@ -13,207 +15,236 @@ require 'bootstrap3_helper/tabs/dropdown'
13
15
  require 'bootstrap3_helper/tabs/menu'
14
16
  require 'bootstrap3_helper/railtie'
15
17
 
16
- # @description
17
- # - This helper module includes UI helpers that will help generate
18
+ # This helper module includes UI helpers that will help generate
18
19
  # common Bootstrap components.
19
20
  #
20
21
  module Bootstrap3Helper
21
- # @description
22
- # - Allows you to rapidly build Panel components.
23
- #
24
- # <code>
25
- # <%= panel_helper :primary do |p| %>
26
- # <%= p.header { "Some Title" }
27
- # <%= p.body class: 'custom-class', id: 'custom-id' do %>
28
- # //HTML or Ruby code here...
22
+ # Easily build a bootstrap accordion group component.
23
+ #
24
+ # @note All the element ids and data attributes needed to make the javascript
25
+ # function, are all synced up in the AccordionGroup and Accordion classes.
26
+ # You don't need to worry about them.
27
+ #
28
+ # @example Bootstrap Accordion Group Component:
29
+ # ```erb
30
+ # <%= accordion_group_helper do |group| %>
31
+ # <% group.accordion class: 'primary' do |accordion| %>
32
+ # <%= accordion.header { "accordion 1" } %>
33
+ # <%= accordion.body do %>
34
+ # <p>This is accordion 1</p>
35
+ # <% end %>
29
36
  # <% end %>
30
- # <%= p.footer do %>
31
- # //HTML or Ruby
37
+ # <% group.accordion class: 'info' do |accordion| %>
38
+ # <%= accordion.header { "accordion 2" } %>
39
+ # <%= accordion.body do %>
40
+ # <p>This is accordion 2</p>
41
+ # <% end %>
42
+ # <% end %>
43
+ # <% group.accordion class: 'danger' do |accordion| %>
44
+ # <%= accordion.header { "accordion 3" } %>
45
+ # <%= accordion.body do %>
46
+ # <p>This is accordion 3</p>
47
+ # <% end %>
32
48
  # <% end %>
33
49
  # <% end %>
34
- # </code>
50
+ # ```
51
+ #
52
+ # @param [Hash] opts
53
+ # @option opts [String] :id
54
+ # @option opts [String] :class
55
+ # @yieldparam [AccordionGroup] group
56
+ # @return [String]
57
+ #
58
+ def accordion_group_helper(opts = {}, &block)
59
+ AccordionGroup.new(self, opts, &block)
60
+ end
61
+
62
+ # Easily build a bootstrap accordion component
63
+ #
64
+ # @example Bootstrap Panel Component:
65
+ # ```erb
66
+ # <%= accordion_helper class: 'primary' do |accordion| %>
67
+ # <%= accordion.header do %>
68
+ # <span class="something">This is the heading....</span>
69
+ # <% end %>
70
+ # <%= accordion.body do %>
71
+ # <p>This is the body of the accordion....</p>
72
+ # <% end %>
73
+ # <% end %>
74
+ # ```
75
+ #
76
+ # @overload accordion_helper(context, opts)
77
+ # @param [Symbol|String] context - :primary, :danger etc
78
+ # @param [Hash] opts
79
+ # @option opts [String] :id
80
+ # @option opts [String] :class
81
+ #
82
+ # @overload accordion_helper(opts)
83
+ # @param [Hash] opts
84
+ # @option opts [String] :id
85
+ # @option opts [String] :class
35
86
  #
36
- # @params [Symbol|String|Hash|NilClass] *args
87
+ # @yieldparam [Accordion] accordion
37
88
  # @return [String]
38
89
  #
39
- def panel_helper(*args)
40
- panel = Panel.new(self, *args)
41
- capture { yield(panel) if block_given? }
42
- panel
90
+ def accordion_helper(*args, &block)
91
+ Accordion.new(self, *args, &block)
43
92
  end
44
93
 
45
- # @description
46
- # - Creates an Alert component.
94
+ # Creates an Alert component.
47
95
  #
48
- # <code>
96
+ # @example Bootstrap Alert Component:
97
+ # ```erb
49
98
  # <%= alert_helper :danger, dismissble: true do %>
50
99
  # Something went wrong with your model data...
51
100
  # <% end %>
52
- # </code>
101
+ # ```
102
+ #
103
+ # @overload alert_helper(context, opts)
104
+ # @param [Symbol|String] context - :primary, :danger etc
105
+ # @param [Hash] opts
106
+ # @option opts [String] :id
107
+ # @option opts [String] :class
108
+ # @option opts [Boolean] :dismissible
109
+ #
110
+ # @overload alert_helper(opts)
111
+ # @param [Hash] opts
112
+ # @option opts [String] :id
113
+ # @option opts [String] :class
53
114
  #
54
- # @params [Symbol|String|Hash|NilClass] *args
55
115
  # @return [String]
56
116
  #
57
117
  def alert_helper(*args, &block)
58
- alert = Alert.new(self, *args, &block)
59
- alert
118
+ Alert.new(self, *args, &block)
60
119
  end
61
120
 
62
- # @description
63
- # - Creates an Callout component.
121
+ # Creates an Callout component.
64
122
  #
65
- # <code>
123
+ # @example Bootstrap Callout Component:
124
+ # ```erb
66
125
  # <%= callout_helper :danger %>
67
126
  # Some information that needs your attention...
68
127
  # <% end %>
69
- # </code>
128
+ # ```
70
129
  #
71
- # @params [Symbol|String|Hash|NilClass] *args
72
- # @return [String]
130
+ # @overload callout_helper(context, opts)
131
+ # @param [Symbol|String] context - :primary, :danger etc
132
+ # @param [Hash] opts
133
+ # @option opts [String] :id
134
+ # @option opts [String] :class
73
135
  #
74
- def callout_helper(*args, &block)
75
- callout = Callout.new(self, *args, &block)
76
- callout
77
- end
78
-
79
- # @description
80
- # - Just a easy way of checking if the environment is a devbox
81
- # or a server.
136
+ # @overload callout_helper(opts)
137
+ # @param [Hash] opts
138
+ # @option opts [String] :id
139
+ # @option opts [String] :class
82
140
  #
83
- # @return [Boolean]
141
+ # @return [String]
84
142
  #
85
- def host_is_dev_pc?
86
- Rails.root.to_s.include?('home')
143
+ def callout_helper(*args, &block)
144
+ Callout.new(self, *args, &block)
87
145
  end
88
146
 
89
- # @description
90
- # - Easily build a bootstrap accordion group component.
147
+ # Allows you to rapidly build bootstrap glyphs.
91
148
  #
92
- # @note
93
- # - All the element ids and data attributes needed to make the javascript
94
- # function, are all synced up in the AccordionGroup and Accordion classes.
95
- # You don't need to worry about them :)
149
+ # @note Only supply the last part of the glyph makrup.
96
150
  #
97
- # <code>
98
- # <%= accordion_group_helper do |group| %>
99
- # <% group.accordion class: 'primary' do |accordion| %>
100
- # <%= accordion.header { "accordion 1" } %>
101
- # <%= accordion.body do %>
102
- # <p>This is accordion 1</p>
103
- # <% end %>
104
- # <%end %>
105
- # <% group.accordion class: 'info' do |accordion| %>
106
- # <%= accordion.header { "accordion 2" } %>
107
- # <%= accordion.body do %>
108
- # <p>This is accordion 2</p>
109
- # <% end %>
110
- # <%end %>
111
- # <% group.accordion class: 'danger' do |accordion| %>
112
- # <%= accordion.header { "accordion 3" } %>
113
- # <%= accordion.body do %>
114
- # <p>This is accordion 3</p>
115
- # <% end %>
116
- # <%end %>
117
- # <% end %>
118
- # </code>
151
+ # @example Bootstrap Glyphicon Component:
152
+ # <%= icon_helper('pencil') %>
119
153
  #
120
- # @yields [AccordionGroup] group
121
- # @return [String]
154
+ # @param [String|Symbol] name
122
155
  #
123
- def accordion_group_helper(*args)
124
- group = AccordionGroup.new(self, *args)
125
- capture { yield group if block_given? }
126
- group
156
+ def icon_helper(name)
157
+ content_tag :span, '', class: "glyphicon glyphicon-#{name}"
127
158
  end
128
159
 
129
- # @description
130
- # - Easily build a bootstrap accordion component
160
+ # Allows you to rapidly build Panel components.
131
161
  #
132
- # <code>
133
- # <%= accordion_helper class: 'primary' do |accordion| %>
134
- # <%= accordion.header do %>
135
- # <span class="something">This is the heading....</span>
136
- # <% end %>
137
- # <%= accordion.body do %>
138
- # <p>This is the body of the accordion....</p>
139
- # <% end %>
162
+ # @example Bootstrap Panel Component:
163
+ # ```erb
164
+ # <%= panel_helper :default do |p| %>
165
+ # <%= p.header do %>
166
+ # <%= p.title { 'Some random text here' } %>
140
167
  # <% end %>
141
- # </code>
142
- #
143
- # @params [Symbol|String|Hash|NilClass] *args
168
+ # <%= p.body do %>
169
+ # //HTML & Ruby
170
+ # <% end %>
171
+ # <% end %>
172
+ # ```
173
+ #
174
+ # @overload panel_helper(context, opts)
175
+ # @param [String|Symbol] context - :primary, :danger etc
176
+ # @param [Hash] opts
177
+ # @option opts [String] :id
178
+ # @option opts [String] :class
179
+ # @option opts [Hash] :data
180
+ # @option opts [Hash] :aria
181
+ #
182
+ # @overload panel_helper(opts)
183
+ # @param [Hash] opts
184
+ # @option opts [String] :id
185
+ # @option opts [String] :class
186
+ # @option opts [Hash] :data
187
+ # @option opts [Hash] :aria
188
+ #
189
+ # @yieldparam [Panel] panel
144
190
  # @return [String]
145
191
  #
146
- def accordion_helper(*args)
147
- accordion = Accordion.new(self, *args)
148
- capture { yield accordion if block_given? }
149
- accordion
192
+ def panel_helper(*args, &block)
193
+ Panel.new(self, *args, &block)
150
194
  end
151
195
 
152
- # @description
153
- # - Allows you to rapidly build bootstrap glyphs.
154
- #
155
- # @note
156
- # - Only supply the last part of the glyph makrup.
196
+ # Used to rapidly build Tabs.
197
+ #
198
+ # @note On menu items - you can pass in either symbol or string for the link. If
199
+ # you pass in a block, it will use the block for the title of the li. If no
200
+ # block is present, then it will titleize the symbol or string.
201
+ # Tabs::Menu will respond to <code>item</code> and <code>dropdown</code>
202
+ # Each method will yield the corresponding component, either a Tabs::Menu
203
+ # or a Tabs::Dropdown.
204
+ #
205
+ # @example Bootstrap Tabs Component:
206
+ # <%= tabs_helper type: :pills do |tabs| %>
207
+ # <%= tabs.menu do |menu| %>
208
+ # <%= menu.item(:testing1, class: 'active') { ' Testing 1' } %>
209
+ # <%= menu.item :testing2 %>
210
+ # <%= menu.item(:testing3) { ' Testing 3' } %>
211
+ # <%= menu.dropdown 'Testing Dropdown' do |dropdown| %>
212
+ # <%= dropdown.item(:testing5 ) { 'Testing 5' } %>
213
+ # <%= dropdown.item(:testing6 ) { 'Testing 6' } %>
214
+ # <%= dropdown.item(:testing7 ) { 'Testing 7' } %>
215
+ # <% end %>
216
+ # <% end %>
157
217
  #
158
- # <code>
159
- # <span class"glyphicon glyphicon-pencil"></span>
160
- # <%= icon_helper('pencil') %>
161
- # </code>
218
+ # <%= tabs.content do |content| %>
219
+ # <%= content.pane :testing1, class: 'active' do %>
220
+ # Testing 1 content
221
+ # <% end %>
222
+ # <%= content.pane :testing2 do %>
223
+ # Testing 2 content
224
+ # <% end %>
225
+ # <%= content.pane :testing3 do %>
226
+ # Testing 3 content
227
+ # <% end %>
228
+ # <%= content.pane :testing5 do %>
229
+ # Testing 5 content
230
+ # <% end %>
231
+ # <%= content.pane :testing6 do %>
232
+ # Testing 6 content
233
+ # <% end %>
234
+ # <%= content.pane :testing7 do %>
235
+ # Testing 7 content
236
+ # <% end %>
237
+ # <% end %>
238
+ # <% end %>
162
239
  #
163
- # @param [String|Symbol] name
240
+ # @param [Hash] opts
241
+ # @option args [String|Symbol] :type
242
+ # @option args [String] :id
243
+ # @option args [String] :class
244
+ # @yieldparam [Tabs] tabs
245
+ # @return [String]
164
246
  #
165
- def icon_helper(name = '')
166
- content_tag :span, '', class: 'glyphicon glyphicon-' + name.to_s
167
- end
168
-
169
- # @description
170
- # - Used to rapidly build Tabs.
171
- #
172
- # @note
173
- # - On menu items - you can pass in either symbol or string for the link. If
174
- # you pass in a block, it will use the block for the title of the li. If no
175
- # block is present, then it will titleize the symbol or string.
176
- #
177
- # Tabs::Menu will respond to <code>item</code> and <code>dropdown</code>
178
- # Each method will yield the corresponding component, either a Tabs::Menu
179
- # or a Tabs::Dropdown.
180
- #
181
- # <code>
182
- # <%= tabs_helper type: :pills do |menu, content| %>
183
- # <% menu.item(:testing1, class: 'active') { ' Testing 1' } %>
184
- # <% menu.item :testing2 %>
185
- # <% menu.item(:testing3) { ' Testing 3' } %>
186
- # <% menu.dropdown 'Testing Dropdown' do |dropdown| %>
187
- # <%= dropdown.item(:testing5 ) { 'Testing 5' } %>
188
- # <%= dropdown.item(:testing6 ) { 'Testing 6' } %>
189
- # <%= dropdown.item(:testing7 ) { 'Testing 7' } %>
190
- # <% end %>
191
- #
192
- #
193
- # <% content.item :testing1, class: 'active' do %>
194
- # Testing 1 content
195
- # <% end %>
196
- # <% content.item :testing2 do %>
197
- # Testing 2 content
198
- # <% end %>
199
- # <% content.item :testing3 do %>
200
- # Testing 3 content
201
- # <% end %>
202
- # <% content.item :testing5 do %>
203
- # Testing 5 content
204
- # <% end %>
205
- # <% content.item :testing6 do %>
206
- # Testing 6 content
207
- # <% end %>
208
- # <% content.item :testing7 do %>
209
- # Testing 7 content
210
- # <% end %>
211
- # <% end %>
212
- # </code>
213
- #
214
- def tabs_helper(args = {})
215
- tabs = Tabs.new(self, args)
216
- capture { yield(tabs.menu, tabs.content) if block_given? }
217
- tabs
247
+ def tabs_helper(opts = {}, &block)
248
+ Tabs.new(self, opts, &block)
218
249
  end
219
250
  end
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.0
4
+ version: 3.0.0
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-04 00:00:00.000000000 Z
11
+ date: 2022-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -58,14 +58,42 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 5.0.6
61
+ version: 5.2.4
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 5.0.6
68
+ version: 5.2.4
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: solargraph
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'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: sassc-rails
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -110,6 +138,8 @@ files:
110
138
  - lib/bootstrap3_helper/alert.rb
111
139
  - lib/bootstrap3_helper/callout.rb
112
140
  - lib/bootstrap3_helper/component.rb
141
+ - lib/bootstrap3_helper/configuration.rb
142
+ - lib/bootstrap3_helper/initialize.rb
113
143
  - lib/bootstrap3_helper/panel.rb
114
144
  - lib/bootstrap3_helper/railtie.rb
115
145
  - lib/bootstrap3_helper/tabs.rb
@@ -118,7 +148,7 @@ files:
118
148
  - lib/bootstrap3_helper/tabs/menu.rb
119
149
  - lib/bootstrap3_helper/version.rb
120
150
  - lib/tasks/bootstrap3_helper_tasks.rake
121
- homepage: https://github.com/rdavid369/bootstrap3-helper/blob/master/lib/bootstrap3_helper.rb
151
+ homepage: https://github.com/rdavid369/bootstrap3-helper
122
152
  licenses:
123
153
  - MIT
124
154
  metadata: {}
@@ -137,8 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
167
  - !ruby/object:Gem::Version
138
168
  version: '0'
139
169
  requirements: []
140
- rubyforge_project:
141
- rubygems_version: 2.7.6
170
+ rubygems_version: 3.1.6
142
171
  signing_key:
143
172
  specification_version: 4
144
173
  summary: Simple gem for rapidly building bootstrap 3 components