bootstrap_form 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -3
- data/lib/bootstrap_form/form_builder.rb +11 -2
- data/lib/bootstrap_form/version.rb +1 -1
- data/test/bootstrap_form_test.rb +5 -0
- data/test/dummy/log/development.log +15 -4
- metadata +13 -13
data/README.md
CHANGED
@@ -56,9 +56,9 @@ This plugin provides the following form helpers:
|
|
56
56
|
* datetime_select
|
57
57
|
* check_box
|
58
58
|
|
59
|
-
These form helpers accept the same options as the Rails form
|
60
|
-
|
61
|
-
|
59
|
+
These form helpers accept the same options as the Rails form helpers with the
|
60
|
+
addition of the options `label`, `help`, and `prepend`. Here's an example form
|
61
|
+
that also uses the `actions` helper for the submit button:
|
62
62
|
|
63
63
|
<%= bootstrap_form_for(@user) do |f| %>
|
64
64
|
<%= f.alert_message "Please fix the errors below." %>
|
@@ -66,6 +66,7 @@ example form that also uses the `actions` helper for the submit button:
|
|
66
66
|
<%= f.text_field :email, autofocus: :true %>
|
67
67
|
<%= f.password_field :password, help: 'Must be at least 6 characters long' %>
|
68
68
|
<%= f.password_field :password_confirmation, label: 'Confirm Password' %>
|
69
|
+
<%= f.text_field :website, prepend: 'http://' %>
|
69
70
|
<%= f.check_box :terms, label: 'I agree to the Terms of Service' %>
|
70
71
|
|
71
72
|
<%= f.actions do %>
|
@@ -23,8 +23,17 @@ module BootstrapForm
|
|
23
23
|
content_tag(:div, class: 'controls') do
|
24
24
|
help = object.errors[name].any? ? object.errors[name].join(', ') : options[:help]
|
25
25
|
help = content_tag(@help_tag, class: @help_css) { help } if help
|
26
|
-
|
27
|
-
|
26
|
+
|
27
|
+
args << options.except(:label, :help, :prepend)
|
28
|
+
element = super(name, *args) + help
|
29
|
+
|
30
|
+
if prepend = options.delete(:prepend)
|
31
|
+
element = content_tag(:div, class: 'input-prepend') do
|
32
|
+
content_tag(:span, prepend, class: 'add-on') + element
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
element
|
28
37
|
end
|
29
38
|
end
|
30
39
|
end
|
data/test/bootstrap_form_test.rb
CHANGED
@@ -114,6 +114,11 @@ class BootstrapFormTest < ActionView::TestCase
|
|
114
114
|
assert_equal expected, @builder.text_field(:email, label: 'Email Address')
|
115
115
|
end
|
116
116
|
|
117
|
+
test "adding prepend text" do
|
118
|
+
expected = %{<div class=\"control-group\"><label class=\"control-label\" for=\"user_email\">Email</label><div class=\"controls\"><div class=\"input-prepend\"><span class=\"add-on\">Gmail</span><input id=\"user_email\" name=\"user[email]\" size=\"30\" type=\"text\" value=\"steve@example.com\" /></div></div></div>}
|
119
|
+
assert_equal expected, @builder.text_field(:email, prepend: 'Gmail')
|
120
|
+
end
|
121
|
+
|
117
122
|
test "passing :help to a field displays it inline" do
|
118
123
|
expected = %{<div class=\"control-group\"><label class=\"control-label\" for=\"user_email\">Email</label><div class=\"controls\"><input id=\"user_email\" name=\"user[email]\" size=\"30\" type=\"text\" value=\"steve@example.com\" /><span class=\"help-inline\">This is required</span></div></div>}
|
119
124
|
assert_equal expected, @builder.text_field(:email, help: 'This is required')
|
@@ -3,6 +3,17 @@
|
|
3
3
|
[1m[36m (0.1ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
4
4
|
[1m[35m (1.1ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
5
5
|
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
6
|
+
Migrating to CreateUsers (20120106063521)
|
7
|
+
[1m[35m (0.3ms)[0m CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255), "password" varchar(255), "comments" text, "status" varchar(255), "misc" varchar(255), "created_at" datetime, "updated_at" datetime)
|
8
|
+
[1m[36m (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ('20120106063521')[0m
|
9
|
+
[1m[35m (0.3ms)[0m select sqlite_version(*)
|
10
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
11
|
+
[1m[35m (0.0ms)[0m PRAGMA index_list("users")
|
12
|
+
[1m[36m (0.1ms)[0m [1mselect sqlite_version(*)[0m
|
13
|
+
[1m[35m (2.8ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
14
|
+
[1m[36m (0.4ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
15
|
+
[1m[35m (1.1ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
16
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
6
17
|
Migrating to CreateUsers (20120106063521)
|
7
18
|
[1m[35m (0.3ms)[0m CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255), "password" varchar(255), "comments" text, "status" varchar(255), "misc" varchar(255), "created_at" datetime, "updated_at" datetime)
|
8
19
|
[1m[36m (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ('20120106063521')[0m
|
@@ -11,9 +22,9 @@ Migrating to CreateUsers (20120106063521)
|
|
11
22
|
[1m[35m (0.0ms)[0m PRAGMA index_list("users")
|
12
23
|
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
13
24
|
[1m[35m (0.2ms)[0m select sqlite_version(*)
|
14
|
-
[1m[36m (0.
|
15
|
-
[1m[35m (0.
|
25
|
+
[1m[36m (0.9ms)[0m [1mCREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255), "password" varchar(255), "comments" text, "status" varchar(255), "misc" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
26
|
+
[1m[35m (0.9ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
16
27
|
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
17
|
-
[1m[35m (0.
|
28
|
+
[1m[35m (0.9ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
18
29
|
[1m[36m (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
19
|
-
[1m[35m (0.
|
30
|
+
[1m[35m (0.8ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20120106063521')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstrap_form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,56 +9,56 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
+
prerelease: false
|
16
17
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '3.1'
|
22
|
+
none: false
|
22
23
|
type: :development
|
23
|
-
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
25
|
requirements:
|
27
26
|
- - ~>
|
28
27
|
- !ruby/object:Gem::Version
|
29
28
|
version: '3.1'
|
29
|
+
none: false
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: sqlite3
|
32
|
+
prerelease: false
|
32
33
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
34
|
requirements:
|
35
35
|
- - ! '>='
|
36
36
|
- !ruby/object:Gem::Version
|
37
37
|
version: '0'
|
38
|
+
none: false
|
38
39
|
type: :development
|
39
|
-
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
41
|
requirements:
|
43
42
|
- - ! '>='
|
44
43
|
- !ruby/object:Gem::Version
|
45
44
|
version: '0'
|
45
|
+
none: false
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: timecop
|
48
|
+
prerelease: false
|
48
49
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
50
|
requirements:
|
51
51
|
- - ~>
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: 0.3.5
|
54
|
+
none: false
|
54
55
|
type: :development
|
55
|
-
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
57
|
requirements:
|
59
58
|
- - ~>
|
60
59
|
- !ruby/object:Gem::Version
|
61
60
|
version: 0.3.5
|
61
|
+
none: false
|
62
62
|
description: bootstrap_form is a rails form builder that makes it super easy to create
|
63
63
|
beautiful-looking forms using Twitter Bootstrap 2.0
|
64
64
|
email:
|
@@ -122,17 +122,17 @@ rdoc_options: []
|
|
122
122
|
require_paths:
|
123
123
|
- lib
|
124
124
|
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
-
none: false
|
126
125
|
requirements:
|
127
126
|
- - ! '>='
|
128
127
|
- !ruby/object:Gem::Version
|
129
128
|
version: '0'
|
130
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
129
|
none: false
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
131
|
requirements:
|
133
132
|
- - ! '>='
|
134
133
|
- !ruby/object:Gem::Version
|
135
134
|
version: '0'
|
135
|
+
none: false
|
136
136
|
requirements: []
|
137
137
|
rubyforge_project:
|
138
138
|
rubygems_version: 1.8.24
|