bootstrap-view-helpers 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # Change Log
2
+
3
+ ## v 0.0.8
4
+
5
+ * added `:with_environment_option` to `brand`
6
+
7
+ ## v 0.0.7
8
+
9
+ * fixed bug that prevented accordions from working
10
+ * examples page at `/bootstrap_view_helpers`
data/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # bootstrap-view-helpers
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/bootstrap-view-helpers.png)](http://badge.fury.io/rb/bootstrap-view-helpers)
4
+ [![Build Status](https://travis-ci.org/stevedowney/bootstrap-view-helpers.png)](https://travis-ci.org/stevedowney/bootstrap-view-helpers)
5
+ [![Code Climate](https://codeclimate.com/github/stevedowney/bootstrap-view-helpers.png)](https://codeclimate.com/github/stevedowney/bootstrap-view-helpers)
6
+ [![Coverage Status](https://coveralls.io/repos/stevedowney/bootstrap-view-helpers/badge.png?branch=master)](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 outer html for a Bootstrap accordion.
19
+ # Returns the html for a Bootstrap accordion.
20
20
  #
21
21
  # @param [Hash] options html attributes for accordion <div>
22
- # @return [String] accordion html
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
- # @param [String] text text of header
121
- # @return [String]
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,5 +1,11 @@
1
1
  module BootstrapExamples::ApplicationHelper
2
2
 
3
+ def bvh_app_home_link
4
+ root_path
5
+ rescue NameError
6
+ '/'
7
+ end
8
+
3
9
  def bvh_show_source(path)
4
10
  erb = IO.read(bvh_view_dir.join("#{path}.html.erb"))
5
11
  content_tag(:pre, erb)
@@ -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 %>
@@ -1,5 +1,5 @@
1
1
  <p>
2
- <%= icon(:heart)%>
2
+ <%= icon(:heart) %>
3
3
  </p>
4
4
 
5
5
  <p>
data/config/routes.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  Rails.application.routes.draw do
2
-
2
+
3
3
  match 'bootstrap_view_helpers(/:action)' => 'bootstrap_view_helpers', :as => :bvh
4
+
4
5
  end
@@ -1,3 +1,3 @@
1
1
  module BootstrapViewHelpers
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
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.7
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-20 00:00:00.000000000 Z
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: yard
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: redcarpet
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: Rails view helpers for Bootstrap
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