sequel-crushyform 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -304,6 +304,7 @@ CHANGE LOG
304
304
  0.0.5 Crushyform method guesses the enctype
305
305
  0.0.6 Human name for classes and label for new records
306
306
  0.0.7 Fix `Model#to_label`
307
+ 0.0.8 Fix bug with apostrophe in text fields
307
308
 
308
309
  COPYRIGHT
309
310
  =========
@@ -1,7 +1,7 @@
1
1
  module ::Sequel::Plugins::Crushyform
2
2
 
3
3
  module ClassMethods
4
- def crushyform_version; [0,0,7]; end
4
+ def crushyform_version; [0,0,8]; end
5
5
  # Schema
6
6
  def crushyform_schema
7
7
  @crushyform_schema ||= default_crushyform_schema
@@ -24,7 +24,7 @@ module ::Sequel::Plugins::Crushyform
24
24
  @crushyform_types ||= {
25
25
  :none => proc{''},
26
26
  :string => proc do |m,c,o|
27
- "<input type='%s' name='%s' value='%s' id='%s' class='%s' %s />%s\n" % [o[:input_type]||'text', o[:input_name], o[:input_value], m.crushyid_for(c), o[:input_class], o[:required]&&'required', o[:required]]
27
+ "<input type='%s' name='%s' value=\"%s\" id='%s' class='%s' %s />%s\n" % [o[:input_type]||'text', o[:input_name], o[:input_value], m.crushyid_for(c), o[:input_class], o[:required]&&'required', o[:required]]
28
28
  end,
29
29
  :boolean => proc do |m,c,o|
30
30
  crushid = m.crushyid_for(c)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'sequel-crushyform'
3
- s.version = "0.0.7"
3
+ s.version = "0.0.8"
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."
@@ -268,6 +268,10 @@ describe 'Crushyfield types' do
268
268
  Attached.new.crushyfield(:title, {:type=>:none}).should==''
269
269
  end
270
270
 
271
+ should 'wrap textfileds with double quotes in order to allow apostrophes' do
272
+ Haiku.new.crushyinput(:title, {:input_value=>"It's my life"}).should.match(/value="It's my life"/)
273
+ end
274
+
271
275
  should 'escape html by default on text fields' do
272
276
  Haiku.new.crushyinput(:title, {:input_value=>"<ScRipT >alert('test');</ScRipT >"}).should.match(/&lt;ScRipT &gt;alert\('test'\);&lt;\/ScRipT &gt;/)
273
277
  Haiku.new.crushyinput(:body, {:input_value=>"<ScRipT >alert('test');</ScRipT >"}).should.match(/&lt;ScRipT &gt;alert\('test'\);&lt;\/ScRipT &gt;/)
@@ -316,12 +320,12 @@ describe 'Crushyfield types' do
316
320
 
317
321
  should 'format date/time/datetime correctly' do
318
322
  TestDateTime.new.db_schema[:meeting][:type].should== :time # Check that the correct type is used for following tests (see README)
319
- TestDateTime.new.crushyinput(:birth).should.match(/value=''/)
320
- TestDateTime.new.crushyinput(:birth,{:input_value=>::Time.now}).should.match(/value='\d{4}-\d{1,2}-\d{1,2}'/)
321
- TestDateTime.new.crushyinput(:meeting).should.match(/value=''/)
322
- TestDateTime.new.crushyinput(:meeting,{:input_value=>::Time.now}).should.match(/value='\d{1,2}:\d{1,2}:\d{1,2}'/)
323
- TestDateTime.new.crushyinput(:when).should.match(/value=''/)
324
- 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}'/)
323
+ TestDateTime.new.crushyinput(:birth).should.match(/value=""/)
324
+ TestDateTime.new.crushyinput(:birth,{:input_value=>::Time.now}).should.match(/value="\d{4}-\d{1,2}-\d{1,2}"/)
325
+ TestDateTime.new.crushyinput(:meeting).should.match(/value=""/)
326
+ TestDateTime.new.crushyinput(:meeting,{:input_value=>::Time.now}).should.match(/value="\d{1,2}:\d{1,2}:\d{1,2}"/)
327
+ TestDateTime.new.crushyinput(:when).should.match(/value=""/)
328
+ 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}"/)
325
329
  end
326
330
 
327
331
  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: 17
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 7
10
- version: 0.0.7
9
+ - 8
10
+ version: 0.0.8
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-04 00:00:00 +01:00
18
+ date: 2011-08-11 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies: []
21
21