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 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
- helpers with the addition of two options `label` and `help`. Here's an
61
- example form that also uses the `actions` helper for the submit button:
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
- args << options.except(:label, :help)
27
- super(name, *args) + help
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
@@ -1,3 +1,3 @@
1
1
  module BootstrapForm
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
@@ -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
   (0.1ms) PRAGMA index_list("schema_migrations")
4
4
   (1.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
5
5
   (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
6
+ Migrating to CreateUsers (20120106063521)
7
+  (0.3ms) 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
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120106063521')
9
+  (0.3ms) select sqlite_version(*)
10
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
11
+  (0.0ms) PRAGMA index_list("users")
12
+  (0.1ms) select sqlite_version(*)
13
+  (2.8ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
14
+  (0.4ms) PRAGMA index_list("schema_migrations")
15
+  (1.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
16
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
6
17
  Migrating to CreateUsers (20120106063521)
7
18
   (0.3ms) 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
   (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120106063521')
@@ -11,9 +22,9 @@ Migrating to CreateUsers (20120106063521)
11
22
   (0.0ms) PRAGMA index_list("users")
12
23
   (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
13
24
   (0.2ms) select sqlite_version(*)
14
-  (0.8ms) 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) 
15
-  (0.8ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
25
+  (0.9ms) 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) 
26
+  (0.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
16
27
   (0.0ms) PRAGMA index_list("schema_migrations")
17
-  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
28
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
18
29
   (0.1ms) SELECT version FROM "schema_migrations"
19
-  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20120106063521')
30
+  (0.8ms) 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.3
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: 2012-10-17 00:00:00.000000000 Z
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