formtastic-bootstrap 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +11 -2
- data/VERSION +1 -1
- data/vendor/assets/stylesheets/formtastic-bootstrap.css +4 -0
- metadata +51 -154
- data/.rspec +0 -1
- data/Gemfile +0 -14
- data/Gemfile.lock +0 -131
- data/Rakefile +0 -49
- data/formtastic-bootstrap.gemspec +0 -166
- data/lib/action_view/helpers/text_field_date_helper.rb +0 -166
- data/lib/formtastic-bootstrap/actions.rb +0 -10
- data/lib/formtastic-bootstrap/actions/base.rb +0 -22
- data/lib/formtastic-bootstrap/actions/button_action.rb +0 -13
- data/lib/formtastic-bootstrap/actions/input_action.rb +0 -13
- data/lib/formtastic-bootstrap/actions/link_action.rb +0 -12
- data/lib/formtastic-bootstrap/engine.rb +0 -4
- data/lib/formtastic-bootstrap/form_builder.rb +0 -40
- data/lib/formtastic-bootstrap/helpers.rb +0 -17
- data/lib/formtastic-bootstrap/helpers/action_helper.rb +0 -12
- data/lib/formtastic-bootstrap/helpers/actions_helper.rb +0 -24
- data/lib/formtastic-bootstrap/helpers/fieldset_wrapper.rb +0 -35
- data/lib/formtastic-bootstrap/helpers/input_helper.rb +0 -12
- data/lib/formtastic-bootstrap/helpers/inputs_helper.rb +0 -34
- data/lib/formtastic-bootstrap/inputs.rb +0 -36
- data/lib/formtastic-bootstrap/inputs/base.rb +0 -45
- data/lib/formtastic-bootstrap/inputs/base/choices.rb +0 -20
- data/lib/formtastic-bootstrap/inputs/base/collections.rb +0 -9
- data/lib/formtastic-bootstrap/inputs/base/errors.rb +0 -48
- data/lib/formtastic-bootstrap/inputs/base/grouped_collections.rb +0 -9
- data/lib/formtastic-bootstrap/inputs/base/hints.rb +0 -27
- data/lib/formtastic-bootstrap/inputs/base/html.rb +0 -21
- data/lib/formtastic-bootstrap/inputs/base/labelling.rb +0 -29
- data/lib/formtastic-bootstrap/inputs/base/numeric.rb +0 -9
- data/lib/formtastic-bootstrap/inputs/base/stringish.rb +0 -17
- data/lib/formtastic-bootstrap/inputs/base/timeish.rb +0 -55
- data/lib/formtastic-bootstrap/inputs/base/wrapping.rb +0 -55
- data/lib/formtastic-bootstrap/inputs/boolean_input.rb +0 -29
- data/lib/formtastic-bootstrap/inputs/check_boxes_input.rb +0 -40
- data/lib/formtastic-bootstrap/inputs/date_input.rb +0 -10
- data/lib/formtastic-bootstrap/inputs/date_select_input.rb +0 -8
- data/lib/formtastic-bootstrap/inputs/datetime_input.rb +0 -10
- data/lib/formtastic-bootstrap/inputs/datetime_select_input.rb +0 -8
- data/lib/formtastic-bootstrap/inputs/email_input.rb +0 -15
- data/lib/formtastic-bootstrap/inputs/file_input.rb +0 -14
- data/lib/formtastic-bootstrap/inputs/hidden_input.rb +0 -12
- data/lib/formtastic-bootstrap/inputs/number_input.rb +0 -15
- data/lib/formtastic-bootstrap/inputs/password_input.rb +0 -15
- data/lib/formtastic-bootstrap/inputs/phone_input.rb +0 -15
- data/lib/formtastic-bootstrap/inputs/radio_input.rb +0 -46
- data/lib/formtastic-bootstrap/inputs/range_input.rb +0 -15
- data/lib/formtastic-bootstrap/inputs/search_input.rb +0 -15
- data/lib/formtastic-bootstrap/inputs/select_input.rb +0 -16
- data/lib/formtastic-bootstrap/inputs/string_input.rb +0 -8
- data/lib/formtastic-bootstrap/inputs/text_input.rb +0 -14
- data/lib/formtastic-bootstrap/inputs/time_input.rb +0 -10
- data/lib/formtastic-bootstrap/inputs/time_select_input.rb +0 -8
- data/lib/formtastic-bootstrap/inputs/time_zone_input.rb +0 -14
- data/lib/formtastic-bootstrap/inputs/url_input.rb +0 -14
- data/spec/actions/button_action_spec.rb +0 -63
- data/spec/actions/input_action_spec.rb +0 -59
- data/spec/actions/link_action_spec.rb +0 -92
- data/spec/builder/semantic_fields_for_spec.rb +0 -130
- data/spec/helpers/action_helper_spec.rb +0 -368
- data/spec/helpers/actions_helper_spec.rb +0 -147
- data/spec/helpers/input_helper_spec.rb +0 -935
- data/spec/helpers/inputs_helper_spec.rb +0 -636
- data/spec/inputs/boolean_input_spec.rb +0 -226
- data/spec/inputs/check_boxes_input_spec.rb +0 -454
- data/spec/inputs/date_select_input_spec.rb +0 -164
- data/spec/inputs/datetime_select_input_spec.rb +0 -112
- data/spec/inputs/deprecated_time_date_datetime_inputs_spec.rb +0 -48
- data/spec/inputs/email_input_spec.rb +0 -86
- data/spec/inputs/file_input_spec.rb +0 -90
- data/spec/inputs/hidden_input_spec.rb +0 -153
- data/spec/inputs/number_input_spec.rb +0 -816
- data/spec/inputs/password_input_spec.rb +0 -100
- data/spec/inputs/phone_input_spec.rb +0 -86
- data/spec/inputs/radio_input_spec.rb +0 -267
- data/spec/inputs/range_input_spec.rb +0 -506
- data/spec/inputs/search_input_spec.rb +0 -85
- data/spec/inputs/select_input_spec.rb +0 -624
- data/spec/inputs/string_input_spec.rb +0 -210
- data/spec/inputs/text_input_spec.rb +0 -188
- data/spec/inputs/time_select_input_spec.rb +0 -191
- data/spec/inputs/time_zone_input_spec.rb +0 -118
- data/spec/inputs/url_input_spec.rb +0 -86
- data/spec/spec_helper.rb +0 -30
- data/spec/support/custom_macros.rb +0 -537
- data/spec/support/fb_custom_macros.rb +0 -23
data/Rakefile
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'bundler'
|
5
|
-
begin
|
6
|
-
Bundler.setup(:default, :development)
|
7
|
-
rescue Bundler::BundlerError => e
|
8
|
-
$stderr.puts e.message
|
9
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
-
exit e.status_code
|
11
|
-
end
|
12
|
-
require 'rake'
|
13
|
-
|
14
|
-
require 'jeweler'
|
15
|
-
Jeweler::Tasks.new do |gem|
|
16
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
-
gem.name = "formtastic-bootstrap"
|
18
|
-
gem.homepage = "http://github.com/mjbellantoni/formtastic-bootstrap"
|
19
|
-
gem.license = "MIT"
|
20
|
-
gem.summary = %Q{Formtastic form builder to generate Twitter Bootstrap-friendly markup.}
|
21
|
-
gem.description = gem.summary
|
22
|
-
gem.email = "mjbellantoni@yahoo.com"
|
23
|
-
gem.authors = ["Matthew Bellantoni"]
|
24
|
-
# dependencies defined in Gemfile
|
25
|
-
end
|
26
|
-
Jeweler::RubygemsDotOrgTasks.new
|
27
|
-
|
28
|
-
require 'rspec/core'
|
29
|
-
require 'rspec/core/rake_task'
|
30
|
-
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
-
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
-
end
|
33
|
-
|
34
|
-
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
35
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
36
|
-
spec.rcov = true
|
37
|
-
end
|
38
|
-
|
39
|
-
task :default => :spec
|
40
|
-
|
41
|
-
require 'rdoc/task'
|
42
|
-
Rake::RDocTask.new do |rdoc|
|
43
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
44
|
-
|
45
|
-
rdoc.rdoc_dir = 'rdoc'
|
46
|
-
rdoc.title = "formtastic-bootstrap #{version}"
|
47
|
-
rdoc.rdoc_files.include('README*')
|
48
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
49
|
-
end
|
@@ -1,166 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = "formtastic-bootstrap"
|
8
|
-
s.version = "2.0.0"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Matthew Bellantoni"]
|
12
|
-
s.date = "2012-09-05"
|
13
|
-
s.description = "Formtastic form builder to generate Twitter Bootstrap-friendly markup."
|
14
|
-
s.email = "mjbellantoni@yahoo.com"
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE.txt",
|
17
|
-
"README.md"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".rspec",
|
22
|
-
"Gemfile",
|
23
|
-
"Gemfile.lock",
|
24
|
-
"LICENSE.txt",
|
25
|
-
"README.md",
|
26
|
-
"Rakefile",
|
27
|
-
"VERSION",
|
28
|
-
"formtastic-bootstrap.gemspec",
|
29
|
-
"lib/action_view/helpers/text_field_date_helper.rb",
|
30
|
-
"lib/formtastic-bootstrap.rb",
|
31
|
-
"lib/formtastic-bootstrap/actions.rb",
|
32
|
-
"lib/formtastic-bootstrap/actions/base.rb",
|
33
|
-
"lib/formtastic-bootstrap/actions/button_action.rb",
|
34
|
-
"lib/formtastic-bootstrap/actions/input_action.rb",
|
35
|
-
"lib/formtastic-bootstrap/actions/link_action.rb",
|
36
|
-
"lib/formtastic-bootstrap/engine.rb",
|
37
|
-
"lib/formtastic-bootstrap/form_builder.rb",
|
38
|
-
"lib/formtastic-bootstrap/helpers.rb",
|
39
|
-
"lib/formtastic-bootstrap/helpers/action_helper.rb",
|
40
|
-
"lib/formtastic-bootstrap/helpers/actions_helper.rb",
|
41
|
-
"lib/formtastic-bootstrap/helpers/fieldset_wrapper.rb",
|
42
|
-
"lib/formtastic-bootstrap/helpers/input_helper.rb",
|
43
|
-
"lib/formtastic-bootstrap/helpers/inputs_helper.rb",
|
44
|
-
"lib/formtastic-bootstrap/inputs.rb",
|
45
|
-
"lib/formtastic-bootstrap/inputs/base.rb",
|
46
|
-
"lib/formtastic-bootstrap/inputs/base/choices.rb",
|
47
|
-
"lib/formtastic-bootstrap/inputs/base/collections.rb",
|
48
|
-
"lib/formtastic-bootstrap/inputs/base/errors.rb",
|
49
|
-
"lib/formtastic-bootstrap/inputs/base/grouped_collections.rb",
|
50
|
-
"lib/formtastic-bootstrap/inputs/base/hints.rb",
|
51
|
-
"lib/formtastic-bootstrap/inputs/base/html.rb",
|
52
|
-
"lib/formtastic-bootstrap/inputs/base/labelling.rb",
|
53
|
-
"lib/formtastic-bootstrap/inputs/base/numeric.rb",
|
54
|
-
"lib/formtastic-bootstrap/inputs/base/stringish.rb",
|
55
|
-
"lib/formtastic-bootstrap/inputs/base/timeish.rb",
|
56
|
-
"lib/formtastic-bootstrap/inputs/base/wrapping.rb",
|
57
|
-
"lib/formtastic-bootstrap/inputs/boolean_input.rb",
|
58
|
-
"lib/formtastic-bootstrap/inputs/check_boxes_input.rb",
|
59
|
-
"lib/formtastic-bootstrap/inputs/date_input.rb",
|
60
|
-
"lib/formtastic-bootstrap/inputs/date_select_input.rb",
|
61
|
-
"lib/formtastic-bootstrap/inputs/datetime_input.rb",
|
62
|
-
"lib/formtastic-bootstrap/inputs/datetime_select_input.rb",
|
63
|
-
"lib/formtastic-bootstrap/inputs/email_input.rb",
|
64
|
-
"lib/formtastic-bootstrap/inputs/file_input.rb",
|
65
|
-
"lib/formtastic-bootstrap/inputs/hidden_input.rb",
|
66
|
-
"lib/formtastic-bootstrap/inputs/number_input.rb",
|
67
|
-
"lib/formtastic-bootstrap/inputs/password_input.rb",
|
68
|
-
"lib/formtastic-bootstrap/inputs/phone_input.rb",
|
69
|
-
"lib/formtastic-bootstrap/inputs/radio_input.rb",
|
70
|
-
"lib/formtastic-bootstrap/inputs/range_input.rb",
|
71
|
-
"lib/formtastic-bootstrap/inputs/search_input.rb",
|
72
|
-
"lib/formtastic-bootstrap/inputs/select_input.rb",
|
73
|
-
"lib/formtastic-bootstrap/inputs/string_input.rb",
|
74
|
-
"lib/formtastic-bootstrap/inputs/text_input.rb",
|
75
|
-
"lib/formtastic-bootstrap/inputs/time_input.rb",
|
76
|
-
"lib/formtastic-bootstrap/inputs/time_select_input.rb",
|
77
|
-
"lib/formtastic-bootstrap/inputs/time_zone_input.rb",
|
78
|
-
"lib/formtastic-bootstrap/inputs/url_input.rb",
|
79
|
-
"spec/actions/button_action_spec.rb",
|
80
|
-
"spec/actions/input_action_spec.rb",
|
81
|
-
"spec/actions/link_action_spec.rb",
|
82
|
-
"spec/builder/semantic_fields_for_spec.rb",
|
83
|
-
"spec/helpers/action_helper_spec.rb",
|
84
|
-
"spec/helpers/actions_helper_spec.rb",
|
85
|
-
"spec/helpers/input_helper_spec.rb",
|
86
|
-
"spec/helpers/inputs_helper_spec.rb",
|
87
|
-
"spec/inputs/boolean_input_spec.rb",
|
88
|
-
"spec/inputs/check_boxes_input_spec.rb",
|
89
|
-
"spec/inputs/date_select_input_spec.rb",
|
90
|
-
"spec/inputs/datetime_select_input_spec.rb",
|
91
|
-
"spec/inputs/deprecated_time_date_datetime_inputs_spec.rb",
|
92
|
-
"spec/inputs/email_input_spec.rb",
|
93
|
-
"spec/inputs/file_input_spec.rb",
|
94
|
-
"spec/inputs/hidden_input_spec.rb",
|
95
|
-
"spec/inputs/number_input_spec.rb",
|
96
|
-
"spec/inputs/password_input_spec.rb",
|
97
|
-
"spec/inputs/phone_input_spec.rb",
|
98
|
-
"spec/inputs/radio_input_spec.rb",
|
99
|
-
"spec/inputs/range_input_spec.rb",
|
100
|
-
"spec/inputs/search_input_spec.rb",
|
101
|
-
"spec/inputs/select_input_spec.rb",
|
102
|
-
"spec/inputs/string_input_spec.rb",
|
103
|
-
"spec/inputs/text_input_spec.rb",
|
104
|
-
"spec/inputs/time_select_input_spec.rb",
|
105
|
-
"spec/inputs/time_zone_input_spec.rb",
|
106
|
-
"spec/inputs/url_input_spec.rb",
|
107
|
-
"spec/spec_helper.rb",
|
108
|
-
"spec/support/custom_macros.rb",
|
109
|
-
"spec/support/fb_custom_macros.rb",
|
110
|
-
"vendor/assets/stylesheets/formtastic-bootstrap.css"
|
111
|
-
]
|
112
|
-
s.homepage = "http://github.com/mjbellantoni/formtastic-bootstrap"
|
113
|
-
s.licenses = ["MIT"]
|
114
|
-
s.require_paths = ["lib"]
|
115
|
-
s.rubygems_version = "1.8.10"
|
116
|
-
s.summary = "Formtastic form builder to generate Twitter Bootstrap-friendly markup."
|
117
|
-
|
118
|
-
if s.respond_to? :specification_version then
|
119
|
-
s.specification_version = 3
|
120
|
-
|
121
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
122
|
-
s.add_runtime_dependency(%q<formtastic-bootstrap>, [">= 0"])
|
123
|
-
s.add_runtime_dependency(%q<formtastic>, ["~> 2.2"])
|
124
|
-
s.add_development_dependency(%q<rspec>, [">= 0"])
|
125
|
-
s.add_development_dependency(%q<bundler>, [">= 0"])
|
126
|
-
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
127
|
-
s.add_development_dependency(%q<rcov>, [">= 0"])
|
128
|
-
s.add_development_dependency(%q<rspec_tag_matchers>, [">= 0"])
|
129
|
-
s.add_development_dependency(%q<ammeter>, [">= 0"])
|
130
|
-
s.add_development_dependency(%q<rspec-rails>, ["~> 2.8.0"])
|
131
|
-
s.add_development_dependency(%q<bundler>, [">= 0"])
|
132
|
-
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
133
|
-
s.add_development_dependency(%q<rcov>, [">= 0"])
|
134
|
-
s.add_development_dependency(%q<rspec_tag_matchers>, [">= 0"])
|
135
|
-
else
|
136
|
-
s.add_dependency(%q<formtastic-bootstrap>, [">= 0"])
|
137
|
-
s.add_dependency(%q<formtastic>, ["~> 2.2"])
|
138
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
139
|
-
s.add_dependency(%q<bundler>, [">= 0"])
|
140
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
141
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
142
|
-
s.add_dependency(%q<rspec_tag_matchers>, [">= 0"])
|
143
|
-
s.add_dependency(%q<ammeter>, [">= 0"])
|
144
|
-
s.add_dependency(%q<rspec-rails>, ["~> 2.8.0"])
|
145
|
-
s.add_dependency(%q<bundler>, [">= 0"])
|
146
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
147
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
148
|
-
s.add_dependency(%q<rspec_tag_matchers>, [">= 0"])
|
149
|
-
end
|
150
|
-
else
|
151
|
-
s.add_dependency(%q<formtastic-bootstrap>, [">= 0"])
|
152
|
-
s.add_dependency(%q<formtastic>, ["~> 2.2"])
|
153
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
154
|
-
s.add_dependency(%q<bundler>, [">= 0"])
|
155
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
156
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
157
|
-
s.add_dependency(%q<rspec_tag_matchers>, [">= 0"])
|
158
|
-
s.add_dependency(%q<ammeter>, [">= 0"])
|
159
|
-
s.add_dependency(%q<rspec-rails>, ["~> 2.8.0"])
|
160
|
-
s.add_dependency(%q<bundler>, [">= 0"])
|
161
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
162
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
163
|
-
s.add_dependency(%q<rspec_tag_matchers>, [">= 0"])
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
@@ -1,166 +0,0 @@
|
|
1
|
-
require 'action_view/helpers/form_tag_helper'
|
2
|
-
|
3
|
-
module ActionView
|
4
|
-
module Helpers
|
5
|
-
|
6
|
-
module TextFieldDateHelper
|
7
|
-
|
8
|
-
# These two handle an object with a method that returns a Date or Time object.
|
9
|
-
def date_text_field(object_name, method, options = {}, html_options = {})
|
10
|
-
InstanceTag.new(object_name, method, self, options.delete(:object)).to_date_text_field_tag(options, html_options)
|
11
|
-
end
|
12
|
-
|
13
|
-
def time_text_field(object_name, method, options = {}, html_options = {})
|
14
|
-
InstanceTag.new(object_name, method, self, options.delete(:object)).to_time_text_field_tag(options, html_options)
|
15
|
-
end
|
16
|
-
|
17
|
-
# These two handle Date and Time objects.
|
18
|
-
def text_field_date(date = Date.current, options = {}, html_options = {})
|
19
|
-
DateTimeSelector.new(date, options, html_options).text_field_date
|
20
|
-
end
|
21
|
-
|
22
|
-
def text_field_time(time = Time.current, options = {}, html_options = {})
|
23
|
-
DateTimeSelector.new(time, options, html_options).text_field_time
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
class DateTimeSelector
|
28
|
-
|
29
|
-
include ActionView::Helpers::FormTagHelper
|
30
|
-
|
31
|
-
def text_field_date
|
32
|
-
order = date_order.dup
|
33
|
-
|
34
|
-
@options[:discard_hour] = true
|
35
|
-
@options[:discard_minute] = true
|
36
|
-
@options[:discard_second] = true
|
37
|
-
|
38
|
-
@options[:discard_year] ||= true unless order.include?(:year)
|
39
|
-
@options[:discard_month] ||= true unless order.include?(:month)
|
40
|
-
@options[:discard_day] ||= true if @options[:discard_month] || !order.include?(:day)
|
41
|
-
|
42
|
-
# Save this so we can restore it.
|
43
|
-
original_datetime_separator_separator = @options[:datetime_separator]
|
44
|
-
original_date_separator = @options[:date_separator]
|
45
|
-
|
46
|
-
@options[:datetime_separator] = ""
|
47
|
-
@options[:date_separator] = " "
|
48
|
-
|
49
|
-
# If the day is hidden and the month is visible, the day should be set to the 1st so all month choices are
|
50
|
-
# valid (otherwise it could be 31 and February wouldn't be a valid date)
|
51
|
-
if @datetime && @options[:discard_day] && !@options[:discard_month]
|
52
|
-
@datetime = @datetime.change(:day => 1)
|
53
|
-
end
|
54
|
-
|
55
|
-
[:day, :month, :year].each { |o| order.unshift(o) unless order.include?(o) }
|
56
|
-
|
57
|
-
build_text_field_from_types(order).tap do
|
58
|
-
# Restore.
|
59
|
-
@options[:datetime_separator] = original_datetime_separator_separator
|
60
|
-
@options[:date_separator] = original_date_separator
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def text_field_time
|
65
|
-
order = []
|
66
|
-
|
67
|
-
@options[:discard_month] = true
|
68
|
-
@options[:discard_year] = true
|
69
|
-
@options[:discard_day] = true
|
70
|
-
@options[:discard_second] ||= true unless @options[:include_seconds]
|
71
|
-
|
72
|
-
# Save this so we can restore it.
|
73
|
-
original_datetime_separator = @options[:datetime_separator]
|
74
|
-
original_time_separator = @options[:time_separator]
|
75
|
-
original_date_separator = @options[:date_separator]
|
76
|
-
|
77
|
-
@options[:datetime_separator] = ''
|
78
|
-
@options[:time_separator] = ':'
|
79
|
-
@options[:date_separator] = " "
|
80
|
-
|
81
|
-
order += [:year, :month, :day] unless @options[:ignore_date]
|
82
|
-
|
83
|
-
order += [:hour, :minute]
|
84
|
-
order << :second if @options[:include_seconds]
|
85
|
-
|
86
|
-
build_text_field_from_types(order).tap do
|
87
|
-
# Restore.
|
88
|
-
@options[:datetime_separator] = original_datetime_separator
|
89
|
-
@options[:date_separator] = original_date_separator
|
90
|
-
@options[:time_separator] = original_time_separator
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
def text_field_second
|
95
|
-
unless @options[:use_hidden] || @options[:discard_second]
|
96
|
-
build_text(:second, sec)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
def text_field_minute
|
101
|
-
unless @options[:use_hidden] || @options[:discard_minute]
|
102
|
-
build_text(:minute, min)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
def text_field_hour
|
107
|
-
unless @options[:use_hidden] || @options[:discard_hour]
|
108
|
-
build_text(:hour, hour, :ampm => @options[:ampm])
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
def text_field_day
|
113
|
-
unless @options[:use_hidden] || @options[:discard_day]
|
114
|
-
build_text(:day, day, :leading_zeros => false)
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
def text_field_month
|
119
|
-
unless @options[:use_hidden] || @options[:discard_month]
|
120
|
-
build_text(:month, month.nil? ? "" : month_name(month), :leading_zeros => false)
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
def text_field_year
|
125
|
-
unless @options[:use_hidden] || @options[:discard_year]
|
126
|
-
build_text(:year, year, :leading_zeros => false)
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
def build_text_field_from_types(order)
|
131
|
-
input = ''
|
132
|
-
order.reverse.each do |type|
|
133
|
-
separator = separator(type) unless type == order.first # don't add on last field
|
134
|
-
input.insert(0, separator.to_s + send("text_field_#{type}").to_s)
|
135
|
-
end
|
136
|
-
text_field_tag("", input.html_safe, @html_options).html_safe
|
137
|
-
end
|
138
|
-
|
139
|
-
def build_text(selected, value, options = {})
|
140
|
-
unless value.nil?
|
141
|
-
options.reverse_merge!({:leading_zeros => true, :ampm => false})
|
142
|
-
leading_zeros = options.delete(:leading_zeros)
|
143
|
-
value = leading_zeros ? sprintf("%02d", value) : value
|
144
|
-
text = options[:ampm] ? AMPM_TRANSLATION[value] : value
|
145
|
-
else
|
146
|
-
""
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
end
|
151
|
-
|
152
|
-
class InstanceTag #:nodoc:
|
153
|
-
def to_date_text_field_tag(options = {}, html_options = {})
|
154
|
-
datetime_selector(options, html_options).text_field_date.html_safe
|
155
|
-
end
|
156
|
-
|
157
|
-
def to_time_text_field_tag(options = {}, html_options = {})
|
158
|
-
datetime_selector(options, html_options).text_field_time.html_safe
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
autoload :TextFieldDateHelper
|
163
|
-
include TextFieldDateHelper
|
164
|
-
|
165
|
-
end
|
166
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
module FormtasticBootstrap
|
2
|
-
module Actions
|
3
|
-
extend ActiveSupport::Autoload
|
4
|
-
|
5
|
-
autoload :Base, 'formtastic-bootstrap/actions/base'
|
6
|
-
autoload :InputAction, 'formtastic-bootstrap/actions/input_action'
|
7
|
-
autoload :LinkAction, 'formtastic-bootstrap/actions/link_action'
|
8
|
-
autoload :ButtonAction, 'formtastic-bootstrap/actions/button_action'
|
9
|
-
end
|
10
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module FormtasticBootstrap
|
2
|
-
module Actions
|
3
|
-
module Base
|
4
|
-
|
5
|
-
# Bootstrap doesn't have wrappers.
|
6
|
-
def wrapper(&block)
|
7
|
-
# TODO Detect if user passed wrapper_html_options and issue
|
8
|
-
# a warning that they're ignored. (See the original in
|
9
|
-
# Formtastic.)
|
10
|
-
template.capture(&block)
|
11
|
-
end
|
12
|
-
|
13
|
-
def default_button_html
|
14
|
-
{
|
15
|
-
:accesskey => accesskey,
|
16
|
-
:class => "btn"
|
17
|
-
}
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# <form...>
|
2
|
-
# <fieldset class="form-actions">
|
3
|
-
# <button class="btn" type="reset" value="Reset">
|
4
|
-
# <button class="btn" type="submit" value="Create Post">
|
5
|
-
# </fieldset>
|
6
|
-
# </form>
|
7
|
-
module FormtasticBootstrap
|
8
|
-
module Actions
|
9
|
-
class ButtonAction < Formtastic::Actions::ButtonAction
|
10
|
-
include Base
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# <form...>
|
2
|
-
# <fieldset class="form-actions">
|
3
|
-
# <input class="btn" type="reset" value="Reset">
|
4
|
-
# <input class="btn" type="submit" value="Create Post">
|
5
|
-
# </fieldset>
|
6
|
-
# </form>
|
7
|
-
module FormtasticBootstrap
|
8
|
-
module Actions
|
9
|
-
class InputAction < Formtastic::Actions::InputAction
|
10
|
-
include Base
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|