bh 0.0.4 → 0.0.5
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 +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +4 -0
- data/README.md +77 -31
- data/bh.gemspec +1 -0
- data/gemfiles/Gemfile.rails-3.x +1 -0
- data/gemfiles/Gemfile.rails-4.x +1 -0
- data/lib/bh/form_builders/form_builder.rb +41 -0
- data/lib/bh/helpers/alert_helper.rb +2 -5
- data/lib/bh/helpers/base_helper.rb +17 -0
- data/lib/bh/helpers/form/base_helper.rb +112 -0
- data/lib/bh/helpers/form/check_box_helper.rb +35 -0
- data/lib/bh/helpers/form/field_helper.rb +15 -0
- data/lib/bh/helpers/form/fields_for_helper.rb +17 -0
- data/lib/bh/helpers/form/fieldset_helper.rb +16 -0
- data/lib/bh/helpers/form/legend_helper.rb +17 -0
- data/lib/bh/helpers/form/radio_button_helper.rb +19 -0
- data/lib/bh/helpers/form/select_helper.rb +16 -0
- data/lib/bh/helpers/form/static_control_helper.rb +43 -0
- data/lib/bh/helpers/form/submit_helper.rb +23 -0
- data/lib/bh/helpers/form_for_helper.rb +30 -0
- data/lib/bh/helpers/glyphicon_helper.rb +5 -5
- data/lib/bh/helpers/modal_helper.rb +2 -3
- data/lib/bh/helpers/panel_helper.rb +5 -5
- data/lib/bh/helpers/panel_row_helper.rb +1 -5
- data/lib/bh/railtie.rb +2 -0
- data/lib/bh/version.rb +1 -1
- data/spec/helpers/form/check_box_helper_spec.rb +95 -0
- data/spec/helpers/form/field_helper_spec.rb +102 -0
- data/spec/helpers/form/fields_for_helper_spec.rb +35 -0
- data/spec/helpers/form/fieldset_helper_spec.rb +32 -0
- data/spec/helpers/form/legend_helper_spec.rb +35 -0
- data/spec/helpers/form/radio_button_helper_spec.rb +67 -0
- data/spec/helpers/form/select_helper_spec.rb +71 -0
- data/spec/helpers/form/static_control_helper_spec.rb +67 -0
- data/spec/helpers/form/submit_helper_spec.rb +30 -0
- data/spec/helpers/form_for_helper_spec.rb +43 -0
- data/spec/helpers/panel_helper_spec.rb +6 -0
- data/spec/spec_helper.rb +29 -1
- metadata +49 -2
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'bh/helpers/form_for_helper'
|
3
|
+
include Bh::FormForHelper
|
4
|
+
|
5
|
+
describe 'form_for' do
|
6
|
+
let(:protect_against_forgery?) { false }
|
7
|
+
attr_accessor :output_buffer
|
8
|
+
let(:form) { form_for(:object, options.merge(url: '/')) {} }
|
9
|
+
|
10
|
+
describe 'without a :layout option' do
|
11
|
+
let(:options) { {} }
|
12
|
+
|
13
|
+
specify 'does not apply Boostrap attributes to the form' do
|
14
|
+
expect(form).not_to include 'role="form"'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'with layout: :horizontal' do
|
19
|
+
let(:options) { {layout: :horizontal} }
|
20
|
+
|
21
|
+
specify 'applies Boostrap attributes of an horizontal form' do
|
22
|
+
expect(form).to include 'role="form"'
|
23
|
+
expect(form).to include 'class="form-horizontal"'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe 'with layout: :inline' do
|
28
|
+
let(:options) { {layout: :inline} }
|
29
|
+
|
30
|
+
specify 'applies Boostrap attributes of an inline form' do
|
31
|
+
expect(form).to include 'role="form"'
|
32
|
+
expect(form).to include 'class="form-inline"'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe 'with any other value for :layout' do
|
37
|
+
let(:options) { {layout: :basic} }
|
38
|
+
|
39
|
+
specify 'applies Boostrap attributes of a basic form' do
|
40
|
+
expect(form).to include 'role="form"'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -86,4 +86,10 @@ describe 'panel' do
|
|
86
86
|
expect(panel 'content').not_to include 'panel-heading'
|
87
87
|
end
|
88
88
|
end
|
89
|
+
|
90
|
+
describe 'with the :tag option' do
|
91
|
+
specify 'uses the specified tag rather than DIV' do
|
92
|
+
expect(panel 'content', tag: :aside).to include '<aside class="panel panel-default">'
|
93
|
+
end
|
94
|
+
end
|
89
95
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -12,4 +12,32 @@ Dir['./spec/support/**/*.rb'].each {|f| require f}
|
|
12
12
|
RSpec.configure do |config|
|
13
13
|
config.order = 'random'
|
14
14
|
config.run_all_when_everything_filtered = false
|
15
|
-
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class User
|
18
|
+
require 'active_model'
|
19
|
+
require 'active_support/all'
|
20
|
+
|
21
|
+
include ActiveModel::Validations
|
22
|
+
include ActiveModel::Conversion
|
23
|
+
extend ActiveModel::Naming
|
24
|
+
|
25
|
+
attr_accessor :name
|
26
|
+
|
27
|
+
def initialize(attributes = {})
|
28
|
+
@name = attributes[:name]
|
29
|
+
end
|
30
|
+
|
31
|
+
def persisted?
|
32
|
+
false
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
require 'action_view'
|
37
|
+
include ActionView::Helpers::FormOptionsHelper
|
38
|
+
if defined?(ActionView::VERSION) # only defined in ActionView >=4
|
39
|
+
include ActionView::RecordIdentifier
|
40
|
+
else
|
41
|
+
include ActionController::RecordIdentifier
|
42
|
+
end
|
43
|
+
I18n.enforce_available_locales = true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claudio Baccigalupo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: activemodel
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
description: Bh - Bootstrap Helpers
|
112
126
|
email:
|
113
127
|
- claudio@fullscreen.net
|
@@ -128,8 +142,21 @@ files:
|
|
128
142
|
- gemfiles/Gemfile.rails-3.x
|
129
143
|
- gemfiles/Gemfile.rails-4.x
|
130
144
|
- lib/bh.rb
|
145
|
+
- lib/bh/form_builders/form_builder.rb
|
131
146
|
- lib/bh/helpers/alert_helper.rb
|
147
|
+
- lib/bh/helpers/base_helper.rb
|
132
148
|
- lib/bh/helpers/cdn_helper.rb
|
149
|
+
- lib/bh/helpers/form/base_helper.rb
|
150
|
+
- lib/bh/helpers/form/check_box_helper.rb
|
151
|
+
- lib/bh/helpers/form/field_helper.rb
|
152
|
+
- lib/bh/helpers/form/fields_for_helper.rb
|
153
|
+
- lib/bh/helpers/form/fieldset_helper.rb
|
154
|
+
- lib/bh/helpers/form/legend_helper.rb
|
155
|
+
- lib/bh/helpers/form/radio_button_helper.rb
|
156
|
+
- lib/bh/helpers/form/select_helper.rb
|
157
|
+
- lib/bh/helpers/form/static_control_helper.rb
|
158
|
+
- lib/bh/helpers/form/submit_helper.rb
|
159
|
+
- lib/bh/helpers/form_for_helper.rb
|
133
160
|
- lib/bh/helpers/glyphicon_helper.rb
|
134
161
|
- lib/bh/helpers/modal_helper.rb
|
135
162
|
- lib/bh/helpers/panel_helper.rb
|
@@ -140,6 +167,16 @@ files:
|
|
140
167
|
- lib/bh/views/bh/_modal.html.erb
|
141
168
|
- spec/helpers/alert_helper_spec.rb
|
142
169
|
- spec/helpers/cdn_helper_spec.rb
|
170
|
+
- spec/helpers/form/check_box_helper_spec.rb
|
171
|
+
- spec/helpers/form/field_helper_spec.rb
|
172
|
+
- spec/helpers/form/fields_for_helper_spec.rb
|
173
|
+
- spec/helpers/form/fieldset_helper_spec.rb
|
174
|
+
- spec/helpers/form/legend_helper_spec.rb
|
175
|
+
- spec/helpers/form/radio_button_helper_spec.rb
|
176
|
+
- spec/helpers/form/select_helper_spec.rb
|
177
|
+
- spec/helpers/form/static_control_helper_spec.rb
|
178
|
+
- spec/helpers/form/submit_helper_spec.rb
|
179
|
+
- spec/helpers/form_for_helper_spec.rb
|
143
180
|
- spec/helpers/glyphicon_helper_spec.rb
|
144
181
|
- spec/helpers/modal_helper_spec.rb
|
145
182
|
- spec/helpers/panel_helper_spec.rb
|
@@ -174,6 +211,16 @@ summary: Bh provides a set of powerful helpers that streamlines the use of Boots
|
|
174
211
|
test_files:
|
175
212
|
- spec/helpers/alert_helper_spec.rb
|
176
213
|
- spec/helpers/cdn_helper_spec.rb
|
214
|
+
- spec/helpers/form/check_box_helper_spec.rb
|
215
|
+
- spec/helpers/form/field_helper_spec.rb
|
216
|
+
- spec/helpers/form/fields_for_helper_spec.rb
|
217
|
+
- spec/helpers/form/fieldset_helper_spec.rb
|
218
|
+
- spec/helpers/form/legend_helper_spec.rb
|
219
|
+
- spec/helpers/form/radio_button_helper_spec.rb
|
220
|
+
- spec/helpers/form/select_helper_spec.rb
|
221
|
+
- spec/helpers/form/static_control_helper_spec.rb
|
222
|
+
- spec/helpers/form/submit_helper_spec.rb
|
223
|
+
- spec/helpers/form_for_helper_spec.rb
|
177
224
|
- spec/helpers/glyphicon_helper_spec.rb
|
178
225
|
- spec/helpers/modal_helper_spec.rb
|
179
226
|
- spec/helpers/panel_helper_spec.rb
|