sequel-crushyform 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +1 -0
- data/lib/sequel_crushyform.rb +2 -2
- data/sequel-crushyform.gemspec +1 -1
- data/test/spec_crushyform.rb +10 -6
- metadata +4 -4
data/README.md
CHANGED
data/lib/sequel_crushyform.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module ::Sequel::Plugins::Crushyform
|
2
2
|
|
3
3
|
module ClassMethods
|
4
|
-
def crushyform_version; [0,0,
|
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
|
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)
|
data/sequel-crushyform.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'sequel-crushyform'
|
3
|
-
s.version = "0.0.
|
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."
|
data/test/spec_crushyform.rb
CHANGED
@@ -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(/<ScRipT >alert\('test'\);<\/ScRipT >/)
|
273
277
|
Haiku.new.crushyinput(:body, {:input_value=>"<ScRipT >alert('test');</ScRipT >"}).should.match(/<ScRipT >alert\('test'\);<\/ScRipT >/)
|
@@ -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=
|
321
|
-
TestDateTime.new.crushyinput(:meeting).should.match(/value=
|
322
|
-
TestDateTime.new.crushyinput(:meeting,{:input_value=>::Time.now}).should.match(/value=
|
323
|
-
TestDateTime.new.crushyinput(:when).should.match(/value=
|
324
|
-
TestDateTime.new.crushyinput(:when,{:input_value=>::Time.now}).should.match(/value=
|
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:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
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-
|
18
|
+
date: 2011-08-11 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|