Skip to content

Commit

Permalink
Merge branch 'master' into rails3
Browse files Browse the repository at this point in the history
Conflicts:
	CHANGELOG
	spec/spec_helper.rb
  • Loading branch information
mjonuschat committed May 29, 2010
2 parents fa003bc + a406694 commit 20a7fa4
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 39 deletions.
14 changes: 7 additions & 7 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions README.textile
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion VERSION.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
:major: 0
:minor: 9
:build:
:patch: 8
:patch: 10
5 changes: 3 additions & 2 deletions formtastic.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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{[email protected]}
s.extra_rdoc_files = [
Expand All @@ -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",
Expand Down
14 changes: 7 additions & 7 deletions lib/formtastic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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:
#
Expand All @@ -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
Expand Down
16 changes: 8 additions & 8 deletions lib/formtastic/i18n.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions spec/commit_button_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -183,7 +183,7 @@
:formtastic => {
:actions => {
:post => {
:submit => 'Custom Submit %{model}'
:submit => 'Custom Submit {{model}}'
}
}
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -261,7 +261,7 @@
:formtastic => {
:actions => {
:post => {
:create => 'Custom Create %{model}'
:create => 'Custom Create {{model}}'
}
}
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -340,7 +340,7 @@
:formtastic => {
:actions => {
:post => {
:update => 'Custom Save %{model}'
:update => 'Custom Save {{model}}'
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions spec/i18n_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -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'
Expand Down

0 comments on commit 20a7fa4

Please sign in to comment.