sequel-crushyform 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -300,6 +300,7 @@ CHANGE LOG
300
300
  0.0.1 First version
301
301
  0.0.2 Use HTML5 attribute `required`
302
302
  0.0.3 Fix a bug on the default value for label :name
303
+ 0.0.4 Fix type `:none`
303
304
 
304
305
  COPYRIGHT
305
306
  =========
@@ -1,7 +1,7 @@
1
1
  module ::Sequel::Plugins::Crushyform
2
2
 
3
3
  module ClassMethods
4
- def crushyform_version; [0,0,3]; end
4
+ def crushyform_version; [0,0,4]; end
5
5
  # Schema
6
6
  def crushyform_schema
7
7
  @crushyform_schema ||= default_crushyform_schema
@@ -105,6 +105,7 @@ module ::Sequel::Plugins::Crushyform
105
105
  end
106
106
  # crushyfield is crushyinput but with label+error
107
107
  def crushyfield(col, o={})
108
+ return '' if (o[:type]==:none || model.crushyform_schema[col][:type]==:none)
108
109
  field_name = o[:name] || model.crushyform_schema[col][:name] || col.to_s.sub(/_id$/, '').tr('_', ' ').capitalize
109
110
  error_list = errors.on(col).map{|e|" - #{e}"} if !errors.on(col).nil?
110
111
  "<p class='crushyfield %s'><label for='%s'>%s</label><span class='crushyfield-error-list'>%s</span><br />\n%s</p>\n" % [error_list&&'crushyfield-error', crushyid_for(col), field_name, error_list, crushyinput(col, o)]
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'sequel-crushyform'
3
- s.version = "0.0.3"
3
+ s.version = "0.0.4"
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."
@@ -246,6 +246,8 @@ describe 'Crushyfield types' do
246
246
 
247
247
  should 'have a type that does nothing' do
248
248
  Attached.new.crushyinput(:filesize).should==''
249
+ Attached.new.crushyfield(:filesize).should==''
250
+ Attached.new.crushyfield(:title, {:type=>:none}).should==''
249
251
  end
250
252
 
251
253
  should 'escape html by default on text fields' 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: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
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-07-15 00:00:00 +01:00
18
+ date: 2011-07-19 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies: []
21
21