formtastic_datepicker_inputs 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 [name of plugin creator]
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,52 @@
1
+ FormtasticDatepickerInputs
2
+ ==========================
3
+
4
+ This plugin is based off of a blog post by Grzegorz Brzezinka: http://blog.brzezinka.eu/webmaster-tips/ruby/ruby-on-rails-formtastic-jquery-ui-datepicker
5
+
6
+ The concept is simple. It adds a new input into formtastic that can be used like this:
7
+ <% semantic_form_for @master do |f| -%>
8
+ <% f.inputs do -%>
9
+ <%= f.input :name %>
10
+ <%= f.input :born, :as => :date_picker %>
11
+ <% end -%>
12
+ <%= f.buttons %>
13
+ <% end -%>
14
+
15
+ It adds a class onto a normal text input called 'ui-date-picker', and the parent <li> it adds a class called 'date_picker.'
16
+ Assuming you have already referenced jquery, and jqueryui in your layout, You can then hook this with a call from jquery:
17
+
18
+ $(document).ready(function(){
19
+ $('input.ui-date-picker').datepicker();
20
+ });
21
+
22
+ Development Environment
23
+ =======================
24
+
25
+ We currently support both Rails 2 and Rails 3, under Ruby 1.8.7-ish (and 1.9.2-ish). That means, at a bare minimum, you'll want to set-up two rvm gemsets to run your specs against. So, fork the project on Github, clone it, make some gemsets, run bundler, run your specs and then finally set-up an .rvmrc file that specifies Rails 3 as your default gemset and cd back into that directory to load in the .rvmrc file. Something like this:
26
+
27
+ <pre>
28
+ $ cd ~/code/formtastic
29
+ $ rvm gemset create formtastic-rails3
30
+ $ rvm gemset use formtastic-rails3
31
+ $ gem install bundler
32
+ $ bundle install
33
+ $ rake spec
34
+ $ rm Gemfile.lock
35
+ $ rvm gemset create formtastic-rails2
36
+ $ rvm gemset use formtastic-rails2
37
+ $ gem install bundler
38
+ $ RAILS_2=true bundle install
39
+ $ RAILS_2=true rake spec
40
+ $ touch .rvmrc
41
+ $ echo "rvm gemset use formtastic-rails-3" > .rvmrc
42
+ $ cd ~/code/formtastic
43
+ </pre>
44
+
45
+ Also, most of the testing environment has been copied straight of formtastic, so if something doesn't make sense here, it probably did where I grabbed it from.
46
+
47
+ Contributors
48
+ ============
49
+
50
+ * Grzegorz Brzezinka
51
+ * Nik Petersen
52
+ * Alan Harper
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'rake'
11
+
12
+ require 'rspec/core'
13
+ require 'rspec/core/rake_task'
14
+ RSpec::Core::RakeTask.new(:spec) do |spec|
15
+ spec.pattern = FileList['spec/**/*_spec.rb']
16
+ end
17
+
18
+ task :default => :spec
data/init.rb ADDED
@@ -0,0 +1,2 @@
1
+ # Include hook code here
2
+ require 'formtastic_datepicker_inputs'
@@ -0,0 +1,48 @@
1
+ # FormtasticDatepickerInputs
2
+ #To get this solution working in Rails 3, replace:
3
+ #
4
+ #format = options[:format] || ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS[:default] || ‘%d %b %Y’
5
+ #
6
+ #with:
7
+ #
8
+ #format = options[:format] || Date::DATE_FORMATS[:default] || ‘%d %b %Y’
9
+ module Formtastic
10
+ if defined?(ActiveSupport::CoreExtensions)
11
+ DATE_FORMATS = ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS
12
+ else
13
+ DATE_FORMATS = Date::DATE_FORMATS
14
+ end
15
+
16
+ module DatePicker
17
+ protected
18
+
19
+ def date_picker_input(method, options = {})
20
+ format = options[:format] || DATE_FORMATS[:default] || '%d %b %Y'
21
+ string_input(method, date_picker_options(format, object.send(method)).merge(options))
22
+ end
23
+
24
+ # Generate html input options for the datepicker_input
25
+ #
26
+ def date_picker_options(format, value = nil)
27
+ {:input_html => {:class => 'ui-date-picker',:value => value.try(:strftime, format)}}
28
+ end
29
+ end
30
+
31
+ module DateTimePicker
32
+ protected
33
+
34
+ def datetime_picker_input(method, options = {})
35
+ format = options[:format] || DATE_FORMATS[:default] || '%d %b %Y %H:%M'
36
+ string_input(method, datetime_picker_options(format, object.send(method)).merge(options))
37
+ end
38
+
39
+ # Generate html input options for the datepicker_input
40
+ #
41
+ def datetime_picker_options(format, value = nil)
42
+ {:wrapper_html => {:class => 'datetime'},:input_html => {:class => 'ui-datetime-picker',:value => value.try(:strftime, format)}}
43
+ end
44
+ end
45
+ end
46
+
47
+ Formtastic::SemanticFormBuilder.send(:include, Formtastic::DatePicker)
48
+ Formtastic::SemanticFormBuilder.send(:include, Formtastic::DateTimePicker)
@@ -0,0 +1,78 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "FormtasticDatepickerInputs" do
4
+ include FormtasticDatepickerInputsSpecHelper
5
+
6
+ before do
7
+ @output_buffer = ''
8
+ mock_everything
9
+ end
10
+
11
+ describe "date_picker_input" do
12
+ before do
13
+ @new_post.stub!(:publish_at).and_return(DateTime.parse('2000-01-02'))
14
+ output_buffer.replace ''
15
+ @form = semantic_form_for(@new_post) do |builder|
16
+ concat(builder.input(:publish_at, :as => :date_picker))
17
+ end
18
+ end
19
+
20
+ it_should_have_input_wrapper_with_class(:date_picker)
21
+ it_should_have_input_wrapper_with_id("post_publish_at_input")
22
+ it_should_have_label_with_text(/Publish at/)
23
+ it_should_have_label_for("post_publish_at")
24
+ it_should_have_input_with_id("post_publish_at")
25
+ it_should_have_input_with_type(:text)
26
+ it_should_have_input_with_name("post[publish_at]")
27
+ it_should_have_input_with_class("ui-date-picker")
28
+
29
+ it "should format date correctly" do
30
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
31
+ output_buffer.should have_tag("form li input#post_publish_at[@value='02 Jan 2000']")
32
+ end
33
+ end
34
+
35
+ it "should use custom date format correctly" do
36
+ @new_post.stub!(:publish_at).and_return(DateTime.parse('2000-01-02'))
37
+ output_buffer.replace ''
38
+ @form = semantic_form_for(@new_post) do |builder|
39
+ concat(builder.input(:publish_at, :as => :date_picker, :format => '%A, %B %d %Y'))
40
+ end
41
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
42
+ output_buffer.should have_tag("form li input#post_publish_at[@value='Sunday, January 02 2000']")
43
+ end
44
+
45
+ describe "datetime_picker_input" do
46
+ before do
47
+ @new_post.stub!(:publish_at).and_return(DateTime.parse('2000-01-02 03:04'))
48
+ output_buffer.replace ''
49
+ @form = semantic_form_for(@new_post) do |builder|
50
+ concat(builder.input(:publish_at, :as => :datetime_picker))
51
+ end
52
+ end
53
+
54
+ it_should_have_input_wrapper_with_class(:datetime_picker)
55
+ it_should_have_input_wrapper_with_id("post_publish_at_input")
56
+ it_should_have_label_with_text(/Publish at/)
57
+ it_should_have_label_for("post_publish_at")
58
+ it_should_have_input_with_id("post_publish_at")
59
+ it_should_have_input_with_type(:text)
60
+ it_should_have_input_with_name("post[publish_at]")
61
+ it_should_have_input_with_class("ui-datetime-picker")
62
+
63
+ it "should format date correctly" do
64
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
65
+ output_buffer.should have_tag("form li input#post_publish_at[@value='02 Jan 2000 03:04']")
66
+ end
67
+ end
68
+
69
+ it "should use custom date/time format correctly" do
70
+ @new_post.stub!(:publish_at).and_return(DateTime.parse('2000-01-02 03:04'))
71
+ output_buffer.replace ''
72
+ @form = semantic_form_for(@new_post) do |builder|
73
+ concat(builder.input(:publish_at, :as => :date_picker, :format => '%A, %B %d %Y %H:%M'))
74
+ end
75
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
76
+ output_buffer.should have_tag("form li input#post_publish_at[@value='Sunday, January 02 2000 03:04']")
77
+ end
78
+ end
@@ -0,0 +1,327 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ Bundler.setup
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'rspec'
8
+
9
+ require 'active_support'
10
+ require 'action_pack'
11
+ require 'action_view'
12
+ require 'action_controller'
13
+ require 'formtastic'
14
+ require 'rspec_tag_matchers'
15
+
16
+ # Requires supporting files with custom matchers and macros, etc,
17
+ # in ./support/ and its subdirectories.
18
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
19
+
20
+ require 'formtastic_datepicker_inputs'
21
+
22
+ RSpec.configure do |config|
23
+ config.include RspecTagMatchers
24
+ config.include CustomMacros
25
+ config.mock_with :rspec
26
+ end
27
+
28
+ module FormtasticDatepickerInputsSpecHelper
29
+ include ActionPack
30
+ include ActionView::Context if defined?(ActionView::Context)
31
+ include ActionController::RecordIdentifier
32
+ include ActionView::Helpers::FormHelper
33
+ include ActionView::Helpers::FormTagHelper
34
+ include ActionView::Helpers::FormOptionsHelper
35
+ include ActionView::Helpers::UrlHelper
36
+ include ActionView::Helpers::TagHelper
37
+ include ActionView::Helpers::TextHelper
38
+ include ActionView::Helpers::ActiveRecordHelper if defined?(ActionView::Helpers::ActiveRecordHelper)
39
+ include ActionView::Helpers::ActiveModelHelper if defined?(ActionView::Helpers::ActiveModelHelper)
40
+ include ActionView::Helpers::DateHelper
41
+ include ActionView::Helpers::CaptureHelper
42
+ include ActionView::Helpers::AssetTagHelper
43
+ include ActiveSupport
44
+ include ActionController::PolymorphicRoutes if defined?(ActionController::PolymorphicRoutes)
45
+
46
+ include Formtastic::SemanticFormHelper
47
+
48
+ def rails3?
49
+ ActionPack::VERSION::MAJOR > 2
50
+ end
51
+
52
+ def rails2?
53
+ ActionPack::VERSION::MAJOR == 2
54
+ end
55
+
56
+ def default_input_type(column_type, column_name = :generic_column_name)
57
+ @new_post.stub!(column_name)
58
+ @new_post.stub!(:column_for_attribute).and_return(mock('column', :type => column_type)) unless column_type.nil?
59
+
60
+ semantic_form_for(@new_post) do |builder|
61
+ @default_type = builder.send(:default_input_type, column_name)
62
+ end
63
+
64
+ return @default_type
65
+ end
66
+
67
+ def active_model_validator(kind, attributes, options = {})
68
+ validator = mock("ActiveModel::Validations::#{kind.to_s.titlecase}Validator", :attributes => attributes, :options => options)
69
+ validator.stub!(:kind).and_return(kind)
70
+ validator
71
+ end
72
+
73
+ def active_model_presence_validator(attributes, options = {})
74
+ active_model_validator(:presence, attributes, options)
75
+ end
76
+
77
+ def active_model_length_validator(attributes, options = {})
78
+ active_model_validator(:length, attributes, options)
79
+ end
80
+
81
+ def active_model_inclusion_validator(attributes, options = {})
82
+ active_model_validator(:inclusion, attributes, options)
83
+ end
84
+
85
+ class ::Post
86
+ extend ActiveModel::Naming if defined?(ActiveModel::Naming)
87
+ include ActiveModel::Conversion if defined?(ActiveModel::Conversion)
88
+
89
+ def id
90
+ end
91
+
92
+ def persisted?
93
+ end
94
+ end
95
+ module ::Namespaced
96
+ class Post
97
+ extend ActiveModel::Naming if defined?(ActiveModel::Naming)
98
+ include ActiveModel::Conversion if defined?(ActiveModel::Conversion)
99
+
100
+ def id
101
+ end
102
+
103
+ def persisted?
104
+ end
105
+ end
106
+ end
107
+ class ::Author
108
+ extend ActiveModel::Naming if defined?(ActiveModel::Naming)
109
+ include ActiveModel::Conversion if defined?(ActiveModel::Conversion)
110
+
111
+ def to_label
112
+ end
113
+ end
114
+ class ::Continent
115
+ extend ActiveModel::Naming if defined?(ActiveModel::Naming)
116
+ include ActiveModel::Conversion if defined?(ActiveModel::Conversion)
117
+ end
118
+ class ::PostModel
119
+ extend ActiveModel::Naming if defined?(ActiveModel::Naming)
120
+ include ActiveModel::Conversion if defined?(ActiveModel::Conversion)
121
+ end
122
+
123
+ def mock_everything
124
+
125
+ # Resource-oriented styles like form_for(@post) will expect a path method for the object,
126
+ # so we're defining some here.
127
+ def post_models_path; "/postmodels/1"; end
128
+
129
+ def post_path(o); "/posts/1"; end
130
+ def posts_path; "/posts"; end
131
+ def new_post_path; "/posts/new"; end
132
+
133
+ def author_path(o); "/authors/1"; end
134
+ def authors_path; "/authors"; end
135
+ def new_author_path; "/authors/new"; end
136
+
137
+ @fred = ::Author.new
138
+ @fred.stub!(:class).and_return(::Author)
139
+ @fred.stub!(:to_label).and_return('Fred Smith')
140
+ @fred.stub!(:login).and_return('fred_smith')
141
+ @fred.stub!(:id).and_return(37)
142
+ @fred.stub!(:new_record?).and_return(false)
143
+ @fred.stub!(:errors).and_return(mock('errors', :[] => nil))
144
+ @fred.stub!(:to_key).and_return(nil)
145
+ @fred.stub!(:persisted?).and_return(nil)
146
+
147
+ @bob = ::Author.new
148
+ @bob.stub!(:to_label).and_return('Bob Rock')
149
+ @bob.stub!(:login).and_return('bob')
150
+ @bob.stub!(:created_at)
151
+ @bob.stub!(:id).and_return(42)
152
+ @bob.stub!(:posts).and_return([])
153
+ @bob.stub!(:post_ids).and_return([])
154
+ @bob.stub!(:new_record?).and_return(false)
155
+ @bob.stub!(:errors).and_return(mock('errors', :[] => nil))
156
+ @bob.stub!(:to_key).and_return(nil)
157
+ @bob.stub!(:persisted?).and_return(nil)
158
+
159
+ @james = ::Author.new
160
+ @james.stub!(:to_label).and_return('James Shock')
161
+ @james.stub!(:login).and_return('james')
162
+ @james.stub!(:id).and_return(75)
163
+ @james.stub!(:posts).and_return([])
164
+ @james.stub!(:post_ids).and_return([])
165
+ @james.stub!(:new_record?).and_return(false)
166
+ @james.stub!(:errors).and_return(mock('errors', :[] => nil))
167
+ @james.stub!(:to_key).and_return(nil)
168
+ @james.stub!(:persisted?).and_return(nil)
169
+
170
+
171
+ ::Author.stub!(:find).and_return([@fred, @bob])
172
+ ::Author.stub!(:all).and_return([@fred, @bob])
173
+ ::Author.stub!(:human_attribute_name).and_return { |column_name| column_name.humanize }
174
+ ::Author.stub!(:human_name).and_return('::Author')
175
+ ::Author.stub!(:reflect_on_association).and_return { |column_name| mock('reflection', :options => {}, :klass => Post, :macro => :has_many) if column_name == :posts }
176
+ ::Author.stub!(:content_columns).and_return([mock('column', :name => 'login'), mock('column', :name => 'created_at')])
177
+ ::Author.stub!(:to_key).and_return(nil)
178
+ ::Author.stub!(:persisted?).and_return(nil)
179
+
180
+ # Sometimes we need a mock @post object and some Authors for belongs_to
181
+ @new_post = mock('post')
182
+ @new_post.stub!(:class).and_return(::Post)
183
+ @new_post.stub!(:id).and_return(nil)
184
+ @new_post.stub!(:new_record?).and_return(true)
185
+ @new_post.stub!(:errors).and_return(mock('errors', :[] => nil))
186
+ @new_post.stub!(:author).and_return(nil)
187
+ @new_post.stub!(:reviewer).and_return(nil)
188
+ @new_post.stub!(:main_post).and_return(nil)
189
+ @new_post.stub!(:sub_posts).and_return([]) #TODO should be a mock with methods for adding sub posts
190
+ @new_post.stub!(:to_key).and_return(nil)
191
+ @new_post.stub!(:to_model).and_return(@new_post)
192
+ @new_post.stub!(:persisted?).and_return(nil)
193
+
194
+ @freds_post = mock('post')
195
+ @freds_post.stub!(:to_ary)
196
+ @freds_post.stub!(:class).and_return(::Post)
197
+ @freds_post.stub!(:to_label).and_return('Fred Smith')
198
+ @freds_post.stub!(:id).and_return(19)
199
+ @freds_post.stub!(:title).and_return("Hello World")
200
+ @freds_post.stub!(:author).and_return(@fred)
201
+ @freds_post.stub!(:author_id).and_return(@fred.id)
202
+ @freds_post.stub!(:authors).and_return([@fred])
203
+ @freds_post.stub!(:author_ids).and_return([@fred.id])
204
+ @freds_post.stub!(:new_record?).and_return(false)
205
+ @freds_post.stub!(:errors).and_return(mock('errors', :[] => nil))
206
+ @freds_post.stub!(:to_key).and_return(nil)
207
+ @freds_post.stub!(:persisted?).and_return(nil)
208
+ @fred.stub!(:posts).and_return([@freds_post])
209
+ @fred.stub!(:post_ids).and_return([@freds_post.id])
210
+
211
+ ::Post.stub!(:human_attribute_name).and_return { |column_name| column_name.humanize }
212
+ ::Post.stub!(:human_name).and_return('Post')
213
+ ::Post.stub!(:reflect_on_all_validations).and_return([])
214
+ ::Post.stub!(:reflect_on_validations_for).and_return([])
215
+ ::Post.stub!(:reflections).and_return({})
216
+ ::Post.stub!(:reflect_on_association).and_return do |column_name|
217
+ case column_name
218
+ when :author, :author_status
219
+ mock = mock('reflection', :options => {}, :klass => ::Author, :macro => :belongs_to)
220
+ mock.stub!(:[]).with(:class_name).and_return("Author")
221
+ mock
222
+ when :reviewer
223
+ mock = mock('reflection', :options => {:class_name => 'Author'}, :klass => ::Author, :macro => :belongs_to)
224
+ mock.stub!(:[]).with(:class_name).and_return("Author")
225
+ mock
226
+ when :authors
227
+ mock('reflection', :options => {}, :klass => ::Author, :macro => :has_and_belongs_to_many)
228
+ when :sub_posts
229
+ mock('reflection', :options => {}, :klass => ::Post, :macro => :has_many)
230
+ when :main_post
231
+ mock('reflection', :options => {}, :klass => ::Post, :macro => :belongs_to)
232
+ end
233
+
234
+ end
235
+ ::Post.stub!(:find).and_return([@freds_post])
236
+ ::Post.stub!(:all).and_return([@freds_post])
237
+ ::Post.stub!(:content_columns).and_return([mock('column', :name => 'title'), mock('column', :name => 'body'), mock('column', :name => 'created_at')])
238
+ ::Post.stub!(:to_key).and_return(nil)
239
+ ::Post.stub!(:persisted?).and_return(nil)
240
+ ::Post.stub!(:to_ary)
241
+
242
+ @mock_file = mock('file')
243
+ ::Formtastic::SemanticFormBuilder.file_methods.each do |method|
244
+ @mock_file.stub!(method).and_return(true)
245
+ end
246
+
247
+ @new_post.stub!(:title)
248
+ @new_post.stub!(:email)
249
+ @new_post.stub!(:url)
250
+ @new_post.stub!(:phone)
251
+ @new_post.stub!(:search)
252
+ @new_post.stub!(:to_ary)
253
+ @new_post.stub!(:body)
254
+ @new_post.stub!(:published)
255
+ @new_post.stub!(:publish_at)
256
+ @new_post.stub!(:created_at)
257
+ @new_post.stub!(:secret)
258
+ @new_post.stub!(:url)
259
+ @new_post.stub!(:email)
260
+ @new_post.stub!(:search)
261
+ @new_post.stub!(:phone)
262
+ @new_post.stub!(:time_zone)
263
+ @new_post.stub!(:category_name)
264
+ @new_post.stub!(:allow_comments).and_return(true)
265
+ @new_post.stub!(:answer_comments)
266
+ @new_post.stub!(:country)
267
+ @new_post.stub!(:country_subdivision)
268
+ @new_post.stub!(:country_code)
269
+ @new_post.stub!(:document).and_return(@mock_file)
270
+ @new_post.stub!(:column_for_attribute).with(:meta_description).and_return(mock('column', :type => :string, :limit => 255))
271
+ @new_post.stub!(:column_for_attribute).with(:title).and_return(mock('column', :type => :string, :limit => 50))
272
+ @new_post.stub!(:column_for_attribute).with(:body).and_return(mock('column', :type => :text))
273
+ @new_post.stub!(:column_for_attribute).with(:published).and_return(mock('column', :type => :boolean))
274
+ @new_post.stub!(:column_for_attribute).with(:publish_at).and_return(mock('column', :type => :date, :limit => 255))
275
+ @new_post.stub!(:column_for_attribute).with(:time_zone).and_return(mock('column', :type => :string))
276
+ @new_post.stub!(:column_for_attribute).with(:allow_comments).and_return(mock('column', :type => :boolean))
277
+ @new_post.stub!(:column_for_attribute).with(:author).and_return(mock('column', :type => :integer))
278
+ @new_post.stub!(:column_for_attribute).with(:country).and_return(mock('column', :type => :string, :limit => 255))
279
+ @new_post.stub!(:column_for_attribute).with(:country_subdivision).and_return(mock('column', :type => :string, :limit => 255))
280
+ @new_post.stub!(:column_for_attribute).with(:country_code).and_return(mock('column', :type => :string, :limit => 255))
281
+ @new_post.stub!(:column_for_attribute).with(:email).and_return(mock('column', :type => :string, :limit => 255))
282
+ @new_post.stub!(:column_for_attribute).with(:url).and_return(mock('column', :type => :string, :limit => 255))
283
+ @new_post.stub!(:column_for_attribute).with(:phone).and_return(mock('column', :type => :string, :limit => 255))
284
+ @new_post.stub!(:column_for_attribute).with(:search).and_return(mock('column', :type => :string, :limit => 255))
285
+ @new_post.stub!(:column_for_attribute).with(:document).and_return(nil)
286
+
287
+ @new_post.stub!(:author).and_return(@bob)
288
+ @new_post.stub!(:author_id).and_return(@bob.id)
289
+
290
+ @new_post.stub!(:reviewer).and_return(@fred)
291
+ @new_post.stub!(:reviewer_id).and_return(@fred.id)
292
+
293
+ @new_post.should_receive(:publish_at=).any_number_of_times
294
+ @new_post.should_receive(:title=).any_number_of_times
295
+ @new_post.stub!(:main_post_id).and_return(nil)
296
+
297
+ end
298
+
299
+ def self.included(base)
300
+ base.class_eval do
301
+
302
+ attr_accessor :output_buffer
303
+
304
+ def protect_against_forgery?
305
+ false
306
+ end
307
+
308
+ end
309
+ end
310
+
311
+ def with_config(config_method_name, value, &block)
312
+ old_value = ::Formtastic::SemanticFormBuilder.send(config_method_name)
313
+ ::Formtastic::SemanticFormBuilder.send(:"#{config_method_name}=", value)
314
+ yield
315
+ ::Formtastic::SemanticFormBuilder.send(:"#{config_method_name}=", old_value)
316
+ end
317
+
318
+ def with_deprecation_silenced(&block)
319
+ ::ActiveSupport::Deprecation.silenced = true
320
+ yield
321
+ ::ActiveSupport::Deprecation.silenced = false
322
+ end
323
+
324
+ end
325
+
326
+ ::ActiveSupport::Deprecation.silenced = false
327
+
@@ -0,0 +1,520 @@
1
+ # encoding: utf-8
2
+
3
+ module CustomMacros
4
+
5
+ def self.included(base)
6
+ base.extend(ClassMethods)
7
+ end
8
+
9
+ module ClassMethods
10
+
11
+ def it_should_have_input_wrapper_with_class(class_name)
12
+ it "should have input wrapper with class '#{class_name}'" do
13
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
14
+ output_buffer.should have_tag("form li.#{class_name}")
15
+ end
16
+ end
17
+
18
+ def it_should_have_input_wrapper_with_id(id_string)
19
+ it "should have input wrapper with id '#{id_string}'" do
20
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
21
+ output_buffer.should have_tag("form li##{id_string}")
22
+ end
23
+ end
24
+
25
+ def it_should_not_have_a_label
26
+ it "should not have a label" do
27
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
28
+ output_buffer.should_not have_tag("form li label")
29
+ end
30
+ end
31
+
32
+ def it_should_have_a_nested_fieldset
33
+ it "should have a nested_fieldset" do
34
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
35
+ output_buffer.should have_tag("form li fieldset")
36
+ end
37
+ end
38
+
39
+ def it_should_have_label_with_text(string_or_regex)
40
+ it "should have a label with text '#{string_or_regex}'" do
41
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
42
+ output_buffer.should have_tag("form li label", string_or_regex)
43
+ end
44
+ end
45
+
46
+ def it_should_have_label_for(element_id)
47
+ it "should have a label for ##{element_id}" do
48
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
49
+ output_buffer.should have_tag("form li label[@for='#{element_id}']")
50
+ end
51
+ end
52
+
53
+ def it_should_have_input_with_id(element_id)
54
+ it "should have an input with id '#{element_id}'" do
55
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
56
+ output_buffer.should have_tag("form li input##{element_id}")
57
+ end
58
+ end
59
+
60
+ def it_should_have_input_with_class(element_class)
61
+ it "should have an input with class '#{element_class}'" do
62
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
63
+ output_buffer.should have_tag("form li input.#{element_class}")
64
+ end
65
+ end
66
+
67
+ def it_should_have_select_with_id(element_id)
68
+ it "should have a select box with id '#{element_id}'" do
69
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
70
+ output_buffer.should have_tag("form li select##{element_id}")
71
+ end
72
+ end
73
+
74
+ def it_should_have_input_with_type(input_type)
75
+ it "should have a #{input_type} input" do
76
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
77
+ output_buffer.should have_tag("form li input[@type=\"#{input_type}\"]")
78
+ end
79
+ end
80
+
81
+ def it_should_have_input_with_name(name)
82
+ it "should have an input named #{name}" do
83
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
84
+ output_buffer.should have_tag("form li input[@name=\"#{name}\"]")
85
+ end
86
+ end
87
+
88
+ def it_should_have_textarea_with_name(name)
89
+ it "should have an input named #{name}" do
90
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
91
+ output_buffer.should have_tag("form li textarea[@name=\"#{name}\"]")
92
+ end
93
+ end
94
+
95
+ def it_should_have_textarea_with_id(element_id)
96
+ it "should have an input with id '#{element_id}'" do
97
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
98
+ output_buffer.should have_tag("form li textarea##{element_id}")
99
+ end
100
+ end
101
+
102
+ def it_should_have_label_and_input_with_id(element_id)
103
+ it "should have an input with id '#{element_id}'" do
104
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
105
+ output_buffer.should have_tag("form li input##{element_id}")
106
+ output_buffer.should have_tag("form li label[@for='#{element_id}']")
107
+ end
108
+ end
109
+
110
+ def it_should_use_default_text_field_size_when_not_nil(as)
111
+ it 'should use default_text_field_size when not nil' do
112
+ with_config :default_text_field_size, 30 do
113
+ form = semantic_form_for(@new_post) do |builder|
114
+ concat(builder.input(:title, :as => as))
115
+ end
116
+ output_buffer.concat(form) if Formtastic::Util.rails3?
117
+ output_buffer.should have_tag("form li input[@size='#{Formtastic::SemanticFormBuilder.default_text_field_size}']")
118
+ end
119
+ end
120
+ end
121
+
122
+ def it_should_not_use_default_text_field_size_when_nil(as)
123
+ it 'should not use default_text_field_size when nil' do
124
+ with_config :default_text_field_size, nil do
125
+ form = semantic_form_for(@new_post) do |builder|
126
+ concat(builder.input(:title, :as => as))
127
+ end
128
+ output_buffer.concat(form) if Formtastic::Util.rails3?
129
+ output_buffer.should have_tag("form li input")
130
+ output_buffer.should_not have_tag("form li input[@size]")
131
+ end
132
+ end
133
+ end
134
+
135
+ def it_should_apply_custom_input_attributes_when_input_html_provided(as)
136
+ it 'it should apply custom input attributes when input_html provided' do
137
+ form = semantic_form_for(@new_post) do |builder|
138
+ concat(builder.input(:title, :as => as, :input_html => { :class => 'myclass' }))
139
+ end
140
+ output_buffer.concat(form) if Formtastic::Util.rails3?
141
+ output_buffer.should have_tag("form li input.myclass")
142
+ end
143
+ end
144
+
145
+ def it_should_apply_custom_for_to_label_when_input_html_id_provided(as)
146
+ it 'it should apply custom for to label when input_html :id provided' do
147
+ form = semantic_form_for(@new_post) do |builder|
148
+ concat(builder.input(:title, :as => as, :input_html => { :id => 'myid' }))
149
+ end
150
+ output_buffer.concat(form) if Formtastic::Util.rails3?
151
+ output_buffer.should have_tag('form li label[@for="myid"]')
152
+ end
153
+ end
154
+
155
+ def it_should_have_maxlength_matching_column_limit
156
+ it 'should have a maxlength matching column limit' do
157
+ @new_post.column_for_attribute(:title).limit.should == 50
158
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
159
+ output_buffer.should have_tag("form li input[@maxlength='50']")
160
+ end
161
+ end
162
+
163
+ def it_should_use_column_size_for_columns_shorter_than_default_text_field_size(as)
164
+ it 'should use the column size for columns shorter than default_text_field_size' do
165
+ column_limit_shorted_than_default = 1
166
+ @new_post.stub!(:column_for_attribute).and_return(mock('column', :type => as, :limit => column_limit_shorted_than_default))
167
+
168
+ form = semantic_form_for(@new_post) do |builder|
169
+ concat(builder.input(:title, :as => as))
170
+ end
171
+
172
+ output_buffer.concat(form) if Formtastic::Util.rails3?
173
+ output_buffer.should have_tag("form li input[@size='#{column_limit_shorted_than_default}']")
174
+ end
175
+ end
176
+
177
+ def it_should_apply_error_logic_for_input_type(type)
178
+ describe 'when there are errors on the object for this method' do
179
+ before do
180
+ @title_errors = ['must not be blank', 'must be longer than 10 characters', 'must be awesome']
181
+ @errors = mock('errors')
182
+ @errors.stub!(:[]).with(:title).and_return(@title_errors)
183
+ ::Formtastic::SemanticFormBuilder.file_metadata_suffixes.each do |suffix|
184
+ @errors.stub!(:[]).with("title_#{suffix}".to_sym).and_return(nil)
185
+ end
186
+ @new_post.stub!(:errors).and_return(@errors)
187
+ end
188
+
189
+ it 'should apply an errors class to the list item' do
190
+ form = semantic_form_for(@new_post) do |builder|
191
+ concat(builder.input(:title, :as => type))
192
+ end
193
+ output_buffer.concat(form) if Formtastic::Util.rails3?
194
+ output_buffer.should have_tag('form li.error')
195
+ end
196
+
197
+ it 'should not wrap the input with the Rails default error wrapping' do
198
+ form = semantic_form_for(@new_post) do |builder|
199
+ concat(builder.input(:title, :as => type))
200
+ end
201
+ output_buffer.concat(form) if Formtastic::Util.rails3?
202
+ output_buffer.should_not have_tag('div.fieldWithErrors')
203
+ end
204
+
205
+ it 'should render a paragraph for the errors' do
206
+ ::Formtastic::SemanticFormBuilder.inline_errors = :sentence
207
+ form = semantic_form_for(@new_post) do |builder|
208
+ concat(builder.input(:title, :as => type))
209
+ end
210
+ output_buffer.concat(form) if Formtastic::Util.rails3?
211
+ output_buffer.should have_tag('form li.error p.inline-errors')
212
+ end
213
+
214
+ it 'should not display an error list' do
215
+ ::Formtastic::SemanticFormBuilder.inline_errors = :list
216
+ form = semantic_form_for(@new_post) do |builder|
217
+ concat(builder.input(:title, :as => type))
218
+ end
219
+ output_buffer.concat(form) if Formtastic::Util.rails3?
220
+ output_buffer.should have_tag('form li.error ul.errors')
221
+ end
222
+ end
223
+
224
+ describe 'when there are no errors on the object for this method' do
225
+ before do
226
+ @form = semantic_form_for(@new_post) do |builder|
227
+ concat(builder.input(:title, :as => type))
228
+ end
229
+ end
230
+
231
+ it 'should not apply an errors class to the list item' do
232
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
233
+ output_buffer.should_not have_tag('form li.error')
234
+ end
235
+
236
+ it 'should not render a paragraph for the errors' do
237
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
238
+ output_buffer.should_not have_tag('form li.error p.inline-errors')
239
+ end
240
+
241
+ it 'should not display an error list' do
242
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
243
+ output_buffer.should_not have_tag('form li.error ul.errors')
244
+ end
245
+ end
246
+
247
+ describe 'when no object is provided' do
248
+ before do
249
+ @form = semantic_form_for(:project, :url => 'http://test.host') do |builder|
250
+ concat(builder.input(:title, :as => type))
251
+ end
252
+ end
253
+
254
+ it 'should not apply an errors class to the list item' do
255
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
256
+ output_buffer.should_not have_tag('form li.error')
257
+ end
258
+
259
+ it 'should not render a paragraph for the errors' do
260
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
261
+ output_buffer.should_not have_tag('form li.error p.inline-errors')
262
+ end
263
+
264
+ it 'should not display an error list' do
265
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
266
+ output_buffer.should_not have_tag('form li.error ul.errors')
267
+ end
268
+ end
269
+ end
270
+
271
+ def it_should_call_find_on_association_class_when_no_collection_is_provided(as)
272
+ it "should call find on the association class when no collection is provided" do
273
+ ::Author.should_receive(:all)
274
+ form = semantic_form_for(@new_post) do |builder|
275
+ concat(builder.input(:author, :as => as))
276
+ end
277
+ end
278
+ end
279
+
280
+ def it_should_use_the_collection_when_provided(as, countable)
281
+ describe 'when the :collection option is provided' do
282
+
283
+ before do
284
+ @authors = ::Author.all * 2
285
+ output_buffer.replace '' # clears the output_buffer from the before block, hax!
286
+ end
287
+
288
+ it 'should use the provided collection' do
289
+ form = semantic_form_for(@new_post) do |builder|
290
+ concat(builder.input(:author, :as => as, :collection => @authors))
291
+ end
292
+ output_buffer.concat(form) if Formtastic::Util.rails3?
293
+ output_buffer.should have_tag("form li.#{as} #{countable}", :count => @authors.size + (as == :select ? 1 : 0))
294
+ end
295
+
296
+ describe 'and the :collection is an array of strings' do
297
+ before do
298
+ @categories = [ 'General', 'Design', 'Development', 'Quasi-Serious Inventions' ]
299
+ end
300
+
301
+ it "should use the string as the label text and value for each #{countable}" do
302
+ form = semantic_form_for(@new_post) do |builder|
303
+ concat(builder.input(:category_name, :as => as, :collection => @categories))
304
+ end
305
+ output_buffer.concat(form) if Formtastic::Util.rails3?
306
+
307
+ @categories.each do |value|
308
+ output_buffer.should have_tag("form li.#{as}", /#{value}/)
309
+ output_buffer.should have_tag("form li.#{as} #{countable}[@value='#{value}']")
310
+ end
311
+ end
312
+
313
+ if as == :radio
314
+ it 'should generate a sanitized label for attribute' do
315
+ @bob.stub!(:category_name).and_return(@categories)
316
+ form = semantic_form_for(@new_post) do |builder|
317
+ fields = builder.semantic_fields_for(@bob) do |bob_builder|
318
+ concat(bob_builder.input(:category_name, :as => as, :collection => @categories))
319
+ end
320
+ concat(fields)
321
+ end
322
+ output_buffer.concat(form) if Formtastic::Util.rails3?
323
+ output_buffer.should have_tag("form li fieldset ol li label[@for='post_author_category_name_general']")
324
+ output_buffer.should have_tag("form li fieldset ol li label[@for='post_author_category_name_design']")
325
+ output_buffer.should have_tag("form li fieldset ol li label[@for='post_author_category_name_development']")
326
+ output_buffer.should have_tag("form li fieldset ol li label[@for='post_author_category_name_quasiserious_inventions']")
327
+ end
328
+ end
329
+ end
330
+
331
+ describe 'and the :collection is a hash of strings' do
332
+ before do
333
+ @categories = { 'General' => 'gen', 'Design' => 'des','Development' => 'dev' }
334
+ end
335
+
336
+ it "should use the key as the label text and the hash value as the value attribute for each #{countable}" do
337
+ form = semantic_form_for(@new_post) do |builder|
338
+ concat(builder.input(:category_name, :as => as, :collection => @categories))
339
+ end
340
+ output_buffer.concat(form) if Formtastic::Util.rails3?
341
+
342
+ @categories.each do |label, value|
343
+ output_buffer.should have_tag("form li.#{as}", /#{label}/)
344
+ output_buffer.should have_tag("form li.#{as} #{countable}[@value='#{value}']")
345
+ end
346
+ end
347
+ end
348
+
349
+ describe 'and the :collection is an array of arrays' do
350
+ before do
351
+ @categories = { 'General' => 'gen', 'Design' => 'des', 'Development' => 'dev' }.to_a
352
+ end
353
+
354
+ it "should use the first value as the label text and the last value as the value attribute for #{countable}" do
355
+ form = semantic_form_for(@new_post) do |builder|
356
+ concat(builder.input(:category_name, :as => as, :collection => @categories))
357
+ end
358
+ output_buffer.concat(form) if Formtastic::Util.rails3?
359
+
360
+ @categories.each do |text, value|
361
+ label = as == :select ? :option : :label
362
+ output_buffer.should have_tag("form li.#{as} #{label}", /#{text}/i)
363
+ output_buffer.should have_tag("form li.#{as} #{countable}[@value='#{value.to_s}']")
364
+ output_buffer.should have_tag("form li.#{as} #{countable}#post_category_name_#{value.to_s}") if as == :radio
365
+ end
366
+ end
367
+ end
368
+
369
+ if as == :radio
370
+ describe 'and the :collection is an array of arrays with boolean values' do
371
+ before do
372
+ @choices = { 'Yeah' => true, 'Nah' => false }.to_a
373
+ end
374
+
375
+ it "should use the first value as the label text and the last value as the value attribute for #{countable}" do
376
+ form = semantic_form_for(@new_post) do |builder|
377
+ concat(builder.input(:category_name, :as => as, :collection => @choices))
378
+ end
379
+ output_buffer.concat(form) if Formtastic::Util.rails3?
380
+
381
+ output_buffer.should have_tag("form li.#{as} #{countable}#post_category_name_true")
382
+ output_buffer.should have_tag("form li.#{as} #{countable}#post_category_name_false")
383
+ end
384
+ end
385
+ end
386
+
387
+ describe 'and the :collection is an array of symbols' do
388
+ before do
389
+ @categories = [ :General, :Design, :Development ]
390
+ end
391
+
392
+ it "should use the symbol as the label text and value for each #{countable}" do
393
+ form = semantic_form_for(@new_post) do |builder|
394
+ concat(builder.input(:category_name, :as => as, :collection => @categories))
395
+ end
396
+ output_buffer.concat(form) if Formtastic::Util.rails3?
397
+
398
+ @categories.each do |value|
399
+ label = as == :select ? :option : :label
400
+ output_buffer.should have_tag("form li.#{as} #{label}", /#{value}/i)
401
+ output_buffer.should have_tag("form li.#{as} #{countable}[@value='#{value.to_s}']")
402
+ end
403
+ end
404
+ end
405
+
406
+ describe 'and the :collection is an OrderedHash of strings' do
407
+ before do
408
+ @categories = ActiveSupport::OrderedHash.new('General' => 'gen', 'Design' => 'des','Development' => 'dev')
409
+ end
410
+
411
+ it "should use the key as the label text and the hash value as the value attribute for each #{countable}" do
412
+ form = semantic_form_for(@new_post) do |builder|
413
+ concat(builder.input(:category_name, :as => as, :collection => @categories))
414
+ end
415
+ output_buffer.concat(form) if Formtastic::Util.rails3?
416
+
417
+ @categories.each do |label, value|
418
+ output_buffer.should have_tag("form li.#{as}", /#{label}/)
419
+ output_buffer.should have_tag("form li.#{as} #{countable}[@value='#{value}']")
420
+ end
421
+ end
422
+
423
+ end
424
+
425
+ describe 'when the :label_method option is provided' do
426
+
427
+ describe 'as a symbol' do
428
+ before do
429
+ @form = semantic_form_for(@new_post) do |builder|
430
+ concat(builder.input(:author, :as => as, :label_method => :login))
431
+ end
432
+ end
433
+
434
+ it 'should have options with text content from the specified method' do
435
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
436
+ ::Author.all.each do |author|
437
+ output_buffer.should have_tag("form li.#{as}", /#{author.login}/)
438
+ end
439
+ end
440
+ end
441
+
442
+ describe 'as a proc' do
443
+ before do
444
+ @form = semantic_form_for(@new_post) do |builder|
445
+ concat(builder.input(:author, :as => as, :label_method => Proc.new {|a| a.login.reverse }))
446
+ end
447
+ end
448
+
449
+ it 'should have options with the proc applied to each' do
450
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
451
+ ::Author.all.each do |author|
452
+ output_buffer.should have_tag("form li.#{as}", /#{author.login.reverse}/)
453
+ end
454
+ end
455
+ end
456
+
457
+ end
458
+
459
+ describe 'when the :label_method option is not provided' do
460
+ ::Formtastic::SemanticFormBuilder.collection_label_methods.each do |label_method|
461
+
462
+ describe "when the collection objects respond to #{label_method}" do
463
+ before do
464
+ @fred.stub!(:respond_to?).and_return { |m| m.to_s == label_method || m.to_s == 'id' }
465
+ ::Author.all.each { |a| a.stub!(label_method).and_return('The Label Text') }
466
+
467
+ @form = semantic_form_for(@new_post) do |builder|
468
+ concat(builder.input(:author, :as => as))
469
+ end
470
+ end
471
+
472
+ it "should render the options with #{label_method} as the label" do
473
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
474
+ ::Author.all.each do |author|
475
+ output_buffer.should have_tag("form li.#{as}", /The Label Text/)
476
+ end
477
+ end
478
+ end
479
+
480
+ end
481
+ end
482
+
483
+ describe 'when the :value_method option is provided' do
484
+
485
+ describe 'as a symbol' do
486
+ before do
487
+ @form = semantic_form_for(@new_post) do |builder|
488
+ concat(builder.input(:author, :as => as, :value_method => :login))
489
+ end
490
+ end
491
+
492
+ it 'should have options with values from specified method' do
493
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
494
+ ::Author.all.each do |author|
495
+ output_buffer.should have_tag("form li.#{as} #{countable}[@value='#{author.login}']")
496
+ end
497
+ end
498
+ end
499
+
500
+ describe 'as a proc' do
501
+ before do
502
+ @form = semantic_form_for(@new_post) do |builder|
503
+ concat(builder.input(:author, :as => as, :value_method => Proc.new {|a| a.login.reverse }))
504
+ end
505
+ end
506
+
507
+ it 'should have options with the proc applied to each value' do
508
+ output_buffer.concat(@form) if Formtastic::Util.rails3?
509
+ ::Author.all.each do |author|
510
+ output_buffer.should have_tag("form li.#{as} #{countable}[@value='#{author.login.reverse}']")
511
+ end
512
+ end
513
+ end
514
+ end
515
+
516
+ end
517
+ end
518
+
519
+ end
520
+ end
@@ -0,0 +1,6 @@
1
+ # encoding: utf-8
2
+
3
+ module ActionView
4
+ class OutputBuffer < Formtastic::Util.rails_safe_buffer_class
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,219 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: formtastic_datepicker_inputs
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Alan Harper
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-11-30 00:00:00 -08:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: bundler
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 23
30
+ segments:
31
+ - 1
32
+ - 0
33
+ - 0
34
+ version: 1.0.0
35
+ type: :development
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: activesupport
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 13
46
+ segments:
47
+ - 2
48
+ - 3
49
+ - 7
50
+ version: 2.3.7
51
+ type: :runtime
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ name: actionpack
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ hash: 13
62
+ segments:
63
+ - 2
64
+ - 3
65
+ - 7
66
+ version: 2.3.7
67
+ type: :runtime
68
+ version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
70
+ name: i18n
71
+ prerelease: false
72
+ requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ hash: 15
78
+ segments:
79
+ - 0
80
+ - 4
81
+ - 0
82
+ version: 0.4.0
83
+ type: :runtime
84
+ version_requirements: *id004
85
+ - !ruby/object:Gem::Dependency
86
+ name: rails
87
+ prerelease: false
88
+ requirement: &id005 !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ hash: 7
94
+ segments:
95
+ - 3
96
+ - 0
97
+ - 0
98
+ version: 3.0.0
99
+ type: :development
100
+ version_requirements: *id005
101
+ - !ruby/object:Gem::Dependency
102
+ name: rspec-rails
103
+ prerelease: false
104
+ requirement: &id006 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ hash: 15
110
+ segments:
111
+ - 2
112
+ - 0
113
+ - 0
114
+ version: 2.0.0
115
+ type: :development
116
+ version_requirements: *id006
117
+ - !ruby/object:Gem::Dependency
118
+ name: rspec_tag_matchers
119
+ prerelease: false
120
+ requirement: &id007 !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ hash: 23
126
+ segments:
127
+ - 1
128
+ - 0
129
+ - 0
130
+ version: 1.0.0
131
+ type: :development
132
+ version_requirements: *id007
133
+ - !ruby/object:Gem::Dependency
134
+ name: hpricot
135
+ prerelease: false
136
+ requirement: &id008 !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ hash: 57
142
+ segments:
143
+ - 0
144
+ - 8
145
+ - 3
146
+ version: 0.8.3
147
+ type: :development
148
+ version_requirements: *id008
149
+ - !ruby/object:Gem::Dependency
150
+ name: formtastic
151
+ prerelease: false
152
+ requirement: &id009 !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ hash: 3
158
+ segments:
159
+ - 0
160
+ version: "0"
161
+ type: :runtime
162
+ version_requirements: *id009
163
+ description: Use jQuery UI's date picker with formtastic easily
164
+ email: alan@appfission.com
165
+ executables: []
166
+
167
+ extensions: []
168
+
169
+ extra_rdoc_files:
170
+ - README
171
+ files:
172
+ - lib/formtastic_datepicker_inputs.rb
173
+ - MIT-LICENSE
174
+ - README
175
+ - Rakefile
176
+ - init.rb
177
+ - spec/support/output_buffer.rb
178
+ - spec/support/custom_macros.rb
179
+ - spec/spec_helper.rb
180
+ - spec/formtastic_datepicker_inputs_spec.rb
181
+ has_rdoc: true
182
+ homepage: http://github.com/aussiegeek/formtastic_datepicker_inputs
183
+ licenses:
184
+ - MIT
185
+ post_install_message:
186
+ rdoc_options: []
187
+
188
+ require_paths:
189
+ - lib
190
+ required_ruby_version: !ruby/object:Gem::Requirement
191
+ none: false
192
+ requirements:
193
+ - - ">="
194
+ - !ruby/object:Gem::Version
195
+ hash: 3
196
+ segments:
197
+ - 0
198
+ version: "0"
199
+ required_rubygems_version: !ruby/object:Gem::Requirement
200
+ none: false
201
+ requirements:
202
+ - - ">="
203
+ - !ruby/object:Gem::Version
204
+ hash: 3
205
+ segments:
206
+ - 0
207
+ version: "0"
208
+ requirements: []
209
+
210
+ rubyforge_project:
211
+ rubygems_version: 1.3.7
212
+ signing_key:
213
+ specification_version: 3
214
+ summary: Use jQuery UI's date picker with formtastic easily
215
+ test_files:
216
+ - spec/support/output_buffer.rb
217
+ - spec/support/custom_macros.rb
218
+ - spec/spec_helper.rb
219
+ - spec/formtastic_datepicker_inputs_spec.rb