dynamic_form 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/VERSION +1 -1
- data/dynamic_form.gemspec +2 -2
- data/init.rb +1 -1
- data/lib/action_view/helpers/dynamic_form.rb +1 -1
- data/lib/action_view/locale/en.yml +8 -7
- data/test/dynamic_form_i18n_test.rb +6 -6
- metadata +4 -4
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.4
|
data/dynamic_form.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{dynamic_form}
|
8
|
-
s.version = "1.1.
|
8
|
+
s.version = "1.1.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Joel Moss"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-04-08}
|
13
13
|
s.description = %q{DynamicForm holds a few helper methods to help you deal with your Rails3 models. It includes the stripped out methods from Rails 2; error_message_on and error_messages_for. It also brings in the functionality of the custom-err-messages plugin, which provides more flexibility over your model error messages.}
|
14
14
|
s.email = %q{joel@developwithstyle.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/init.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require 'dynamic_form'
|
1
|
+
require 'dynamic_form'
|
@@ -212,7 +212,7 @@ module ActionView
|
|
212
212
|
end
|
213
213
|
options[:object_name] ||= params.first
|
214
214
|
|
215
|
-
I18n.with_options :locale => options[:locale], :scope => [:errors, :template] do |locale|
|
215
|
+
I18n.with_options :locale => options[:locale], :scope => [:activerecord, :errors, :template] do |locale|
|
216
216
|
header_message = if options.include?(:header_message)
|
217
217
|
options[:header_message]
|
218
218
|
else
|
@@ -1,8 +1,9 @@
|
|
1
1
|
en:
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
2
|
+
activerecord:
|
3
|
+
errors:
|
4
|
+
template:
|
5
|
+
header:
|
6
|
+
one: "1 error prohibited this %{model} from being saved"
|
7
|
+
other: "%{count} errors prohibited this %{model} from being saved"
|
8
|
+
# The variable :count is also available
|
9
|
+
body: "There were problems with the following fields:"
|
@@ -16,27 +16,27 @@ class DynamicFormI18nTest < Test::Unit::TestCase
|
|
16
16
|
|
17
17
|
stubs(:content_tag).returns 'content_tag'
|
18
18
|
|
19
|
-
I18n.stubs(:t).with(:'header', :locale => 'en', :scope => [:errors, :template], :count => 1, :model => '').returns "1 error prohibited this from being saved"
|
20
|
-
I18n.stubs(:t).with(:'body', :locale => 'en', :scope => [:errors, :template]).returns 'There were problems with the following fields:'
|
19
|
+
I18n.stubs(:t).with(:'header', :locale => 'en', :scope => [:activerecord, :errors, :template], :count => 1, :model => '').returns "1 error prohibited this from being saved"
|
20
|
+
I18n.stubs(:t).with(:'body', :locale => 'en', :scope => [:activerecord, :errors, :template]).returns 'There were problems with the following fields:'
|
21
21
|
end
|
22
22
|
|
23
23
|
def test_error_messages_for_given_a_header_option_it_does_not_translate_header_message
|
24
|
-
I18n.expects(:t).with(:'header', :locale => 'en', :scope => [:errors, :template], :count => 1, :model => '').never
|
24
|
+
I18n.expects(:t).with(:'header', :locale => 'en', :scope => [:activerecord, :errors, :template], :count => 1, :model => '').never
|
25
25
|
error_messages_for(:object => @object, :header_message => 'header message', :locale => 'en')
|
26
26
|
end
|
27
27
|
|
28
28
|
def test_error_messages_for_given_no_header_option_it_translates_header_message
|
29
|
-
I18n.expects(:t).with(:'header', :locale => 'en', :scope => [:errors, :template], :count => 1, :model => '').returns 'header message'
|
29
|
+
I18n.expects(:t).with(:'header', :locale => 'en', :scope => [:activerecord, :errors, :template], :count => 1, :model => '').returns 'header message'
|
30
30
|
error_messages_for(:object => @object, :locale => 'en')
|
31
31
|
end
|
32
32
|
|
33
33
|
def test_error_messages_for_given_a_message_option_it_does_not_translate_message
|
34
|
-
I18n.expects(:t).with(:'body', :locale => 'en', :scope => [:errors, :template]).never
|
34
|
+
I18n.expects(:t).with(:'body', :locale => 'en', :scope => [:activerecord, :errors, :template]).never
|
35
35
|
error_messages_for(:object => @object, :message => 'message', :locale => 'en')
|
36
36
|
end
|
37
37
|
|
38
38
|
def test_error_messages_for_given_no_message_option_it_translates_message
|
39
|
-
I18n.expects(:t).with(:'body', :locale => 'en', :scope => [:errors, :template]).returns 'There were problems with the following fields:'
|
39
|
+
I18n.expects(:t).with(:'body', :locale => 'en', :scope => [:activerecord, :errors, :template]).returns 'There were problems with the following fields:'
|
40
40
|
error_messages_for(:object => @object, :locale => 'en')
|
41
41
|
end
|
42
42
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynamic_form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 4
|
10
|
+
version: 1.1.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Joel Moss
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-04-08 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|