Permalink
Browse files

Merge branch 'master' into rails3

Conflicts:
	CHANGELOG
	spec/spec_helper.rb
  • Loading branch information...
2 parents fa003bc + a406694 commit 20a7fa443b9476b855f8e240ee5f0a4561e596ab @mjonuschat mjonuschat committed May 29, 2010
Showing with 40 additions and 39 deletions.
  1. +7 −7 CHANGELOG
  2. +2 −2 README.textile
  3. +1 −1 VERSION.yml
  4. +3 −2 formtastic.gemspec
  5. +7 −7 lib/formtastic.rb
  6. +8 −8 lib/formtastic/i18n.rb
  7. +6 −6 spec/commit_button_spec.rb
  8. +4 −4 spec/i18n_spec.rb
  9. +2 −2 spec/spec_helper.rb
View
@@ -8,18 +8,18 @@
* Added compatible install and form helpers (rails3)
* Added support for ActiveModel Validations, thanks to Guillaume Belleguic (rails3)
-0.9.9 [unreleased]
+0.9.10
+
+* Fixed i18n incompatibility with Rails 2.3.8 by reverting two i18n patches pulled in from the rails3 branch
+
+0.9.9
-* Changed I18n handling in spec tests to use I18n.backend.reload! instead of assigning nil
* Changed date/time inputs to default to nil instead of Time.now when the object has no value (due to deprecation warning, #240)
* Changed the behaviour of associations with a :class_name option to be more consistent with what Rails expects
-* Changed testsuite to use rails 2.3.7 as base
-* Fixed use of unsafe HTML strings in tests
+* Fixed issues relating to Rails 2.3.6 automatically escaping ERB
* Fixed issues with Ruby 1.9.1 and Haml
-* Fixed inputs_for_nested_attributes only appending to the output buffer
* Fixed use of deprecated {{key}} syntax in i18n interpolation (thanks to Hans Petter Wilhelmsen)
-* Add the :disabled option to check_boxes input
-* Added helper to mark strings as HTML safe depending on environment, adapted from haml 2.2 solution
+* Added the :disabled option to check_boxes input
* Added translation support for nested models (thanks to Toni Tuominen)
0.9.8
View
@@ -337,7 +337,7 @@ Formtastic supports localized *labels*, *hints*, *legends*, *actions* using the
title: "Choose a good title for you post."
body: "Write something inspiring here."
actions:
- create: "Create my %{model}"
+ create: "Create my {{model}}"
update: "Save changes"
dummie: "Launch!"
</pre>
@@ -354,7 +354,7 @@ Formtastic supports localized *labels*, *hints*, *legends*, *actions* using the
<%= form.input :section %> # => :label => I18n.t('activerecord.attributes.user.section') or 'Section'
<% end %>
<% form.buttons do %>
- <%= form.commit_button %> # => "Create my %{model}"
+ <%= form.commit_button %> # => "Create my {{model}}"
<% end %>
<% end %>
</pre>
View
@@ -2,4 +2,4 @@
:major: 0
:minor: 9
:build:
-:patch: 8
+:patch: 10
View
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = %q{formtastic}
- s.version = "0.9.8"
+ s.version = "0.9.10"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Justin French"]
- s.date = %q{2010-03-31}
+ s.date = %q{2010-05-26}
s.description = %q{A Rails form builder plugin/gem with semantically rich and accessible markup}
s.email = %q{justin@indent.com.au}
s.extra_rdoc_files = [
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
"lib/formtastic.rb",
"lib/formtastic/i18n.rb",
"lib/formtastic/layout_helper.rb",
+ "lib/formtastic/util.rb",
"lib/locale/en.yml",
"rails/init.rb",
"spec/buttons_spec.rb",
View
@@ -1606,9 +1606,9 @@ def humanized_attribute_name(method) #:nodoc:
#
# Lookup priority:
#
- # 'formtastic.%{type}.%{model}.%{action}.%{attribute}'
- # 'formtastic.%{type}.%{model}.%{attribute}'
- # 'formtastic.%{type}.%{attribute}'
+ # 'formtastic.{{type}}.{{model}}.{{action}}.{{attribute}}'
+ # 'formtastic.{{type}}.{{model}}.{{attribute}}'
+ # 'formtastic.{{type}}.{{attribute}}'
#
# Example:
#
@@ -1633,10 +1633,10 @@ def localized_string(key, value, type, options = {}) #:nodoc:
defaults = ::Formtastic::I18n::SCOPES.collect do |i18n_scope|
i18n_path = i18n_scope.dup
- i18n_path.gsub!('%{action}', action_name)
- i18n_path.gsub!('%{model}', model_name)
- i18n_path.gsub!('%{nested_model}', nested_model_name) unless nested_model_name.nil?
- i18n_path.gsub!('%{attribute}', attribute_name)
+ i18n_path.gsub!('{{action}}', action_name)
+ i18n_path.gsub!('{{model}}', model_name)
+ i18n_path.gsub!('{{nested_model}}', nested_model_name) unless nested_model_name.nil?
+ i18n_path.gsub!('{{attribute}}', attribute_name)
i18n_path.gsub!('..', '.')
i18n_path.to_sym
end
View
@@ -6,16 +6,16 @@ module I18n
:required => 'required',
:yes => 'Yes',
:no => 'No',
- :create => 'Create %{model}',
- :update => 'Update %{model}'
+ :create => 'Create {{model}}',
+ :update => 'Update {{model}}'
}.freeze
SCOPES = [
- '%{model}.%{nested_model}.%{action}.%{attribute}',
- '%{model}.%{action}.%{attribute}',
- '%{model}.%{nested_model}.%{attribute}',
- '%{model}.%{attribute}',
- '%{nested_model}.%{attribute}',
- '%{attribute}'
+ '{{model}}.{{nested_model}}.{{action}}.{{attribute}}',
+ '{{model}}.{{action}}.{{attribute}}',
+ '{{model}}.{{nested_model}}.{{attribute}}',
+ '{{model}}.{{attribute}}',
+ '{{nested_model}}.{{attribute}}',
+ '{{attribute}}'
]
class << self
View
@@ -147,7 +147,7 @@
describe 'when no explicit label is provided' do
describe 'when no I18n-localized label is provided' do
before do
- ::I18n.backend.store_translations :en, :formtastic => {:submit => 'Submit %{model}'}
+ ::I18n.backend.store_translations :en, :formtastic => {:submit => 'Submit {{model}}'}
end
after do
@@ -183,7 +183,7 @@
:formtastic => {
:actions => {
:post => {
- :submit => 'Custom Submit %{model}'
+ :submit => 'Custom Submit {{model}}'
}
}
}
@@ -225,7 +225,7 @@
describe 'when no explicit label is provided' do
describe 'when no I18n-localized label is provided' do
before do
- ::I18n.backend.store_translations :en, :formtastic => {:create => 'Create %{model}'}
+ ::I18n.backend.store_translations :en, :formtastic => {:create => 'Create {{model}}'}
end
after do
@@ -261,7 +261,7 @@
:formtastic => {
:actions => {
:post => {
- :create => 'Custom Create %{model}'
+ :create => 'Custom Create {{model}}'
}
}
}
@@ -303,7 +303,7 @@
describe 'when no explicit label is provided' do
describe 'when no I18n-localized label is provided' do
before do
- ::I18n.backend.store_translations :en, :formtastic => {:update => 'Save %{model}'}
+ ::I18n.backend.store_translations :en, :formtastic => {:update => 'Save {{model}}'}
end
after do
@@ -340,7 +340,7 @@
:formtastic => {
:actions => {
:post => {
- :update => 'Custom Save %{model}'
+ :update => 'Custom Save {{model}}'
}
}
}
View
@@ -26,11 +26,11 @@
@formtastic_strings = {
:yes => 'Default Yes',
:no => 'Default No',
- :create => 'Default Create %{model}',
- :update => 'Default Update %{model}',
+ :create => 'Default Create {{model}}',
+ :update => 'Default Update {{model}}',
:custom_scope => {
:duck => 'Duck',
- :duck_pond => '%{ducks} ducks in a pond'
+ :duck_pond => '{{ducks}} ducks in a pond'
}
}
::I18n.backend.store_translations :en, :formtastic => @formtastic_strings
@@ -71,7 +71,7 @@
it "should use default strings" do
(::Formtastic::I18n::DEFAULT_VALUES.keys).each do |key|
- ::Formtastic::I18n.t(key, :model => '%{model}').should == ::Formtastic::I18n::DEFAULT_VALUES[key]
+ ::Formtastic::I18n.t(key, :model => '{{model}}').should == ::Formtastic::I18n::DEFAULT_VALUES[key]
end
end
View
@@ -1,8 +1,8 @@
# coding: utf-8
require 'rubygems'
-gem 'activesupport', '>=2.3.7'
-gem 'actionpack', '>=2.3.7'
+gem 'activesupport', '>=2.3.8'
+gem 'actionpack', '>=2.3.8'
require 'active_support'
require 'action_pack'
require 'action_view'

0 comments on commit 20a7fa4

Please sign in to comment.