sequel-crushyform 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -358,6 +358,7 @@ CHANGE LOG
358
358
  0.0.7 Fix `Model#to_label`
359
359
  0.0.8 Fix bug with apostrophe in text fields
360
360
  0.1.0 Add `:select` type and make `:parent` type overridable through `set_schema`
361
+ 0.1.1 Use strftime fordate/time (do not know why I did not !!!)
361
362
 
362
363
  COPYRIGHT
363
364
  =========
@@ -1,7 +1,7 @@
1
1
  module ::Sequel::Plugins::Crushyform
2
2
 
3
3
  module ClassMethods
4
- def crushyform_version; [0,1,0]; end
4
+ def crushyform_version; [0,1,1]; end
5
5
  # Schema
6
6
  def crushyform_schema
7
7
  @crushyform_schema ||= default_crushyform_schema
@@ -40,17 +40,17 @@ module ::Sequel::Plugins::Crushyform
40
40
  "<textarea name='%s' id='%s' class='%s' %s>%s</textarea>%s\n" % [o[:input_name], m.crushyid_for(c), o[:input_class], o[:required]&&'required', o[:input_value], o[:required]]
41
41
  end,
42
42
  :date => proc do |m,c,o|
43
- o[:input_value] = "%s-%s-%s" % [o[:input_value].year, o[:input_value].month, o[:input_value].day] if o[:input_value].is_a?(Sequel.datetime_class)
43
+ o[:input_value] = o[:input_value].strftime("%Y-%m-%d") if o[:input_value].is_a?(Sequel.datetime_class)
44
44
  o[:required] = "%s Format: yyyy-mm-dd" % [o[:required]]
45
45
  crushyform_types[:string].call(m,c,o)
46
46
  end,
47
47
  :time => proc do |m,c,o|
48
- o[:input_value] = "%s:%s:%s" % [o[:input_value].hour, o[:input_value].min, o[:input_value].sec] if o[:input_value].is_a?(Sequel.datetime_class)
48
+ o[:input_value] = o[:input_value].strftime("%T") if o[:input_value].is_a?(Sequel.datetime_class)
49
49
  o[:required] = "%s Format: hh:mm:ss" % [o[:required]]
50
50
  crushyform_types[:string].call(m,c,o)
51
51
  end,
52
52
  :datetime => proc do |m,c,o|
53
- o[:input_value] = "%s-%s-%s %s:%s:%s" % [o[:input_value].year, o[:input_value].month, o[:input_value].day, o[:input_value].hour, o[:input_value].min, o[:input_value].sec] if o[:input_value].is_a?(Sequel.datetime_class)
53
+ o[:input_value] = o[:input_value].strftime("%Y-%m-%d %T") if o[:input_value].is_a?(Sequel.datetime_class)
54
54
  o[:required] = "%s Format: yyyy-mm-dd hh:mm:ss" % [o[:required]]
55
55
  crushyform_types[:string].call(m,c,o)
56
56
  end,
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'sequel-crushyform'
3
- s.version = "0.1.0"
3
+ s.version = "0.1.1"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.summary = "A Sequel plugin that helps building forms"
6
6
  s.description = "A Sequel plugin that helps building forms. It basically does them for you so that you can forget about the boring part. The kind of thing which is good to have in your toolbox for building a CMS."
@@ -349,11 +349,11 @@ describe 'Crushyfield types' do
349
349
  should 'format date/time/datetime correctly' do
350
350
  TestDateTime.new.db_schema[:meeting][:type].should== :time # Check that the correct type is used for following tests (see README)
351
351
  TestDateTime.new.crushyinput(:birth).should.match(/value=""/)
352
- TestDateTime.new.crushyinput(:birth,{:input_value=>::Time.now}).should.match(/value="\d{4}-\d{1,2}-\d{1,2}"/)
352
+ TestDateTime.new.crushyinput(:birth,{:input_value=>::Time.now}).should.match(/value="\d{4}-\d{2}-\d{2}"/)
353
353
  TestDateTime.new.crushyinput(:meeting).should.match(/value=""/)
354
- TestDateTime.new.crushyinput(:meeting,{:input_value=>::Time.now}).should.match(/value="\d{1,2}:\d{1,2}:\d{1,2}"/)
354
+ TestDateTime.new.crushyinput(:meeting,{:input_value=>::Time.now}).should.match(/value="\d{2}:\d{2}:\d{2}"/)
355
355
  TestDateTime.new.crushyinput(:when).should.match(/value=""/)
356
- TestDateTime.new.crushyinput(:when,{:input_value=>::Time.now}).should.match(/value="\d{4}-\d{1,2}-\d{1,2} \d{1,2}:\d{1,2}:\d{1,2}"/)
356
+ TestDateTime.new.crushyinput(:when,{:input_value=>::Time.now}).should.match(/value="\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}"/)
357
357
  end
358
358
 
359
359
  should 'add format instructions for date/time/datetime after :required bit' do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel-crushyform
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mickael Riga
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-22 00:00:00 +01:00
18
+ date: 2011-08-23 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies: []
21
21