padrino_bootstrap_forms 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changes +5 -0
- data/README.markdown +5 -0
- data/lib/bootstrap_forms/form_builder.rb +9 -9
- data/lib/bootstrap_forms/helpers/form_tag_helper.rb +7 -7
- data/lib/bootstrap_forms/helpers/wrappers.rb +4 -4
- data/padrino_bootstrap_forms.gemspec +6 -5
- data/spec/bootstrap_forms_spec.rb +0 -4
- data/spec/spec_helper.rb +2 -2
- data/spec/support/form_tag_helpers.rb +0 -1
- metadata +14 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e470d257213e55fe046c0f593d32ffc47c365c6c
|
4
|
+
data.tar.gz: 01e639d7c893578c6eba6cd93ea825612d87aae4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1f015b6fff9881310e27023eff46958160e7a6b8acf1235706d2751c227f2ed6434e9d129e8e937f585e4a7cc71541acc3af9c884594f06e8a0cd97b4283871
|
7
|
+
data.tar.gz: 23062a73b044aa1e48e3da6ca52649816a324e8ec7627fbc63a49087021d700e6737193abb08fec9da5a51b0c7ba2f4233667e1b716e72bcc13d3ada19bcfd9f
|
data/Changes
CHANGED
data/README.markdown
CHANGED
@@ -7,6 +7,11 @@ Padrino Bootstrap Forms is a port of [Seth Vargo's Bootstrap Forms for Rails](ht
|
|
7
7
|
|
8
8
|
Bootstrap Forms is a nice generator that makes working with [Bootstrap (by Twitter)](http://twitter.github.com/bootstrap) even easier on Padrino.
|
9
9
|
|
10
|
+
Padrio Version
|
11
|
+
------------------------
|
12
|
+
If your Padrino version is < 0.11 you must use version 0.0.2 of this gem.
|
13
|
+
|
14
|
+
|
10
15
|
Differences Between This & The Rails Version
|
11
16
|
------------------------
|
12
17
|
|
@@ -18,7 +18,7 @@ module BootstrapForms
|
|
18
18
|
label_field << input_div do
|
19
19
|
super(name, objectify_options(@field_options))
|
20
20
|
end
|
21
|
-
end
|
21
|
+
end.html_safe
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -38,7 +38,7 @@ module BootstrapForms
|
|
38
38
|
label(@name, options)
|
39
39
|
end
|
40
40
|
end
|
41
|
-
end
|
41
|
+
end.html_safe
|
42
42
|
end
|
43
43
|
|
44
44
|
def radio_buttons(name, values = {}, opts = {})
|
@@ -52,13 +52,13 @@ module BootstrapForms
|
|
52
52
|
|
53
53
|
options = { :caption => html, :class => 'radio', :for => nil }
|
54
54
|
label("#{name}_#{value}", options)
|
55
|
-
end.join('')
|
55
|
+
end.join('').html_safe
|
56
56
|
|
57
57
|
control_group_div do
|
58
58
|
# Prevent "for" attribute for a non existant id
|
59
59
|
@field_options[:id] = nil
|
60
60
|
label_field << input_div { buttons }
|
61
|
-
end
|
61
|
+
end.html_safe
|
62
62
|
end
|
63
63
|
|
64
64
|
def collection_check_boxes(attribute, records, record_id, record_name, *args)
|
@@ -75,13 +75,13 @@ module BootstrapForms
|
|
75
75
|
checkbox = check_box_tag("#{object_model_name}[#{attribute}][]", options)
|
76
76
|
checkbox << record.send(record_name)
|
77
77
|
content_tag(:label, checkbox, :class => ['checkbox', ('inline' if @field_options[:inline])].compact.join(' '))
|
78
|
-
end.join('')
|
78
|
+
end.join('').html_safe
|
79
79
|
|
80
80
|
control_group_div do
|
81
81
|
# Prevent "for" attribute for a non existant id
|
82
82
|
@field_options[:id] = nil
|
83
83
|
label_field << input_div { boxes }
|
84
|
-
end
|
84
|
+
end.html_safe
|
85
85
|
end
|
86
86
|
|
87
87
|
def collection_radio_buttons(attribute, records, record_id, record_name, *args)
|
@@ -95,13 +95,13 @@ module BootstrapForms
|
|
95
95
|
radio = radio_button(attribute, options)
|
96
96
|
radio << record.send(record_name)
|
97
97
|
content_tag(:label, radio, :class => ['radio', ('inline' if @field_options[:inline])].compact.join(' '))
|
98
|
-
end.join('')
|
98
|
+
end.join('').html_safe
|
99
99
|
|
100
100
|
control_group_div do
|
101
101
|
# Prevent "for" attribute for a non existant id
|
102
102
|
@field_options[:id] = nil
|
103
103
|
label_field << input_div { buttons }
|
104
|
-
end
|
104
|
+
end.html_safe
|
105
105
|
end
|
106
106
|
|
107
107
|
def uneditable_input(name, *args)
|
@@ -128,7 +128,7 @@ module BootstrapForms
|
|
128
128
|
|
129
129
|
def actions(&block)
|
130
130
|
content = block_given? ? capture_html(&block) : [submit, cancel].join(' ')
|
131
|
-
content_tag(:div, content, :class => 'form-actions')
|
131
|
+
content_tag(:div, content, :class => 'form-actions').html_safe
|
132
132
|
end
|
133
133
|
end
|
134
134
|
end
|
@@ -12,10 +12,10 @@ module BootstrapForms
|
|
12
12
|
@field_options[:id] ||= name
|
13
13
|
|
14
14
|
control_group_div do
|
15
|
-
label_field
|
15
|
+
label_field << input_div do
|
16
16
|
send(method_name.to_sym, name, objectify_options(@field_options))
|
17
17
|
end
|
18
|
-
end
|
18
|
+
end.html_safe
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -39,7 +39,7 @@ module BootstrapForms
|
|
39
39
|
|
40
40
|
content_tag(:span, escape_html(options[:value]), objectify_options(options.except(:value)))
|
41
41
|
end
|
42
|
-
end
|
42
|
+
end.html_safe
|
43
43
|
end
|
44
44
|
|
45
45
|
def bootstrap_button_tag(*args)
|
@@ -48,7 +48,7 @@ module BootstrapForms
|
|
48
48
|
|
49
49
|
name = args.shift || 'Submit'
|
50
50
|
# button_tag() renders <input type="button">
|
51
|
-
content_tag(:button, name, options)
|
51
|
+
content_tag(:button, name, options).html_safe
|
52
52
|
end
|
53
53
|
|
54
54
|
def bootstrap_submit_tag(*args)
|
@@ -56,7 +56,7 @@ module BootstrapForms
|
|
56
56
|
options[:class] ||= 'btn btn-primary'
|
57
57
|
|
58
58
|
name = args.shift || 'Submit'
|
59
|
-
submit_tag(name, options)
|
59
|
+
submit_tag(name, options).html_safe
|
60
60
|
end
|
61
61
|
|
62
62
|
def bootstrap_cancel_tag(*args)
|
@@ -65,7 +65,7 @@ module BootstrapForms
|
|
65
65
|
options[:back] ||= 'javascript:history.go(-1)'
|
66
66
|
|
67
67
|
name = args.shift || 'Cancel'
|
68
|
-
link_to(name, options[:back], options.except(:back))
|
68
|
+
link_to(name, options[:back], options.except(:back)).html_safe
|
69
69
|
end
|
70
70
|
|
71
71
|
def bootstrap_actions(&block)
|
@@ -75,7 +75,7 @@ module BootstrapForms
|
|
75
75
|
if block_given?
|
76
76
|
content_tag(:div, :class => 'form-actions', &block)
|
77
77
|
else
|
78
|
-
content = [bootstrap_submit_tag, bootstrap_cancel_tag].join(' ')
|
78
|
+
content = [bootstrap_submit_tag, bootstrap_cancel_tag].join(' ').html_safe
|
79
79
|
content_tag(:div, content, :class => 'form-actions')
|
80
80
|
end
|
81
81
|
end
|
@@ -33,7 +33,7 @@ module BootstrapForms
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
def input_div(include_messages = true, &block)
|
36
|
+
def input_div(include_messages = true, &block)
|
37
37
|
if @field_options[:append] || @field_options[:prepend]
|
38
38
|
klasses = []
|
39
39
|
klasses << 'input-prepend' if @field_options[:prepend]
|
@@ -67,7 +67,7 @@ module BootstrapForms
|
|
67
67
|
|
68
68
|
%w(help_block help_inline bootstrap_error success warning info append prepend).each do |method_name|
|
69
69
|
define_method(method_name) do |*args|
|
70
|
-
# Hack to avoid clashing with Padrino's error method
|
70
|
+
# Hack to avoid clashing with Padrino's error method
|
71
71
|
method_name = "error" if method_name == "bootstrap_error"
|
72
72
|
return '' unless value = @field_options[method_name.to_sym]
|
73
73
|
case method_name
|
@@ -83,11 +83,11 @@ module BootstrapForms
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def messages
|
86
|
-
[help_inline, bootstrap_error, success, warning, info, help_block].join('')
|
86
|
+
[help_inline, bootstrap_error, success, warning, info, help_block].join('').html_safe
|
87
87
|
end
|
88
88
|
|
89
89
|
def addon(&block)
|
90
|
-
[prepend, block[], append].join('')
|
90
|
+
[prepend, block[], append].join('').html_safe
|
91
91
|
end
|
92
92
|
|
93
93
|
def objectify_options(options)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "padrino_bootstrap_forms"
|
3
|
-
s.version = "0.0
|
3
|
+
s.version = "0.1.0"
|
4
4
|
s.authors = ["Seth Vargo", "Skye Shaw"]
|
5
5
|
s.email = "skye.shaw@gmail.com"
|
6
6
|
s.homepage = "https://github.com/sshaw/padrino_bootstrap_forms"
|
@@ -14,11 +14,12 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
15
15
|
s.require_paths = ["lib"]
|
16
16
|
|
17
|
-
s.
|
18
|
-
s.add_dependency "
|
17
|
+
s.license = "MIT"
|
18
|
+
s.add_dependency "padrino", "~> 0.11"
|
19
|
+
s.add_dependency "activesupport", "~> 3.1"
|
19
20
|
s.add_development_dependency "rake"
|
20
|
-
s.add_development_dependency "slim"
|
21
|
-
s.add_development_dependency "haml", "~>
|
21
|
+
s.add_development_dependency "slim"
|
22
|
+
s.add_development_dependency "haml", "~> 4.0"
|
22
23
|
s.add_development_dependency "rack-test", "~> 0.6.1"
|
23
24
|
s.add_development_dependency "rspec", "~> 2.9"
|
24
25
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -72,7 +72,7 @@ module SpecHelper
|
|
72
72
|
addons_css << "input-append"
|
73
73
|
end
|
74
74
|
|
75
|
-
field = content_tag(:div, addons, :class => addons_css.join(" "))
|
75
|
+
field = content_tag(:div, addons.html_safe, :class => addons_css.join(" "))
|
76
76
|
end
|
77
77
|
|
78
78
|
nodes << field
|
@@ -89,7 +89,7 @@ module SpecHelper
|
|
89
89
|
nodes << content_tag(:span, options[:help_block], :class => "help-block")
|
90
90
|
end
|
91
91
|
|
92
|
-
nodes.join("")
|
92
|
+
nodes.join("").html_safe
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
@@ -52,7 +52,6 @@ shared_examples "form tag helpers" do
|
|
52
52
|
end
|
53
53
|
|
54
54
|
it "renders using content from the provided block" do
|
55
|
-
pending "Test case fails, but correct HTML is rendered" if format == :slim
|
56
55
|
req(format, "bootstrap_actions_with_block").should eq %|<div class="form-actions"><a class="btn cancel" href="javascript:history.go(-1)">No!</a></div>|
|
57
56
|
end
|
58
57
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padrino_bootstrap_forms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seth Vargo
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: padrino
|
@@ -17,28 +17,28 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ~>
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.
|
20
|
+
version: '0.11'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ~>
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 0.
|
27
|
+
version: '0.11'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: activesupport
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - ~>
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '3.
|
34
|
+
version: '3.1'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - ~>
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '3.
|
41
|
+
version: '3.1'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rake
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -57,30 +57,30 @@ dependencies:
|
|
57
57
|
name: slim
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - ! '>='
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
62
|
+
version: '0'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ! '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: '0'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: haml
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
76
|
+
version: '4.0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - ~>
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: '
|
83
|
+
version: '4.0'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: rack-test
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -983,7 +983,8 @@ files:
|
|
983
983
|
- spec/support/form_builder.rb
|
984
984
|
- spec/support/form_tag_helpers.rb
|
985
985
|
homepage: https://github.com/sshaw/padrino_bootstrap_forms
|
986
|
-
licenses:
|
986
|
+
licenses:
|
987
|
+
- MIT
|
987
988
|
metadata: {}
|
988
989
|
post_install_message:
|
989
990
|
rdoc_options: []
|