comfy_bootstrap_form 4.0.0.beta1 → 4.0.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +12 -0
- data/.travis.yml +14 -0
- data/CONTRIBUTING.md +40 -0
- data/Gemfile +14 -0
- data/{MIT-LICENSE → LICENSE.md} +1 -1
- data/README.md +130 -495
- data/Rakefile +5 -15
- data/bootstrap_form.gemspec +25 -0
- data/demo/README.md +18 -0
- data/demo/Rakefile +6 -0
- data/demo/app/controllers/application_controller.rb +2 -0
- data/demo/app/controllers/bootstrap_controller.rb +12 -0
- data/demo/app/models/application_record.rb +3 -0
- data/demo/app/models/user.rb +3 -0
- data/demo/app/views/bootstrap/form.html.erb +82 -0
- data/demo/app/views/layouts/application.html.erb +43 -0
- data/demo/bin/bundle +3 -0
- data/{test/dummy → demo}/bin/rails +1 -1
- data/{test/dummy → demo}/bin/rake +0 -0
- data/demo/bin/setup +36 -0
- data/demo/bin/update +31 -0
- data/demo/bin/yarn +11 -0
- data/{test/dummy → demo}/config.ru +2 -1
- data/demo/config/application.rb +24 -0
- data/demo/config/boot.rb +5 -0
- data/{test/dummy → demo}/config/database.yml +8 -12
- data/demo/config/environment.rb +5 -0
- data/demo/config/environments/development.rb +60 -0
- data/{test/dummy → demo}/config/environments/test.rb +15 -20
- data/demo/config/initializers/application_controller_renderer.rb +8 -0
- data/demo/config/initializers/assets.rb +14 -0
- data/{test/dummy → demo}/config/initializers/backtrace_silencers.rb +0 -0
- data/demo/config/initializers/cookies_serializer.rb +5 -0
- data/{test/dummy → demo}/config/initializers/filter_parameter_logging.rb +0 -0
- data/{test/dummy → demo}/config/initializers/inflections.rb +0 -0
- data/{test/dummy → demo}/config/initializers/mime_types.rb +0 -1
- data/{test/dummy → demo}/config/initializers/wrap_parameters.rb +2 -2
- data/{test/dummy → demo}/config/locales/en.yml +10 -0
- data/demo/config/puma.rb +56 -0
- data/{test/dummy → demo}/config/routes.rb +2 -0
- data/demo/config/spring.rb +6 -0
- data/demo/config/storage.yml +35 -0
- data/demo/db/schema.rb +11 -0
- data/{test/dummy/public/favicon.ico → demo/log/.keep} +0 -0
- data/demo/package.json +5 -0
- data/demo/public/favicon.ico +0 -0
- data/lib/bootstrap_form.rb +2 -2
- data/lib/bootstrap_form/form_builder.rb +367 -346
- data/lib/bootstrap_form/version.rb +1 -1
- data/lib/bootstrap_form/view_helper.rb +33 -0
- data/lib/comfy_bootstrap_form.rb +1 -1
- data/test/bootstrap_form/fields_test.rb +304 -0
- data/test/bootstrap_form/fields_with_errors_test.rb +109 -0
- data/test/bootstrap_form/form_builder_test.rb +49 -0
- data/test/bootstrap_form/horizontal_form_test.rb +159 -0
- data/test/bootstrap_form/inline_form_test.rb +68 -0
- data/test/bootstrap_form/input_group_test.rb +53 -0
- data/test/bootstrap_form/radios_and_checkboxes_test.rb +208 -0
- data/test/bootstrap_form/submit_test.rb +59 -0
- data/test/bootstrap_form/view_helpers_test.rb +99 -0
- data/test/gemfiles/5.2.gemfile +13 -0
- data/test/test_helper.rb +31 -69
- metadata +71 -258
- data/app/assets/stylesheets/rails_bootstrap_forms.css +0 -10
- data/lib/bootstrap_form/aliasing.rb +0 -35
- data/lib/bootstrap_form/helper.rb +0 -36
- data/lib/bootstrap_form/helpers/bootstrap.rb +0 -94
- data/lib/bootstrap_form/helpers/nested_form.rb +0 -33
- data/test/bootstrap_checkbox_test.rb +0 -144
- data/test/bootstrap_fields_test.rb +0 -152
- data/test/bootstrap_form_group_test.rb +0 -313
- data/test/bootstrap_form_test.rb +0 -276
- data/test/bootstrap_other_components_test.rb +0 -86
- data/test/bootstrap_radio_button_test.rb +0 -124
- data/test/bootstrap_selects_test.rb +0 -160
- data/test/dummy/Gemfile +0 -45
- data/test/dummy/Gemfile.lock +0 -120
- data/test/dummy/README.rdoc +0 -28
- data/test/dummy/Rakefile +0 -10
- data/test/dummy/app/assets/javascripts/application.js +0 -16
- data/test/dummy/app/assets/stylesheets/application.css +0 -13
- data/test/dummy/app/controllers/application_controller.rb +0 -5
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/models/address.rb +0 -3
- data/test/dummy/app/models/faux_user.rb +0 -9
- data/test/dummy/app/models/super_user.rb +0 -2
- data/test/dummy/app/models/user.rb +0 -9
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/bin/bundle +0 -3
- data/test/dummy/config/application.rb +0 -23
- data/test/dummy/config/boot.rb +0 -4
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -29
- data/test/dummy/config/environments/production.rb +0 -80
- data/test/dummy/config/initializers/generic_migration.rb +0 -6
- data/test/dummy/config/initializers/secret_token.rb +0 -12
- data/test/dummy/config/initializers/session_store.rb +0 -3
- data/test/dummy/db/migrate/20130703191909_create_users.rb +0 -13
- data/test/dummy/db/migrate/20130703191937_create_addresses.rb +0 -13
- data/test/dummy/db/migrate/20130912171202_add_preferences_to_user.rb +0 -5
- data/test/dummy/db/migrate/20140327190145_add_terms_to_user.rb +0 -5
- data/test/dummy/db/migrate/20140922133133_add_type_to_users.rb +0 -5
- data/test/dummy/db/schema.rb +0 -38
- data/test/dummy/db/seeds.rb +0 -7
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +0 -18394
- data/test/dummy/public/404.html +0 -58
- data/test/dummy/public/422.html +0 -58
- data/test/dummy/public/500.html +0 -57
- data/test/dummy/public/robots.txt +0 -5
- data/test/dummy/test/fixtures/addresses.yml +0 -15
- data/test/dummy/test/fixtures/users.yml +0 -15
- data/test/dummy/test/models/address_test.rb +0 -7
- data/test/dummy/test/models/user_test.rb +0 -7
- data/test/dummy/test/test_helper.rb +0 -15
- data/test/special_form_class_models_test.rb +0 -43
data/test/dummy/public/404.html
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
-
<style>
|
6
|
-
body {
|
7
|
-
background-color: #EFEFEF;
|
8
|
-
color: #2E2F30;
|
9
|
-
text-align: center;
|
10
|
-
font-family: arial, sans-serif;
|
11
|
-
}
|
12
|
-
|
13
|
-
div.dialog {
|
14
|
-
width: 25em;
|
15
|
-
margin: 4em auto 0 auto;
|
16
|
-
border: 1px solid #CCC;
|
17
|
-
border-right-color: #999;
|
18
|
-
border-left-color: #999;
|
19
|
-
border-bottom-color: #BBB;
|
20
|
-
border-top: #B00100 solid 4px;
|
21
|
-
border-top-left-radius: 9px;
|
22
|
-
border-top-right-radius: 9px;
|
23
|
-
background-color: white;
|
24
|
-
padding: 7px 4em 0 4em;
|
25
|
-
}
|
26
|
-
|
27
|
-
h1 {
|
28
|
-
font-size: 100%;
|
29
|
-
color: #730E15;
|
30
|
-
line-height: 1.5em;
|
31
|
-
}
|
32
|
-
|
33
|
-
body > p {
|
34
|
-
width: 33em;
|
35
|
-
margin: 0 auto 1em;
|
36
|
-
padding: 1em 0;
|
37
|
-
background-color: #F7F7F7;
|
38
|
-
border: 1px solid #CCC;
|
39
|
-
border-right-color: #999;
|
40
|
-
border-bottom-color: #999;
|
41
|
-
border-bottom-left-radius: 4px;
|
42
|
-
border-bottom-right-radius: 4px;
|
43
|
-
border-top-color: #DADADA;
|
44
|
-
color: #666;
|
45
|
-
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
-
}
|
47
|
-
</style>
|
48
|
-
</head>
|
49
|
-
|
50
|
-
<body>
|
51
|
-
<!-- This file lives in public/404.html -->
|
52
|
-
<div class="dialog">
|
53
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
54
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
55
|
-
</div>
|
56
|
-
<p>If you are the application owner check the logs for more information.</p>
|
57
|
-
</body>
|
58
|
-
</html>
|
data/test/dummy/public/422.html
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<style>
|
6
|
-
body {
|
7
|
-
background-color: #EFEFEF;
|
8
|
-
color: #2E2F30;
|
9
|
-
text-align: center;
|
10
|
-
font-family: arial, sans-serif;
|
11
|
-
}
|
12
|
-
|
13
|
-
div.dialog {
|
14
|
-
width: 25em;
|
15
|
-
margin: 4em auto 0 auto;
|
16
|
-
border: 1px solid #CCC;
|
17
|
-
border-right-color: #999;
|
18
|
-
border-left-color: #999;
|
19
|
-
border-bottom-color: #BBB;
|
20
|
-
border-top: #B00100 solid 4px;
|
21
|
-
border-top-left-radius: 9px;
|
22
|
-
border-top-right-radius: 9px;
|
23
|
-
background-color: white;
|
24
|
-
padding: 7px 4em 0 4em;
|
25
|
-
}
|
26
|
-
|
27
|
-
h1 {
|
28
|
-
font-size: 100%;
|
29
|
-
color: #730E15;
|
30
|
-
line-height: 1.5em;
|
31
|
-
}
|
32
|
-
|
33
|
-
body > p {
|
34
|
-
width: 33em;
|
35
|
-
margin: 0 auto 1em;
|
36
|
-
padding: 1em 0;
|
37
|
-
background-color: #F7F7F7;
|
38
|
-
border: 1px solid #CCC;
|
39
|
-
border-right-color: #999;
|
40
|
-
border-bottom-color: #999;
|
41
|
-
border-bottom-left-radius: 4px;
|
42
|
-
border-bottom-right-radius: 4px;
|
43
|
-
border-top-color: #DADADA;
|
44
|
-
color: #666;
|
45
|
-
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
-
}
|
47
|
-
</style>
|
48
|
-
</head>
|
49
|
-
|
50
|
-
<body>
|
51
|
-
<!-- This file lives in public/422.html -->
|
52
|
-
<div class="dialog">
|
53
|
-
<h1>The change you wanted was rejected.</h1>
|
54
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
55
|
-
</div>
|
56
|
-
<p>If you are the application owner check the logs for more information.</p>
|
57
|
-
</body>
|
58
|
-
</html>
|
data/test/dummy/public/500.html
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>We're sorry, but something went wrong (500)</title>
|
5
|
-
<style>
|
6
|
-
body {
|
7
|
-
background-color: #EFEFEF;
|
8
|
-
color: #2E2F30;
|
9
|
-
text-align: center;
|
10
|
-
font-family: arial, sans-serif;
|
11
|
-
}
|
12
|
-
|
13
|
-
div.dialog {
|
14
|
-
width: 25em;
|
15
|
-
margin: 4em auto 0 auto;
|
16
|
-
border: 1px solid #CCC;
|
17
|
-
border-right-color: #999;
|
18
|
-
border-left-color: #999;
|
19
|
-
border-bottom-color: #BBB;
|
20
|
-
border-top: #B00100 solid 4px;
|
21
|
-
border-top-left-radius: 9px;
|
22
|
-
border-top-right-radius: 9px;
|
23
|
-
background-color: white;
|
24
|
-
padding: 7px 4em 0 4em;
|
25
|
-
}
|
26
|
-
|
27
|
-
h1 {
|
28
|
-
font-size: 100%;
|
29
|
-
color: #730E15;
|
30
|
-
line-height: 1.5em;
|
31
|
-
}
|
32
|
-
|
33
|
-
body > p {
|
34
|
-
width: 33em;
|
35
|
-
margin: 0 auto 1em;
|
36
|
-
padding: 1em 0;
|
37
|
-
background-color: #F7F7F7;
|
38
|
-
border: 1px solid #CCC;
|
39
|
-
border-right-color: #999;
|
40
|
-
border-bottom-color: #999;
|
41
|
-
border-bottom-left-radius: 4px;
|
42
|
-
border-bottom-right-radius: 4px;
|
43
|
-
border-top-color: #DADADA;
|
44
|
-
color: #666;
|
45
|
-
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
-
}
|
47
|
-
</style>
|
48
|
-
</head>
|
49
|
-
|
50
|
-
<body>
|
51
|
-
<!-- This file lives in public/500.html -->
|
52
|
-
<div class="dialog">
|
53
|
-
<h1>We're sorry, but something went wrong.</h1>
|
54
|
-
</div>
|
55
|
-
<p>If you are the application owner check the logs for more information.</p>
|
56
|
-
</body>
|
57
|
-
</html>
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
2
|
-
|
3
|
-
one:
|
4
|
-
user_id: 1
|
5
|
-
street: MyString
|
6
|
-
city: MyString
|
7
|
-
state: MyString
|
8
|
-
zip_code: MyString
|
9
|
-
|
10
|
-
two:
|
11
|
-
user_id: 1
|
12
|
-
street: MyString
|
13
|
-
city: MyString
|
14
|
-
state: MyString
|
15
|
-
zip_code: MyString
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
2
|
-
|
3
|
-
one:
|
4
|
-
email: MyString
|
5
|
-
password: MyString
|
6
|
-
comments: MyText
|
7
|
-
status: MyString
|
8
|
-
misc: MyString
|
9
|
-
|
10
|
-
two:
|
11
|
-
email: MyString
|
12
|
-
password: MyString
|
13
|
-
comments: MyText
|
14
|
-
status: MyString
|
15
|
-
misc: MyString
|
@@ -1,15 +0,0 @@
|
|
1
|
-
ENV["RAILS_ENV"] ||= "test"
|
2
|
-
require File.expand_path('../../config/environment', __FILE__)
|
3
|
-
require 'rails/test_help'
|
4
|
-
|
5
|
-
class ActiveSupport::TestCase
|
6
|
-
ActiveRecord::Migration.check_pending!
|
7
|
-
|
8
|
-
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
|
9
|
-
#
|
10
|
-
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
11
|
-
# -- they do not yet inherit this setting
|
12
|
-
fixtures :all
|
13
|
-
|
14
|
-
# Add more helper methods to be used by all tests here...
|
15
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class SpecialFormClassModelsTest < ActionView::TestCase
|
4
|
-
include BootstrapForm::Helper
|
5
|
-
|
6
|
-
test "Anonymous models are supported for form builder" do
|
7
|
-
user_klass = Class.new(User)
|
8
|
-
def user_klass.model_name
|
9
|
-
ActiveModel::Name.new(User)
|
10
|
-
end
|
11
|
-
|
12
|
-
@user = user_klass.new(email: 'steve@example.com', password: 'secret', comments: 'my comment')
|
13
|
-
@builder = BootstrapForm::FormBuilder.new(:user, @user, self, {})
|
14
|
-
@horizontal_builder = BootstrapForm::FormBuilder.new(:user, @user, self, {layout: :horizontal, label_col: "col-sm-2", control_col: "col-sm-10"})
|
15
|
-
I18n.backend.store_translations(:en, {activerecord: {help: {user: {password: "A good password should be at least six characters long"}}}})
|
16
|
-
|
17
|
-
expected = %{<div class="form-group"><label class="form-control-label" for="user_misc">Misc</label><input class="form-control" id="user_misc" name="user[misc]" type="date" /></div>}
|
18
|
-
assert_equivalent_xml expected, @builder.date_field(:misc)
|
19
|
-
end
|
20
|
-
|
21
|
-
test "Nil models are supported for form builder" do
|
22
|
-
@user = nil
|
23
|
-
@builder = BootstrapForm::FormBuilder.new(:user, @user, self, {})
|
24
|
-
@horizontal_builder = BootstrapForm::FormBuilder.new(:user, @user, self, {layout: :horizontal, label_col: "col-sm-2", control_col: "col-sm-10"})
|
25
|
-
I18n.backend.store_translations(:en, {activerecord: {help: {user: {password: "A good password should be at least six characters long"}}}})
|
26
|
-
|
27
|
-
expected = %{<div class="form-group"><label class="form-control-label" for="user_misc">Misc</label><input class="form-control" id="user_misc" name="user[misc]" type="date" /></div>}
|
28
|
-
assert_equivalent_xml expected, @builder.date_field(:misc)
|
29
|
-
end
|
30
|
-
|
31
|
-
test "Objects without model names are supported for form builder" do
|
32
|
-
user_klass = FauxUser
|
33
|
-
|
34
|
-
@user = user_klass.new(email: 'steve@example.com', password: 'secret', comments: 'my comment')
|
35
|
-
@builder = BootstrapForm::FormBuilder.new(:user, @user, self, {})
|
36
|
-
@horizontal_builder = BootstrapForm::FormBuilder.new(:user, @user, self, {layout: :horizontal, label_col: "col-sm-2", control_col: "col-sm-10"})
|
37
|
-
I18n.backend.store_translations(:en, {activerecord: {help: {faux_user: {password: "A good password should be at least six characters long"}}}})
|
38
|
-
|
39
|
-
expected = %{<div class="form-group"><label class="form-control-label" for="user_misc">Misc</label><input class="form-control" id="user_misc" name="user[misc]" type="date" /></div>}
|
40
|
-
assert_equivalent_xml expected, @builder.date_field(:misc)
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|