bootstrap_form 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -1
- data/lib/bootstrap_form.rb +0 -1
- data/lib/bootstrap_form/form_builder.rb +14 -13
- data/lib/bootstrap_form/helper.rb +5 -1
- data/lib/bootstrap_form/helpers/bootstrap.rb +68 -0
- data/lib/bootstrap_form/helpers/nested_form.rb +33 -0
- data/lib/bootstrap_form/version.rb +1 -1
- data/test/bootstrap_form_test.rb +22 -4
- data/test/dummy/log/test.log +22842 -0
- metadata +5 -4
- data/lib/bootstrap_form/bootstrap_helpers.rb +0 -66
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: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Potenza
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-04-
|
12
|
+
date: 2014-04-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 0.3.5
|
56
56
|
description: bootstrap_form is a rails form builder that makes it super easy to create
|
57
|
-
beautiful-looking forms using Twitter
|
57
|
+
beautiful-looking forms using Twitter Bootstrap 3+
|
58
58
|
email:
|
59
59
|
- potenza@gmail.com
|
60
60
|
- carlos.el.lopes@gmail.com
|
@@ -67,9 +67,10 @@ files:
|
|
67
67
|
- Rakefile
|
68
68
|
- app/assets/stylesheets/rails_bootstrap_forms.css
|
69
69
|
- lib/bootstrap_form.rb
|
70
|
-
- lib/bootstrap_form/bootstrap_helpers.rb
|
71
70
|
- lib/bootstrap_form/form_builder.rb
|
72
71
|
- lib/bootstrap_form/helper.rb
|
72
|
+
- lib/bootstrap_form/helpers/bootstrap.rb
|
73
|
+
- lib/bootstrap_form/helpers/nested_form.rb
|
73
74
|
- lib/bootstrap_form/version.rb
|
74
75
|
- test/bootstrap_form_test.rb
|
75
76
|
- test/dummy/Gemfile
|
@@ -1,66 +0,0 @@
|
|
1
|
-
module BootstrapForm
|
2
|
-
module BootstrapHelpers
|
3
|
-
def submit(name = nil, options = {})
|
4
|
-
options.merge! class: "btn btn-default" unless options.has_key? :class
|
5
|
-
super(name, options)
|
6
|
-
end
|
7
|
-
|
8
|
-
def primary(name = nil, options = {})
|
9
|
-
options.merge! class: "btn btn-primary"
|
10
|
-
submit(name, options)
|
11
|
-
end
|
12
|
-
|
13
|
-
def alert_message(title, options = {})
|
14
|
-
css = options[:class] || "alert alert-danger"
|
15
|
-
|
16
|
-
if object.respond_to?(:errors) && object.errors.full_messages.any?
|
17
|
-
content_tag :div, class: css do
|
18
|
-
concat content_tag :p, title
|
19
|
-
concat error_summary unless inline_errors || options[:error_summary] == false
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def error_summary
|
25
|
-
content_tag :ul, class: "rails-bootstrap-forms-error-summary" do
|
26
|
-
object.errors.full_messages.each do |error|
|
27
|
-
concat content_tag(:li, error)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def errors_on(name)
|
33
|
-
if has_error?(name)
|
34
|
-
content_tag :div, class: "alert alert-danger" do
|
35
|
-
object.errors.full_messages_for(name).join(", ")
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def static_control(name, options = {}, &block)
|
41
|
-
html = if block_given?
|
42
|
-
capture(&block)
|
43
|
-
else
|
44
|
-
object.send(name)
|
45
|
-
end
|
46
|
-
|
47
|
-
form_group_builder(name, options) do
|
48
|
-
content_tag(:p, html, class: static_class)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def prepend_and_append_input(options, &block)
|
53
|
-
options = options.extract!(:prepend, :append)
|
54
|
-
input = capture(&block)
|
55
|
-
|
56
|
-
input = content_tag(:span, options[:prepend], class: "input-group-addon") + input if options[:prepend]
|
57
|
-
input << content_tag(:span, options[:append], class: "input-group-addon") if options[:append]
|
58
|
-
input = content_tag(:div, input, class: "input-group") if options[:prepend] || options[:append]
|
59
|
-
input
|
60
|
-
end
|
61
|
-
|
62
|
-
def static_class
|
63
|
-
"form-control-static"
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|