informant 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  Per-release changes to Informant.
4
4
 
5
+ == 0.7.1 (2010 Jun 1)
6
+
7
+ * Add compatibility with Rails 3 and rails_xss plugin.
8
+
5
9
  == 0.7.0 (2009 Oct 8)
6
10
 
7
- First release.
11
+ * First release.
data/README.rdoc CHANGED
@@ -1,21 +1,29 @@
1
1
  = Informant
2
2
 
3
- Informant is a full-featured form builder for Ruby on Rails which promotes a simple syntax that keeps your views clean. Everything about a field (label, description, error display, etc) is encapsulated in a single method call. Examples and general information are below; please read the {API documentation}[http://rdoc.info/projects/alexreisner/informant] for more complete/detailed information.
3
+ Informant is a full-featured form builder for Ruby on Rails (works with Rails 3) which promotes a simple syntax that keeps your views clean. Everything about a field (label, description, error display, etc) is encapsulated in a single method call. Examples and general information are below; please read the {API documentation}[http://rdoc.info/projects/alexreisner/informant] for more complete/detailed information.
4
4
 
5
5
 
6
6
  == 1. Install
7
7
 
8
+ === a. Rails 3
9
+
8
10
  Install either as a plugin:
9
11
 
10
- script/plugin install git://github.com/alexreisner/informant.git
12
+ rails plugin install git://github.com/alexreisner/informant.git
11
13
 
12
14
  or as a gem:
13
15
 
14
16
  # add to config/environment.rb:
15
- config.gem "informant", :source => "http://gemcutter.org/"
17
+ config.gem "informant"
16
18
 
17
19
  # at command prompt:
18
- sudo rake gems:install
20
+ bundle install
21
+
22
+ === b. Rails 2
23
+
24
+ As a plugin:
25
+
26
+ script/plugin install git://github.com/alexreisner/informant.git -r rails_2
19
27
 
20
28
 
21
29
  == 2. Configure
data/Rakefile CHANGED
@@ -10,7 +10,6 @@ begin
10
10
  gem.email = "alex@alexreisner.com"
11
11
  gem.homepage = "http://github.com/alexreisner/informant"
12
12
  gem.authors = ["Alex Reisner"]
13
- gem.add_development_dependency "thoughtbot-shoulda"
14
13
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
14
  end
16
15
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.0
1
+ 0.7.1
data/informant.gemspec CHANGED
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{informant}
8
- s.version = "0.7.0"
8
+ s.version = "0.7.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Alex Reisner"]
12
- s.date = %q{2009-10-08}
12
+ s.date = %q{2010-06-01}
13
13
  s.description = %q{Informant is a full-featured form builder for Ruby on Rails which promotes a simple syntax that keeps your views clean. Everything about a field (label, description, error display, etc) is encapsulated in a single method call.}
14
14
  s.email = %q{alex@alexreisner.com}
15
15
  s.extra_rdoc_files = [
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
32
32
  s.homepage = %q{http://github.com/alexreisner/informant}
33
33
  s.rdoc_options = ["--charset=UTF-8"]
34
34
  s.require_paths = ["lib"]
35
- s.rubygems_version = %q{1.3.5}
35
+ s.rubygems_version = %q{1.3.6}
36
36
  s.summary = %q{A full-featured form builder for Rails.}
37
37
  s.test_files = [
38
38
  "test/test_helper.rb",
@@ -44,11 +44,9 @@ Gem::Specification.new do |s|
44
44
  s.specification_version = 3
45
45
 
46
46
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
47
- s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
48
47
  else
49
- s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
50
48
  end
51
49
  else
52
- s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
53
50
  end
54
51
  end
52
+
data/lib/informant.rb CHANGED
@@ -113,11 +113,13 @@ module Informant
113
113
  build_shell(method, options, "habtm_check_boxes_field") do
114
114
  choices.map do |c|
115
115
  field_id = "#{base_id}_#{c[1].to_s.downcase}"
116
- "<div class=\"field\">" + @template.check_box_tag(
117
- "#{base_name}[]", "1",
118
- @object.send(method).include?(c[1]),
119
- :id => field_id
120
- ) + @template.label_tag(field_id, c[0]) + "</div>\n"
116
+ @template.content_tag(:div, :class => "field") do
117
+ @template.check_box_tag(
118
+ "#{base_name}[]", "1",
119
+ @object.send(method).include?(c[1]),
120
+ :id => field_id
121
+ ) + @template.label_tag(field_id, c[0])
122
+ end
121
123
  end
122
124
  end
123
125
  end
@@ -202,9 +204,9 @@ module Informant
202
204
  options.delete :label_for
203
205
  options.delete :required
204
206
 
205
- text = text.blank?? method.to_s.humanize : text.to_s
206
- text += ':' if colon
207
- text += ' <span class="required">*</span>' if required
207
+ text = @template.send(:h, text.blank?? method.to_s.humanize : text.to_s)
208
+ text << ':'.html_safe if colon
209
+ text << @template.content_tag(:span, "*", :class => "required") if required
208
210
  super
209
211
  end
210
212
 
@@ -213,11 +215,10 @@ module Informant
213
215
  # options hash, and a block in which fields are rendered.
214
216
  #
215
217
  def field_set(legend = nil, options = nil, &block)
216
- content = @template.capture(&block)
217
- @template.concat(@template.tag(:fieldset, options, true))
218
- @template.concat(@template.content_tag(:legend, legend)) unless legend.blank?
219
- @template.concat(content)
220
- @template.concat("</fieldset>")
218
+ @template.content_tag(:fieldset, options) do
219
+ (legend.blank?? "" : @template.content_tag(:legend, legend)) +
220
+ @template.capture(&block)
221
+ end
221
222
  end
222
223
 
223
224
 
@@ -242,12 +243,11 @@ module Informant
242
243
  :element => yield,
243
244
  :label => label(method, field_options[:label], label_options),
244
245
  :description => field_options[:description],
245
- :error => error_message_on(method, options),
246
246
  :div_id => "#{@object_name}_#{method}_field",
247
247
  :required => field_options[:required],
248
248
  :decoration => field_options[:decoration] || nil
249
249
  }
250
- send "#{template}_template", locals
250
+ send("#{template}_template", locals).html_safe
251
251
  end
252
252
 
253
253
  ##
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: informant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 7
8
+ - 1
9
+ version: 0.7.1
5
10
  platform: ruby
6
11
  authors:
7
12
  - Alex Reisner
@@ -9,19 +14,10 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2009-10-08 00:00:00 -04:00
17
+ date: 2010-06-01 00:00:00 -04:00
13
18
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: thoughtbot-shoulda
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "0"
24
- version:
19
+ dependencies: []
20
+
25
21
  description: Informant is a full-featured form builder for Ruby on Rails which promotes a simple syntax that keeps your views clean. Everything about a field (label, description, error display, etc) is encapsulated in a single method call.
26
22
  email: alex@alexreisner.com
27
23
  executables: []
@@ -56,18 +52,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
56
52
  requirements:
57
53
  - - ">="
58
54
  - !ruby/object:Gem::Version
55
+ segments:
56
+ - 0
59
57
  version: "0"
60
- version:
61
58
  required_rubygems_version: !ruby/object:Gem::Requirement
62
59
  requirements:
63
60
  - - ">="
64
61
  - !ruby/object:Gem::Version
62
+ segments:
63
+ - 0
65
64
  version: "0"
66
- version:
67
65
  requirements: []
68
66
 
69
67
  rubyforge_project:
70
- rubygems_version: 1.3.5
68
+ rubygems_version: 1.3.6
71
69
  signing_key:
72
70
  specification_version: 3
73
71
  summary: A full-featured form builder for Rails.