bootstrap-helpers 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'rails'
4
+
5
+ group :development do
6
+ gem "bundler"
7
+ gem "jeweler", "~> 1.8.4"
8
+ end
@@ -0,0 +1,93 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ actionmailer (3.2.8)
5
+ actionpack (= 3.2.8)
6
+ mail (~> 2.4.4)
7
+ actionpack (3.2.8)
8
+ activemodel (= 3.2.8)
9
+ activesupport (= 3.2.8)
10
+ builder (~> 3.0.0)
11
+ erubis (~> 2.7.0)
12
+ journey (~> 1.0.4)
13
+ rack (~> 1.4.0)
14
+ rack-cache (~> 1.2)
15
+ rack-test (~> 0.6.1)
16
+ sprockets (~> 2.1.3)
17
+ activemodel (3.2.8)
18
+ activesupport (= 3.2.8)
19
+ builder (~> 3.0.0)
20
+ activerecord (3.2.8)
21
+ activemodel (= 3.2.8)
22
+ activesupport (= 3.2.8)
23
+ arel (~> 3.0.2)
24
+ tzinfo (~> 0.3.29)
25
+ activeresource (3.2.8)
26
+ activemodel (= 3.2.8)
27
+ activesupport (= 3.2.8)
28
+ activesupport (3.2.8)
29
+ i18n (~> 0.6)
30
+ multi_json (~> 1.0)
31
+ arel (3.0.2)
32
+ builder (3.0.0)
33
+ erubis (2.7.0)
34
+ git (1.2.5)
35
+ hike (1.2.1)
36
+ i18n (0.6.0)
37
+ jeweler (1.8.4)
38
+ bundler (~> 1.0)
39
+ git (>= 1.2.5)
40
+ rake
41
+ rdoc
42
+ journey (1.0.4)
43
+ json (1.7.4)
44
+ mail (2.4.4)
45
+ i18n (>= 0.4.0)
46
+ mime-types (~> 1.16)
47
+ treetop (~> 1.4.8)
48
+ mime-types (1.19)
49
+ multi_json (1.3.6)
50
+ polyglot (0.3.3)
51
+ rack (1.4.1)
52
+ rack-cache (1.2)
53
+ rack (>= 0.4)
54
+ rack-ssl (1.3.2)
55
+ rack
56
+ rack-test (0.6.1)
57
+ rack (>= 1.0)
58
+ rails (3.2.8)
59
+ actionmailer (= 3.2.8)
60
+ actionpack (= 3.2.8)
61
+ activerecord (= 3.2.8)
62
+ activeresource (= 3.2.8)
63
+ activesupport (= 3.2.8)
64
+ bundler (~> 1.0)
65
+ railties (= 3.2.8)
66
+ railties (3.2.8)
67
+ actionpack (= 3.2.8)
68
+ activesupport (= 3.2.8)
69
+ rack-ssl (~> 1.3.2)
70
+ rake (>= 0.8.7)
71
+ rdoc (~> 3.4)
72
+ thor (>= 0.14.6, < 2.0)
73
+ rake (0.9.2.2)
74
+ rdoc (3.12)
75
+ json (~> 1.4)
76
+ sprockets (2.1.3)
77
+ hike (~> 1.2)
78
+ rack (~> 1.0)
79
+ tilt (~> 1.1, != 1.3.0)
80
+ thor (0.15.4)
81
+ tilt (1.3.3)
82
+ treetop (1.4.10)
83
+ polyglot
84
+ polyglot (>= 0.3.1)
85
+ tzinfo (0.3.33)
86
+
87
+ PLATFORMS
88
+ ruby
89
+
90
+ DEPENDENCIES
91
+ bundler
92
+ jeweler (~> 1.8.4)
93
+ rails
@@ -0,0 +1,152 @@
1
+ # bootstrap-helpers
2
+ ## Rails bootstrap helpers
3
+
4
+ ### Install
5
+
6
+ ``` rb
7
+ gem "bootstrap-helpers"
8
+ ```
9
+
10
+ ## List of helpers
11
+
12
+ ### Scaffold
13
+
14
+ * `container(opts = {}, &block)`
15
+ * `row(opts = {}, &block)`
16
+ * `span(size, opts = {}, &block)`
17
+ * `icon(icon_id)`
18
+
19
+ *eg*
20
+
21
+ ``` erb
22
+ <%= container :id => "main" do %>
23
+ <%= row :class => "myRow" do %>
24
+ <%= span 5, :offset => 2 do %>
25
+ <p>Span content</p>
26
+ <% end %>
27
+ <% end %>
28
+ <% end %>
29
+ ```
30
+
31
+ Passing `:fluid => true` to `container` will set the layout to fluid and thus rows will be builded accordingly as `row-fluid`.
32
+
33
+ ### Base CSS
34
+
35
+ * `button(*args, &block)`
36
+ * `form_actions(&block)`
37
+
38
+ *eg*
39
+
40
+ ``` erb
41
+ <%= button "New Post", new_post_path, :type => :primary %>
42
+ ```
43
+
44
+ ### Navigation
45
+
46
+ * `navbar(*args, &block)`
47
+ * `nav(options = {}, &block)`
48
+ * `pills(options = {}, &block)`
49
+ * `nav_header(title)`
50
+ * `nav_list(options = {}, &block)`
51
+ * `dropdown_nav_item(label, opts = {}, &block)`
52
+ * `nav_item(*args, &block)`
53
+ * `brand(*args, &block)`
54
+
55
+ ``` erb
56
+ <%= navbar :fixed => :top do %>
57
+ <%= brand app_name, "/" %>
58
+ <% end %>
59
+ ```
60
+
61
+ ``` erb
62
+ <%= nav do %>
63
+ <%= nav_item "Homepage", "/", :icon => "home" , :icon_color => :white %>
64
+ <%= dropdown_nav_item "Account", :icon => "user" , :icon_color => :white do %>
65
+ <%= nav_item 'Logout', destroy_user_session_path, :method => :delete %>
66
+ <% end %>
67
+ <% end %>
68
+ ```
69
+
70
+ ``` erb
71
+ <%= nav_list do %>
72
+ <%= nav_header "Website" %>
73
+ <%= nav_item "Pages", admin_pages_path %>
74
+ <%= nav_item "Menus", admin_menus_path %>
75
+
76
+ <%= nav_header "Contents" %>
77
+ <%= nav_item "Photogalleries", admin_photogalleries_path %>
78
+ <%= nav_item "Posts", admin_posts_path %>
79
+
80
+ <%= nav_header "Users" %>
81
+ <%= nav_item "Users", admin_users_path %>
82
+ <% end %>
83
+ ```
84
+
85
+ ### Components
86
+
87
+ * `tabs(opts = {})`
88
+ * `accordion(opts = {})`
89
+ * `alert(message)`
90
+
91
+
92
+ ``` erb
93
+ <%= accordion do |a| %>
94
+
95
+ <%= a.pane "Pane1" do %>
96
+ Content 1
97
+ <% end %>
98
+
99
+ <%= a.pane "Pane2" do %>
100
+ Content 2
101
+ <% end %>
102
+
103
+ <%= a.pane "Pane3" do %>
104
+ Content 3
105
+ <% end %>
106
+
107
+ <% end %>
108
+ ```
109
+
110
+
111
+ ``` erb
112
+ <%= tabs do |t| %>
113
+
114
+ <%= t.pane "Pane1" do %>
115
+ Content 1
116
+ <% end %>
117
+
118
+ <%= t.pane "Pane2" do %>
119
+ Content 2
120
+ <% end %>
121
+
122
+ <%= t.pane "Pane3" do %>
123
+ Content 3
124
+ <% end %>
125
+
126
+ <% end %>
127
+ ```
128
+
129
+ ---
130
+
131
+ Copyright (c) 2012 mcasimir
132
+
133
+ MIT License
134
+
135
+ Permission is hereby granted, free of charge, to any person obtaining
136
+ a copy of this software and associated documentation files (the
137
+ "Software"), to deal in the Software without restriction, including
138
+ without limitation the rights to use, copy, modify, merge, publish,
139
+ distribute, sublicense, and/or sell copies of the Software, and to
140
+ permit persons to whom the Software is furnished to do so, subject to
141
+ the following conditions:
142
+
143
+ The above copyright notice and this permission notice shall be
144
+ included in all copies or substantial portions of the Software.
145
+
146
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
147
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
148
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
149
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
150
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
151
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
152
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,53 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "bootstrap-helpers"
18
+ gem.homepage = "http://github.com/mcasimir/kaminari-bootstrap"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Rails bootstrap helpers}
21
+ gem.description = %Q{Rails bootstrap helpers}
22
+ gem.email = "maurizio.cas@gmail.com"
23
+ gem.authors = ["mcasimir"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+
29
+ task :push do
30
+ message = ENV["message"] || "commit #{Time.now}"
31
+ `git add . && git commit -a -m '#{message}' && git push`
32
+ end
33
+
34
+ task "release:patch" do
35
+ Rake::Task["gemspec"].invoke
36
+ Rake::Task["version:bump:patch"]
37
+ Rake::Task["push"].invoke
38
+ Rake::Task["release"].invoke
39
+ end
40
+
41
+ task "release:minor" do
42
+ Rake::Task["gemspec"].invoke
43
+ Rake::Task["version:bump:minor"]
44
+ Rake::Task["push"].invoke
45
+ Rake::Task["release"].invoke
46
+ end
47
+
48
+ task "release:major" do
49
+ Rake::Task["gemspec"].invoke
50
+ Rake::Task["version:bump:major"]
51
+ Rake::Task["push"].invoke
52
+ Rake::Task["release"].invoke
53
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.1
@@ -0,0 +1,51 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "bootstrap-helpers"
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["mcasimir"]
12
+ s.date = "2012-08-11"
13
+ s.description = "Rails bootstrap helpers"
14
+ s.email = "maurizio.cas@gmail.com"
15
+ s.extra_rdoc_files = [
16
+ "README.md"
17
+ ]
18
+ s.files = [
19
+ "Gemfile",
20
+ "Gemfile.lock",
21
+ "README.md",
22
+ "Rakefile",
23
+ "VERSION",
24
+ "bootstrap-helpers.gemspec",
25
+ "lib/bootstrap-helpers.rb"
26
+ ]
27
+ s.homepage = "http://github.com/mcasimir/kaminari-bootstrap"
28
+ s.licenses = ["MIT"]
29
+ s.require_paths = ["lib"]
30
+ s.rubygems_version = "1.8.24"
31
+ s.summary = "Rails bootstrap helpers"
32
+
33
+ if s.respond_to? :specification_version then
34
+ s.specification_version = 3
35
+
36
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
37
+ s.add_runtime_dependency(%q<rails>, [">= 0"])
38
+ s.add_development_dependency(%q<bundler>, [">= 0"])
39
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
40
+ else
41
+ s.add_dependency(%q<rails>, [">= 0"])
42
+ s.add_dependency(%q<bundler>, [">= 0"])
43
+ s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
44
+ end
45
+ else
46
+ s.add_dependency(%q<rails>, [">= 0"])
47
+ s.add_dependency(%q<bundler>, [">= 0"])
48
+ s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
49
+ end
50
+ end
51
+
@@ -0,0 +1,331 @@
1
+ # Author:: Maurizio Casimirri (mailto:maurizio.cas@gmail.com)
2
+ # Copyright:: Copyright (c) 2012 Maurizio Casimirri
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+
23
+ module BootstrapHelpers
24
+
25
+ # ============
26
+ # = Scaffold =
27
+ # ============
28
+
29
+ def bootstrap_container_class
30
+ bootstrap_fluid? ? "container-fluid" : "container"
31
+ end
32
+
33
+ def bootstrap_row_class
34
+ bootstrap_fluid? ? "row-fluid" : "row"
35
+ end
36
+
37
+ def bootstrap_fluid!
38
+ @bootstrap_float_style = true
39
+ end
40
+
41
+ def bootstrap_fluid?
42
+ !!@bootstrap_float_style
43
+ end
44
+
45
+ def container(opts = {}, &block)
46
+ if opts.delete(:fluid)
47
+ bootstrap_fluid!
48
+ end
49
+
50
+ opts[:class] = ("#{opts[:class]}".split(" ") + [bootstrap_container_class]).join(" ")
51
+ content_tag("div", opts, &block)
52
+ end
53
+
54
+ def row(opts = {}, &block)
55
+
56
+ opts[:class] = ("#{opts[:class]}".split(" ") + [bootstrap_row_class]).join(" ")
57
+ content_tag("div", opts, &block)
58
+ end
59
+
60
+ def span(size, opts = {}, &block)
61
+ offset = opts.delete(:offset)
62
+ class_arr = ("#{opts[:class]}".split(" ") + ["span#{size}"])
63
+ if offset
64
+ class_arr << "offset#{offset}"
65
+ end
66
+
67
+ opts[:class] = class_arr.join(" ")
68
+ content_tag("div", opts, &block)
69
+
70
+ end
71
+
72
+ def icon(icon_id)
73
+ "<i class=\"icon icon-#{icon_id}\"></i>".html_safe
74
+ end
75
+
76
+ # ============
77
+ # = Base CSS =
78
+ # ============
79
+
80
+
81
+ def button(*args, &block)
82
+ if !block_given?
83
+ opts = args.extract_options!
84
+ is_link = (!!args.second) || (args.any? && block_given?)
85
+
86
+ icon = opts.delete(:icon)
87
+ type_opt = opts.delete(:type)
88
+ kind = type_opt ? "btn-#{type_opt}" : nil
89
+ size_opt = opts.delete(:size)
90
+ size = size_opt ? "btn-#{size_opt}" : nil
91
+ klasses = ("#{opts[:class]}".split(/\s+/) + ["btn", kind, size]).compact.uniq
92
+ opts[:class] = klasses.join(" ")
93
+ if icon
94
+ icon_color = opts.delete(:icon_color)
95
+ classes = [icon, icon_color].compact.map {|c| "icon-#{c}"}.join(" ")
96
+ args.unshift "<i class=\"#{classes}\"></i> #{args.shift}".html_safe
97
+ end
98
+
99
+ args << opts
100
+ end
101
+
102
+ if is_link
103
+ link_to(*args, &block)
104
+ else
105
+ content_tag('button', *args, &block)
106
+ end
107
+
108
+ end
109
+
110
+ alias :btn :button
111
+
112
+
113
+ def form_actions(&block)
114
+ content_tag :div, :class => "form-actions", &block
115
+ end
116
+
117
+ def alert(message)
118
+ "<div class='alert'>#{h(message)}</div>".html_safe
119
+ end
120
+
121
+
122
+ # ==============
123
+ # = Navigation =
124
+ # ==============
125
+
126
+ def navbar(*args, &block)
127
+ opts = args.extract_options!
128
+ html = <<-STR
129
+ <div class="navbar#{opts[:fixed].present? ? ' navbar-fixed-' + opts[:fixed].to_s : ''}">
130
+ <div class="navbar-inner">
131
+ <div class="#{bootstrap_container_class}">
132
+ #{capture(&block)}
133
+ </div>
134
+ </div>
135
+ </div>
136
+ STR
137
+
138
+ html.html_safe
139
+ end
140
+
141
+
142
+ def nav(options = {}, &block)
143
+ "<ul class=\"nav #{options[:class]}\">#{capture(&block)}</ul>".html_safe
144
+ end
145
+
146
+ def pills(options = {}, &block)
147
+ "<ul class=\"nav nav-pills #{options[:class]}\">#{capture(&block)}</ul>".html_safe
148
+ end
149
+
150
+ def nav_header(txt)
151
+ "<li class=\"nav-header\">#{txt}</li>".html_safe
152
+ end
153
+
154
+ def nav_list(options = {}, &block)
155
+ "<ul class=\"nav nav-list #{options[:class]}\">#{capture(&block)}</ul>".html_safe
156
+ end
157
+
158
+ def dropdown_nav_item(label, opts = {}, &block)
159
+ icon = opts.delete(:icon)
160
+ if icon
161
+ icon_color = opts.delete(:icon_color)
162
+ classes = [icon, icon_color].compact.map {|c| "icon-#{c}"}.join(" ")
163
+ label = "<i class=\"#{classes}\"></i> #{label}".html_safe
164
+ end
165
+
166
+ html = <<-STR
167
+ <li class="dropdown">
168
+ <a class="dropdown-toggle"
169
+ data-toggle="dropdown"
170
+ href="#">
171
+ #{label}
172
+ <b class="caret"></b>
173
+ </a>
174
+ <ul class="dropdown-menu">#{capture(&block)}</ul></li>
175
+ STR
176
+ html.html_safe
177
+ end
178
+
179
+
180
+ def nav_item(*args, &block)
181
+ if !block_given?
182
+ opts = args.extract_options!
183
+ icon = opts.delete(:icon)
184
+ float = opts.delete(:float)
185
+ if icon
186
+ icon_color = opts.delete(:icon_color)
187
+ classes = [icon, icon_color].compact.map {|c| "icon-#{c}"}.join(" ")
188
+ args.unshift "<i class=\"#{classes}\"></i> #{h(args.shift)}".html_safe
189
+ end
190
+ args << opts
191
+ end
192
+
193
+ url = block_given? ? args.first : args[1]
194
+
195
+ classes = []
196
+ if current_page?(url)
197
+ classes << "active"
198
+ end
199
+
200
+ if float
201
+ classes += ["float", "#{float}"]
202
+ end
203
+
204
+ with_class = classes.any? ? " class='#{classes.join(' ')}'" : ""
205
+ "<li#{with_class}>#{link_to(*args, &block)}</li>".html_safe
206
+ end
207
+
208
+
209
+ def brand(*args, &block)
210
+
211
+ if !args.last.is_a?(Hash)
212
+ args << {}
213
+ end
214
+ args.last[:class] = "brand"
215
+
216
+ link_to(*args, &block)
217
+ end
218
+
219
+
220
+ # ========
221
+ # = Tabs =
222
+ # ========
223
+
224
+ class TabsBuilder
225
+
226
+ attr_reader :parent, :pane_contents, :pane_handles
227
+ delegate :capture, :content_tag, :to => :parent
228
+
229
+ def initialize parent
230
+ @first = true
231
+ @parent = parent
232
+ @pane_handles = []
233
+ @pane_contents = []
234
+ end
235
+
236
+ def pane title, &block
237
+ css_class, @first = 'active', false if @first
238
+ link = content_tag(:a, title, :'data-toggle' => 'tab', :href => "##{title.parameterize}_tab")
239
+ @pane_handles << content_tag(:li, link, :class => css_class)
240
+ @pane_contents << (content_tag :div, :class => "tab-pane #{css_class}", :id => "#{title.parameterize}_tab" do
241
+ capture(&block)
242
+ end)
243
+ nil
244
+ end
245
+
246
+ end # ~ TabsBuilder
247
+
248
+
249
+ def tabs(opts = {})
250
+ opts[:direction] ||= 'above'
251
+ opts[:style] ||= 'tabs'
252
+ builder = TabsBuilder.new self
253
+ yield builder
254
+ tabs = content_tag(:ul, builder.pane_handles.join("\n").html_safe, :class => "nav nav-#{opts[:style]}")
255
+ contents = content_tag(:div, builder.pane_contents.join("\n").html_safe, :class => 'tab-content')
256
+ css_direction = "tabs-#{opts[:direction]}" unless opts[:direction] == 'above'
257
+ content_tag :div, :class => "tabbable #{css_direction}" do
258
+ if opts[:direction] == 'below'
259
+ contents + tabs
260
+ else
261
+ tabs + contents
262
+ end
263
+ end
264
+ end
265
+
266
+
267
+ # =============
268
+ # = Accordion =
269
+ # =============
270
+
271
+ class AccordionBuilder
272
+
273
+ attr_reader :parent
274
+ delegate :capture, :content_tag, :link_to, :to => :parent
275
+
276
+ def initialize(opts, parent)
277
+ @first = true
278
+ @parent = parent
279
+ @opts = opts
280
+ end
281
+
282
+ def pane(title, &block)
283
+ css_class = (@first && @opts[:open]) ? 'in' : ''
284
+ @first = false
285
+ content_tag :div, :class => 'accordion-group' do
286
+ heading = content_tag :div, :class => 'accordion-heading' do
287
+ link_to title, "##{title.parameterize}_pane", :class => 'accordion-toggle', :'data-toggle' => 'collapse',
288
+ :'data-parent' => "##{@opts[:accordion_id]}"
289
+ end
290
+ body = content_tag :div, :class => "accordion-body collapse #{css_class}", :id => "#{title.parameterize}_pane" do
291
+ content_tag :div, :class => 'accordion-inner' do
292
+ capture(&block)
293
+ end
294
+ end
295
+ heading + body
296
+ end
297
+ end
298
+
299
+ end # ~ AccordionBuilder
300
+
301
+ def accordion(opts = {})
302
+ opts[:accordion_id] ||= 'accordion'
303
+ builder = AccordionBuilder.new opts, self
304
+ content_tag :div, :class => 'accordion', :id => opts[:accordion_id] do
305
+ yield builder
306
+ end
307
+ end
308
+
309
+ end
310
+
311
+ ActionView::Base.send :include, BootstrapHelpers
312
+
313
+
314
+
315
+
316
+
317
+
318
+
319
+
320
+
321
+
322
+
323
+
324
+
325
+
326
+
327
+
328
+
329
+
330
+
331
+
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bootstrap-helpers
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - mcasimir
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-08-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: bundler
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: jeweler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 1.8.4
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.8.4
62
+ description: Rails bootstrap helpers
63
+ email: maurizio.cas@gmail.com
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files:
67
+ - README.md
68
+ files:
69
+ - Gemfile
70
+ - Gemfile.lock
71
+ - README.md
72
+ - Rakefile
73
+ - VERSION
74
+ - bootstrap-helpers.gemspec
75
+ - lib/bootstrap-helpers.rb
76
+ homepage: http://github.com/mcasimir/kaminari-bootstrap
77
+ licenses:
78
+ - MIT
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ segments:
90
+ - 0
91
+ hash: -4429154263409720929
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ none: false
94
+ requirements:
95
+ - - ! '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ requirements: []
99
+ rubyforge_project:
100
+ rubygems_version: 1.8.24
101
+ signing_key:
102
+ specification_version: 3
103
+ summary: Rails bootstrap helpers
104
+ test_files: []