formtastic-bootstrap 3.0.0.rc.2 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 855a2f02f93378b601e8184fd54e0c614fab55fa
4
- data.tar.gz: 7a808dcd0f182e21fcfabd56c3a0148f411507bc
3
+ metadata.gz: 64b433e690559fd1f31b9ca9eb8d9ff10a1d5818
4
+ data.tar.gz: b1d6b9565b53ac962973ddff1de78ace485db272
5
5
  SHA512:
6
- metadata.gz: 8739521afff71a81e72353ad8d8afc821726402484f245c961ebaf0542eda69e2780c4130cad115c4d88c07d7ba057626cbc5cb5ffb40eb226745da74d7e2218
7
- data.tar.gz: 455841cca4609d8fc6981836c629e830eb59aad8715ad856de126b8ac006aa4c62b4b56aa461bee02fc64602d19e7f100d70de406c20f0bc94963c592722b55a
6
+ metadata.gz: bf8be1a24e398d57860c8929a483d9c9da7770aacb46a704645a54e8f08a7fffd43d6b10d19f8b6610d8a75d1194eed6b0b4465764dfef43ff0c11d924f64148
7
+ data.tar.gz: 4dbdce5ad3cafad6d69d9dadcd0ac37bda0861cea640df4ea1e876d7c91019de2dc936e5c32a15dbbabb7f1a9302382bb0a270c6327543abc08811a08b80a9bc
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.0.0.rc.2
1
+ 3.0.0
@@ -2,52 +2,50 @@ module FormtasticBootstrap
2
2
  module Inputs
3
3
  module Base
4
4
  module Timeish
5
+ FRAGMENT_CLASSES = {
6
+ :year => "col-xs-2",
7
+ :month => "col-xs-3",
8
+ :day => "col-xs-1",
9
+ :hour => "col-xs-offset-3 col-xs-1",
10
+ :minute => "col-xs-1",
11
+ :second => "col-xs-1"
12
+ }
5
13
 
6
14
  def to_html
7
- form_group_wrapping do
8
- label_html <<
15
+ bootstrap_wrapping do
9
16
  hidden_fragments <<
10
- form_control_row_wrapping do
17
+ row_wrapping do
11
18
  fragments.map do |fragment|
12
- fragment_input_html(fragment.to_sym)
19
+ fragment_html(fragment.to_sym)
13
20
  end.join.html_safe
14
21
  end
15
22
  end
16
23
  end
17
24
 
18
- def form_control_row_wrapping(&block)
25
+ def row_wrapping(&block)
19
26
  template.content_tag(:div,
20
27
  template.capture(&block).html_safe,
21
- form_control_row_wrapper_html_options
28
+ :class => 'row'
22
29
  )
23
30
  end
24
31
 
25
- def form_control_row_wrapper_html_options
26
- { :class => "form-control" }
27
- end
28
-
29
- def fragment_input_html(fragment)
30
- opts = input_options.merge(:prefix => fragment_prefix, :field_name => fragment_name(fragment), :default => value, :include_blank => include_blank?)
31
- template.send(:"select_#{fragment}", value, opts, fragment_input_html_options(fragment))
32
+ def fragment_html(fragment)
33
+ template.content_tag(:div, :class => fragment_class(fragment)) do
34
+ opts = input_options.merge(:prefix => fragment_prefix, :field_name => fragment_name(fragment), :default => value, :include_blank => include_blank?)
35
+ template.send(:"select_#{fragment}", value, opts, fragment_input_html_options(fragment))
36
+ end
32
37
  end
33
38
 
34
39
  def fragment_input_html_options(fragment)
35
40
  input_html_options.tap do |options|
36
41
  options[:id] = fragment_id(fragment)
37
- options[:class] = ((options[:class] || "").split << fragment_class(fragment)).join(" ")
42
+ options[:class] = ((options[:class] || "").split << "form-control").join(" ")
38
43
  options[:placeholder] = fragment_placeholder(fragment)
39
44
  end
40
45
  end
41
46
 
42
47
  def fragment_class(fragment)
