bootstrap3_helper 1.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.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +149 -0
- data/Rakefile +34 -0
- data/lib/bootstrap3_helper/accordion.rb +174 -0
- data/lib/bootstrap3_helper/accordion_group.rb +88 -0
- data/lib/bootstrap3_helper/alert.rb +88 -0
- data/lib/bootstrap3_helper/callout.rb +55 -0
- data/lib/bootstrap3_helper/component.rb +93 -0
- data/lib/bootstrap3_helper/panel.rb +107 -0
- data/lib/bootstrap3_helper/railtie.rb +10 -0
- data/lib/bootstrap3_helper/tabs/content.rb +67 -0
- data/lib/bootstrap3_helper/tabs/dropdown.rb +77 -0
- data/lib/bootstrap3_helper/tabs/menu.rb +101 -0
- data/lib/bootstrap3_helper/tabs.rb +103 -0
- data/lib/bootstrap3_helper/version.rb +3 -0
- data/lib/bootstrap3_helper.rb +219 -0
- data/lib/tasks/bootstrap3_helper_tasks.rake +4 -0
- metadata +145 -0
@@ -0,0 +1,219 @@
|
|
1
|
+
require 'bootstrap3_helper/version'
|
2
|
+
|
3
|
+
# Implementation files
|
4
|
+
require 'bootstrap3_helper/component'
|
5
|
+
require 'bootstrap3_helper/accordion'
|
6
|
+
require 'bootstrap3_helper/accordion_group'
|
7
|
+
require 'bootstrap3_helper/alert'
|
8
|
+
require 'bootstrap3_helper/callout'
|
9
|
+
require 'bootstrap3_helper/panel'
|
10
|
+
require 'bootstrap3_helper/tabs'
|
11
|
+
require 'bootstrap3_helper/tabs/content'
|
12
|
+
require 'bootstrap3_helper/tabs/dropdown'
|
13
|
+
require 'bootstrap3_helper/tabs/menu'
|
14
|
+
require 'bootstrap3_helper/railtie'
|
15
|
+
|
16
|
+
# @description
|
17
|
+
# - This helper module includes UI helpers that will help generate
|
18
|
+
# common Bootstrap components.
|
19
|
+
#
|
20
|
+
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...
|
29
|
+
# <% end %>
|
30
|
+
# <%= p.footer do %>
|
31
|
+
# //HTML or Ruby
|
32
|
+
# <% end %>
|
33
|
+
# <% end %>
|
34
|
+
# </code>
|
35
|
+
#
|
36
|
+
# @params [Symbol|String|Hash|NilClass] *args
|
37
|
+
# @return [String]
|
38
|
+
#
|
39
|
+
def panel_helper(*args)
|
40
|
+
panel = Panel.new(self, *args)
|
41
|
+
capture { yield(panel) if block_given? }
|
42
|
+
panel
|
43
|
+
end
|
44
|
+
|
45
|
+
# @description
|
46
|
+
# - Creates an Alert component.
|
47
|
+
#
|
48
|
+
# <code>
|
49
|
+
# <%= alert_helper :danger, dismissble: true do %>
|
50
|
+
# Something went wrong with your model data...
|
51
|
+
# <% end %>
|
52
|
+
# </code>
|
53
|
+
#
|
54
|
+
# @params [Symbol|String|Hash|NilClass] *args
|
55
|
+
# @return [String]
|
56
|
+
#
|
57
|
+
def alert_helper(*args, &block)
|
58
|
+
alert = Alert.new(self, *args, &block)
|
59
|
+
alert
|
60
|
+
end
|
61
|
+
|
62
|
+
# @description
|
63
|
+
# - Creates an Callout component.
|
64
|
+
#
|
65
|
+
# <code>
|
66
|
+
# <%= callout_helper :danger %>
|
67
|
+
# Some information that needs your attention...
|
68
|
+
# <% end %>
|
69
|
+
# </code>
|
70
|
+
#
|
71
|
+
# @params [Symbol|String|Hash|NilClass] *args
|
72
|
+
# @return [String]
|
73
|
+
#
|
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.
|
82
|
+
#
|
83
|
+
# @return [Boolean]
|
84
|
+
#
|
85
|
+
def host_is_dev_pc?
|
86
|
+
Rails.root.to_s.include?('home')
|
87
|
+
end
|
88
|
+
|
89
|
+
# @description
|
90
|
+
# - Easily build a bootstrap accordion group component.
|
91
|
+
#
|
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 :)
|
96
|
+
#
|
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>
|
119
|
+
#
|
120
|
+
# @yields [AccordionGroup] group
|
121
|
+
# @return [String]
|
122
|
+
#
|
123
|
+
def accordion_group_helper(*args)
|
124
|
+
group = AccordionGroup.new(self, *args)
|
125
|
+
capture { yield group if block_given? }
|
126
|
+
group
|
127
|
+
end
|
128
|
+
|
129
|
+
# @description
|
130
|
+
# - Easily build a bootstrap accordion component
|
131
|
+
#
|
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 %>
|
140
|
+
# <% end %>
|
141
|
+
# </code>
|
142
|
+
#
|
143
|
+
# @params [Symbol|String|Hash|NilClass] *args
|
144
|
+
# @return [String]
|
145
|
+
#
|
146
|
+
def accordion_helper(*args)
|
147
|
+
accordion = Accordion.new(self, *args)
|
148
|
+
capture { yield accordion if block_given? }
|
149
|
+
accordion
|
150
|
+
end
|
151
|
+
|
152
|
+
# @description
|
153
|
+
# - Allows you to rapidly build bootstrap glyphs.
|
154
|
+
#
|
155
|
+
# @note
|
156
|
+
# - Only supply the last part of the glyph makrup.
|
157
|
+
#
|
158
|
+
# <code>
|
159
|
+
# <span class"glyphicon glyphicon-pencil"></span>
|
160
|
+
# <%= icon_helper('pencil') %>
|
161
|
+
# </code>
|
162
|
+
#
|
163
|
+
# @param [String|Symbol] name
|
164
|
+
#
|
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
|
218
|
+
end
|
219
|
+
end
|
metadata
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bootstrap3_helper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Robert David
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-07-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bootstrap-sass
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.4.1
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.4.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: jquery-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '4.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '4.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rails
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 5.0.6
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 5.0.6
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sassc-rails
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.1.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.1.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: sqlite3
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.3.6
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.3.6
|
97
|
+
description: Simple gem for rapidly building bootstrap 3 components
|
98
|
+
email:
|
99
|
+
- rdavid369@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- MIT-LICENSE
|
105
|
+
- README.md
|
106
|
+
- Rakefile
|
107
|
+
- lib/bootstrap3_helper.rb
|
108
|
+
- lib/bootstrap3_helper/accordion.rb
|
109
|
+
- lib/bootstrap3_helper/accordion_group.rb
|
110
|
+
- lib/bootstrap3_helper/alert.rb
|
111
|
+
- lib/bootstrap3_helper/callout.rb
|
112
|
+
- lib/bootstrap3_helper/component.rb
|
113
|
+
- lib/bootstrap3_helper/panel.rb
|
114
|
+
- lib/bootstrap3_helper/railtie.rb
|
115
|
+
- lib/bootstrap3_helper/tabs.rb
|
116
|
+
- lib/bootstrap3_helper/tabs/content.rb
|
117
|
+
- lib/bootstrap3_helper/tabs/dropdown.rb
|
118
|
+
- lib/bootstrap3_helper/tabs/menu.rb
|
119
|
+
- lib/bootstrap3_helper/version.rb
|
120
|
+
- lib/tasks/bootstrap3_helper_tasks.rake
|
121
|
+
homepage: https://github.com/rdavid369/bootstrap3-helper/blob/master/lib/bootstrap3_helper.rb
|
122
|
+
licenses:
|
123
|
+
- MIT
|
124
|
+
metadata: {}
|
125
|
+
post_install_message:
|
126
|
+
rdoc_options: []
|
127
|
+
require_paths:
|
128
|
+
- lib
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
requirements: []
|
140
|
+
rubyforge_project:
|
141
|
+
rubygems_version: 2.7.6
|
142
|
+
signing_key:
|
143
|
+
specification_version: 4
|
144
|
+
summary: Simple gem for rapidly building bootstrap 3 components
|
145
|
+
test_files: []
|