bootstrap-view-helpers 0.0.7 → 0.0.8
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.
- data/CHANGELOG.md +10 -0
- data/README.md +8 -2
- data/app/controllers/bootstrap_view_helpers_controller.rb +6 -0
- data/app/helpers/bootstrap/accordion_helper.rb +2 -2
- data/app/helpers/bootstrap/button_helper.rb +5 -1
- data/app/helpers/bootstrap/nav_helper.rb +12 -2
- data/app/helpers/bootstrap_examples/application_helper.rb +6 -0
- data/app/views/application/_bootstrap_view_helper_nav_bar.html.erb +2 -1
- data/app/views/bootstrap_view_helpers/_icons.html.erb +1 -1
- data/config/routes.rb +2 -1
- data/lib/bootstrap-view-helpers/version.rb +1 -1
- metadata +22 -5
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# bootstrap-view-helpers
|
2
2
|
|
3
|
+
[](http://badge.fury.io/rb/bootstrap-view-helpers)
|
4
|
+
[](https://travis-ci.org/stevedowney/bootstrap-view-helpers)
|
5
|
+
[](https://codeclimate.com/github/stevedowney/bootstrap-view-helpers)
|
6
|
+
[](https://coveralls.io/r/stevedowney/bootstrap-view-helpers?branch=master)
|
7
|
+
|
3
8
|
This gem provides helper methods for various Bootstrap components.
|
4
9
|
|
5
10
|
Includes support for:
|
@@ -70,8 +75,9 @@ Complete [API documentation](http://rubydoc.info/gems/bootstrap-view-helpers/fra
|
|
70
75
|
```
|
71
76
|
<%= nav_bar do %>
|
72
77
|
|
73
|
-
<%= brand('Span Brand')%>
|
74
|
-
<%= brand('Link Brand', url: '#')%>
|
78
|
+
<%= brand('Span Brand') %>
|
79
|
+
<%= brand('Link Brand', url: '#') %>
|
80
|
+
<%= brand('MyApp', with_environment: true) %>
|
75
81
|
|
76
82
|
<%= nav_bar_links do %>
|
77
83
|
|
@@ -1,3 +1,9 @@
|
|
1
|
+
# This controller displays working examples of the helpers.
|
2
|
+
#
|
3
|
+
# After installation, restart your rails server and point your browser to:
|
4
|
+
#
|
5
|
+
# http://<app_name>/bootstrap_view_helpers
|
6
|
+
#
|
1
7
|
class BootstrapViewHelpersController < ApplicationController
|
2
8
|
layout 'bootstrap_view_helpers'
|
3
9
|
|
@@ -16,10 +16,10 @@
|
|
16
16
|
#
|
17
17
|
module Bootstrap::AccordionHelper
|
18
18
|
|
19
|
-
# Returns the
|
19
|
+
# Returns the html for a Bootstrap accordion.
|
20
20
|
#
|
21
21
|
# @param [Hash] options html attributes for accordion <div>
|
22
|
-
# @return [String] accordion
|
22
|
+
# @return [String] <div class="accordion"> plus results of yielded block
|
23
23
|
# @yield Should contain calls to {Bootstrap::AccordionHelper#accordion_group}
|
24
24
|
# @yieldreturn [String] Html from {Bootstrap::AccordionHelper#accordion_group} calls
|
25
25
|
def accordion(options={})
|
@@ -119,7 +119,11 @@ module Bootstrap::ButtonHelper
|
|
119
119
|
yield
|
120
120
|
end
|
121
121
|
end
|
122
|
-
|
122
|
+
|
123
|
+
# Ensures each entry in _types_and_sizes_ is a valid button modifier.
|
124
|
+
#
|
125
|
+
# @raise InvalidButtonModifierError if one of the args isn't a valid button modifier.
|
126
|
+
# @private
|
123
127
|
def validate_button_types_and_sizes(types_and_sizes)
|
124
128
|
types_and_sizes.each { |e| raise(InvalidButtonModifierError, e.inspect) unless BUTTON_ALL.include?(e.to_s) }
|
125
129
|
end
|
@@ -46,10 +46,19 @@ module Bootstrap::NavHelper
|
|
46
46
|
# @param [String] text text of the brand
|
47
47
|
# @param [Hash] options except for +:url+, becomes html attributes of returned tag
|
48
48
|
# @option options [String] :url if present, returned tag is an <a> (else <span>)
|
49
|
+
# @option options [Boolean] :with_environment if present, environment is appended to _text_ and
|
50
|
+
# and a class of "rails-<Rails.env>" is added to the returned tag.
|
49
51
|
# @return [String] <a> if +:url+ option present, else <span>
|
50
52
|
def brand(text, options = {})
|
51
53
|
options = canonicalize_options(options)
|
52
54
|
options = ensure_class(options, 'brand')
|
55
|
+
|
56
|
+
with_environment = options.delete(:with_environment)
|
57
|
+
if with_environment && Rails.env != 'production'
|
58
|
+
text = "#{text} - #{Rails.env}"
|
59
|
+
options = ensure_class(options, "rails-#{Rails.env}")
|
60
|
+
end
|
61
|
+
|
53
62
|
url = options.delete(:url)
|
54
63
|
|
55
64
|
if url.present?
|
@@ -117,8 +126,9 @@ module Bootstrap::NavHelper
|
|
117
126
|
end
|
118
127
|
|
119
128
|
# Returns header for nav_list
|
120
|
-
#
|
121
|
-
# @
|
129
|
+
#
|
130
|
+
# @param text [String] text of header
|
131
|
+
# @return [String] <li.nav-header>text</li>
|
122
132
|
def nav_list_header(text)
|
123
133
|
content_tag(:li, text, class: 'nav-header')
|
124
134
|
end
|
@@ -1,8 +1,9 @@
|
|
1
1
|
<%= nav_bar do %>
|
2
2
|
|
3
|
-
<%= brand('Bootstrap View Helpers', url: bvh_path)%>
|
3
|
+
<%= brand('Bootstrap View Helpers', url: bvh_path) %>
|
4
4
|
|
5
5
|
<%= nav_bar_links do %>
|
6
|
+
<%= nav_bar_link('Application Home', bvh_app_home_link) %>
|
6
7
|
<%= nav_bar_link('Active', '#', active: true) %>
|
7
8
|
<%= nav_bar_link('Link1', '/link1') %>
|
8
9
|
<%= nav_bar_divider %>
|
data/config/routes.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstrap-view-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -139,6 +139,22 @@ dependencies:
|
|
139
139
|
- - ! '>='
|
140
140
|
- !ruby/object:Gem::Version
|
141
141
|
version: '0'
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: coveralls
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ! '>='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
type: :development
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
142
158
|
- !ruby/object:Gem::Dependency
|
143
159
|
name: sqlite3
|
144
160
|
requirement: !ruby/object:Gem::Requirement
|
@@ -172,7 +188,7 @@ dependencies:
|
|
172
188
|
- !ruby/object:Gem::Version
|
173
189
|
version: '0'
|
174
190
|
- !ruby/object:Gem::Dependency
|
175
|
-
name:
|
191
|
+
name: redcarpet
|
176
192
|
requirement: !ruby/object:Gem::Requirement
|
177
193
|
none: false
|
178
194
|
requirements:
|
@@ -188,7 +204,7 @@ dependencies:
|
|
188
204
|
- !ruby/object:Gem::Version
|
189
205
|
version: '0'
|
190
206
|
- !ruby/object:Gem::Dependency
|
191
|
-
name:
|
207
|
+
name: yard
|
192
208
|
requirement: !ruby/object:Gem::Requirement
|
193
209
|
none: false
|
194
210
|
requirements:
|
@@ -235,7 +251,7 @@ dependencies:
|
|
235
251
|
- - ! '>='
|
236
252
|
- !ruby/object:Gem::Version
|
237
253
|
version: '0'
|
238
|
-
description:
|
254
|
+
description: Produce Bootstrap html with semantic helper methods.
|
239
255
|
email:
|
240
256
|
- steve.downtown@gmail.com
|
241
257
|
executables: []
|
@@ -272,6 +288,7 @@ files:
|
|
272
288
|
- lib/bootstrap-view-helpers/version.rb
|
273
289
|
- lib/bootstrap-view-helpers.rb
|
274
290
|
- lib/tasks/bootstrap-view-helpers_tasks.rake
|
291
|
+
- CHANGELOG.md
|
275
292
|
- MIT-LICENSE
|
276
293
|
- Rakefile
|
277
294
|
- README.md
|