43
- {
44
- :year => "col-xs-1",
45
- :month => "col-xs-2",
46
- :day => "col-xs-1",
47
- :hour => "col-xs-1",
48
- :minute => "col-xs-1",
49
- :second => "col-xs-1"
50
- }[fragment]
48
+ options[:fragment_classes] || self.class::FRAGMENT_CLASSES[fragment]
51
49
  end
52
50
 
53
51
  def fragment_placeholder(fragment)
@@ -6,24 +6,29 @@ module FormtasticBootstrap
6
6
  include Formtastic::Inputs::Base::Wrapping
7
7
 
8
8
  def bootstrap_wrapping(&block)
9
- input_content = [
9
+ form_group_wrapping do
10
+ label_html <<
11
+ template.content_tag(:span, :class => 'form-wrapper') do
12
+ input_content(&block) <<
13
+ hint_html <<
14
+ error_html(:block)
15
+ end
16
+ end
17
+ end
18
+
19
+ def input_content(&block)
20
+ content = [
10
21
  add_on_content(options[:prepend]),
11
22
  options[:prepend_content],
12
23
  yield,
13
24
  add_on_content(options[:append]),
14
- options[:append_content],
15
- hint_html
25
+ options[:append_content]
16
26
  ].compact.join("\n").html_safe
17
27
 
18
- form_group_wrapping do
19
- label_html <<
20
- if prepended_or_appended?(options)
21
- template.content_tag(:div, :class => add_on_wrapper_classes(options).join(" ")) do
22
- input_content
23
- end
24
- else
25
- input_content
26
- end
28
+ if prepended_or_appended?(options)
29
+ template.content_tag(:div, content, :class => add_on_wrapper_classes(options).join(" "))
30
+ else
31
+ content
27
32
  end
28
33
  end
29
34
 
@@ -33,7 +38,7 @@ module FormtasticBootstrap
33
38
 
34
39
  def add_on_content(content)
35
40
  return nil unless content
36
- template.content_tag(:span, content, :class => 'add-on')
41
+ template.content_tag(:span, content, :class => 'input-group-addon')
37
42
  end
38
43
 
39
44
  def form_group_wrapping(&block)
@@ -51,9 +56,9 @@ module FormtasticBootstrap
51
56
  end
52
57
 
53
58
  def add_on_wrapper_classes(options)
54
- [:prepend, :append, :prepend_content, :append_content].map do |key|
55
- "input-#{key.to_s.gsub('_content', '')}" if options[key]
56
- end
59
+ [:prepend, :append, :prepend_content, :append_content].find do |key|
60
+ options.has_key?(key)
61
+ end ? ['input-group'] : []
57
62
  end
58
63
 
59
64
  end
@@ -6,11 +6,16 @@ module FormtasticBootstrap
6
6
 
7
7
  def to_html
8
8
  checkbox_wrapping do
9
+ hidden_field_html <<
9
10
  "".html_safe <<
10
11
  [label_with_nested_checkbox, hint_html].join("\n").html_safe
11
12
  end
12
13
  end
13
14
 
15
+ def hidden_field_html
16
+ template.hidden_field_tag(input_html_options[:name], unchecked_value, :id => nil, :disabled => input_html_options[:disabled] )
17
+ end
18
+
14
19
  def label_with_nested_checkbox
15
20
  builder.label(
16
21
  method,
@@ -5,7 +5,6 @@ module FormtasticBootstrap
5
5
  include Base::Choices
6
6
 
7
7
  # TODO Make sure help blocks work correctly.
8
- # TODO Support .inline
9
8
 
10
9
  def to_html
11
10
  form_group_wrapping do
@@ -30,9 +29,11 @@ module FormtasticBootstrap
30
29
  end
31
30
 
32
31
  def checkbox_wrapping(&block)
32
+ class_name = "checkbox"
33
+ class_name += " checkbox-inline" if options[:inline]
33
34
  template.content_tag(:div,
34
35
  template.capture(&block).html_safe,
35
- :class => "checkbox"
36
+ :class => class_name
36
37
  )
37
38
  end
38
39
 
@@ -5,7 +5,7 @@ module FormtasticBootstrap
5
5
 
6
6
  def to_html
7
7
  bootstrap_wrapping do
8
- builder.country_select(method, priority_countries, input_options, input_html_options)
8
+ builder.country_select(method, priority_countries, input_options, form_control_input_html_options)
9
9
  end
10
10
  end
11
11
 
@@ -1,8 +1,14 @@
1
1
  module FormtasticBootstrap
2
2
  module Inputs
3
3
  class DateSelectInput < Formtastic::Inputs::DateSelectInput
4
+ FRAGMENT_CLASSES = {
5
+ :year => "col-xs-4",
6
+ :month => "col-xs-5",
7
+ :day => "col-xs-3"
8
+ }
9
+
4
10
  include Base
5
11
  include Base::Timeish
6
12
  end
7
13
  end
8
- end
14
+ end
@@ -5,7 +5,6 @@ module FormtasticBootstrap
5
5
  include Base::Choices
6
6
 
7
7
  # TODO Make sure help blocks work correctly.
8
- # TODO Support .inline
9
8
 
10
9
  def to_html
11
10
  form_group_wrapping do
@@ -35,9 +34,11 @@ module FormtasticBootstrap
35
34
  end
36
35
 
37
36
  def radio_wrapping(&block)
37
+ class_name = "radio"
38
+ class_name += " radio-inline" if options[:inline]
38
39
  template.content_tag(:div,
39
40
  template.capture(&block).html_safe,
40
- :class => "radio"
41
+ :class => class_name
41
42
  )
42
43
  end
43
44
 
@@ -1,6 +1,12 @@
1
1
  module FormtasticBootstrap
2
2
  module Inputs
3
3
  class TimeSelectInput < Formtastic::Inputs::TimeSelectInput
4
+ FRAGMENT_CLASSES = {
5
+ :hour => "col-xs-4",
6
+ :minute => "col-xs-4",
7
+ :secound => "col-xs-4"
8
+ }
9
+
4
10
  include Base
5
11
  include Base::Timeish
6
12
  end
@@ -1,3 +1,3 @@
1
1
  module FormtasticBootstrap
2
- VERSION = "3.0.0.rc.2"
2
+ VERSION = "3.0.0"
3
3
  end
@@ -5,35 +5,3 @@
5
5
  .alert.alert-error > ul.error-list {
6
6
  margin-bottom: 0px;
7
7
  }
8
-
9
-
10
- /*
11
- ** Timeish fixes.
12
- */
13
-
14
- .datetime_select .form-control,
15
- .date_select .form-control,
16
- .time_select .form-control,
17
- .datetime .form-control,
18
- .date .form-control,
19
- .time .form-control
20
- {
21
- border: none;
22
- -webkit-box-shadow: none;
23
- box-shadow: none;
24
- padding: 0px 0px;
25
- }
26
-
27
- .datetime_select .form-control select,
28
- .date_select .form-control select,
29
- .time_select .form-control select,
30
- .datetime .form-control select,
31
- .date .form-control select,
32
- .time .form-control select
33
- {
34
- /* This works for me in FireFox but does not work in
35
- Safari or Chrome (31.) If I set a background-color
36
- it will suddenly work in both of those browsers.
37
- */
38
- height: 34px;
39
- }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formtastic-bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.rc.2
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Bellantoni
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-28 00:00:00.000000000 Z
12
+ date: 2014-02-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: formtastic
@@ -224,12 +224,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
224
224
  version: '0'
225
225
  required_rubygems_version: !ruby/object:Gem::Requirement
226
226
  requirements:
227
- - - '>'
227
+ - - '>='
228
228
  - !ruby/object:Gem::Version
229
- version: 1.3.1
229
+ version: '0'
230
230
  requirements: []
231
231
  rubyforge_project:
232
- rubygems_version: 2.1.11
232
+ rubygems_version: 2.0.3
233
233
  signing_key:
234
234
  specification_version: 4
235
235
  summary: Formtastic form builder to generate Twitter Bootstrap-friendly markup.