Skip to content
This repository
Browse code

Merge branch 'master' into rails3

Conflicts:
	CHANGELOG
	spec/spec_helper.rb
  • Loading branch information...
commit 20a7fa443b9476b855f8e240ee5f0a4561e596ab 2 parents fa003bc + a406694
Morton Jonuschat yabawock authored
14 CHANGELOG
@@ -8,18 +8,18 @@
8 8 * Added compatible install and form helpers (rails3)
9 9 * Added support for ActiveModel Validations, thanks to Guillaume Belleguic (rails3)
10 10
11   -0.9.9 [unreleased]
  11 +0.9.10
  12 +
  13 +* Fixed i18n incompatibility with Rails 2.3.8 by reverting two i18n patches pulled in from the rails3 branch
  14 +
  15 +0.9.9
12 16
13   -* Changed I18n handling in spec tests to use I18n.backend.reload! instead of assigning nil
14 17 * Changed date/time inputs to default to nil instead of Time.now when the object has no value (due to deprecation warning, #240)
15 18 * Changed the behaviour of associations with a :class_name option to be more consistent with what Rails expects
16   -* Changed testsuite to use rails 2.3.7 as base
17   -* Fixed use of unsafe HTML strings in tests
  19 +* Fixed issues relating to Rails 2.3.6 automatically escaping ERB
18 20 * Fixed issues with Ruby 1.9.1 and Haml
19   -* Fixed inputs_for_nested_attributes only appending to the output buffer
20 21 * Fixed use of deprecated {{key}} syntax in i18n interpolation (thanks to Hans Petter Wilhelmsen)
21   -* Add the :disabled option to check_boxes input
22   -* Added helper to mark strings as HTML safe depending on environment, adapted from haml 2.2 solution
  22 +* Added the :disabled option to check_boxes input
23 23 * Added translation support for nested models (thanks to Toni Tuominen)
24 24
25 25 0.9.8
4 README.textile
Source Rendered
@@ -337,7 +337,7 @@ Formtastic supports localized *labels*, *hints*, *legends*, *actions* using the
337 337 title: "Choose a good title for you post."
338 338 body: "Write something inspiring here."
339 339 actions:
340   - create: "Create my %{model}"
  340 + create: "Create my {{model}}"
341 341 update: "Save changes"
342 342 dummie: "Launch!"
343 343 </pre>
@@ -354,7 +354,7 @@ Formtastic supports localized *labels*, *hints*, *legends*, *actions* using the
354 354 <%= form.input :section %> # => :label => I18n.t('activerecord.attributes.user.section') or 'Section'
355 355 <% end %>
356 356 <% form.buttons do %>
357   - <%= form.commit_button %> # => "Create my %{model}"
  357 + <%= form.commit_button %> # => "Create my {{model}}"
358 358 <% end %>
359 359 <% end %>
360 360 </pre>
2  VERSION.yml
@@ -2,4 +2,4 @@
2 2 :major: 0
3 3 :minor: 9
4 4 :build:
5   -:patch: 8
  5 +:patch: 10
5 formtastic.gemspec
@@ -5,11 +5,11 @@
5 5
6 6 Gem::Specification.new do |s|
7 7 s.name = %q{formtastic}
8   - s.version = "0.9.8"
  8 + s.version = "0.9.10"
9 9
10 10 s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11 11 s.authors = ["Justin French"]
12   - s.date = %q{2010-03-31}
  12 + s.date = %q{2010-05-26}
13 13 s.description = %q{A Rails form builder plugin/gem with semantically rich and accessible markup}
14 14 s.email = %q{justin@indent.com.au}
15 15 s.extra_rdoc_files = [
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
31 31 "lib/formtastic.rb",
32 32 "lib/formtastic/i18n.rb",
33 33 "lib/formtastic/layout_helper.rb",
  34 + "lib/formtastic/util.rb",
34 35 "lib/locale/en.yml",
35 36 "rails/init.rb",
36 37 "spec/buttons_spec.rb",
14 lib/formtastic.rb
@@ -1606,9 +1606,9 @@ def humanized_attribute_name(method) #:nodoc:
1606 1606 #
1607 1607 # Lookup priority:
1608 1608 #
1609   - # 'formtastic.%{type}.%{model}.%{action}.%{attribute}'
1610   - # 'formtastic.%{type}.%{model}.%{attribute}'
1611   - # 'formtastic.%{type}.%{attribute}'
  1609 + # 'formtastic.{{type}}.{{model}}.{{action}}.{{attribute}}'
  1610 + # 'formtastic.{{type}}.{{model}}.{{attribute}}'
  1611 + # 'formtastic.{{type}}.{{attribute}}'
1612 1612 #
1613 1613 # Example:
1614 1614 #
@@ -1633,10 +1633,10 @@ def localized_string(key, value, type, options = {}) #:nodoc:
1633 1633
1634 1634 defaults = ::Formtastic::I18n::SCOPES.collect do |i18n_scope|
1635 1635 i18n_path = i18n_scope.dup
1636   - i18n_path.gsub!('%{action}', action_name)
1637   - i18n_path.gsub!('%{model}', model_name)
1638   - i18n_path.gsub!('%{nested_model}', nested_model_name) unless nested_model_name.nil?
1639   - i18n_path.gsub!('%{attribute}', attribute_name)
  1636 + i18n_path.gsub!('{{action}}', action_name)
  1637 + i18n_path.gsub!('{{model}}', model_name)
  1638 + i18n_path.gsub!('{{nested_model}}', nested_model_name) unless nested_model_name.nil?
  1639 + i18n_path.gsub!('{{attribute}}', attribute_name)
1640 1640 i18n_path.gsub!('..', '.')
1641 1641 i18n_path.to_sym
1642 1642 end
16 lib/formtastic/i18n.rb
@@ -6,16 +6,16 @@ module I18n
6 6 :required => 'required',
7 7 :yes => 'Yes',
8 8 :no => 'No',
9   - :create => 'Create %{model}',
10   - :update => 'Update %{model}'
  9 + :create => 'Create {{model}}',
  10 + :update => 'Update {{model}}'
11 11 }.freeze
12 12 SCOPES = [
13   - '%{model}.%{nested_model}.%{action}.%{attribute}',
14   - '%{model}.%{action}.%{attribute}',
15   - '%{model}.%{nested_model}.%{attribute}',
16   - '%{model}.%{attribute}',
17   - '%{nested_model}.%{attribute}',
18   - '%{attribute}'
  13 + '{{model}}.{{nested_model}}.{{action}}.{{attribute}}',
  14 + '{{model}}.{{action}}.{{attribute}}',
  15 + '{{model}}.{{nested_model}}.{{attribute}}',
  16 + '{{model}}.{{attribute}}',
  17 + '{{nested_model}}.{{attribute}}',
  18 + '{{attribute}}'
19 19 ]
20 20
21 21 class << self
12 spec/commit_button_spec.rb
@@ -147,7 +147,7 @@
147 147 describe 'when no explicit label is provided' do
148 148 describe 'when no I18n-localized label is provided' do
149 149 before do
150   - ::I18n.backend.store_translations :en, :formtastic => {:submit => 'Submit %{model}'}
  150 + ::I18n.backend.store_translations :en, :formtastic => {:submit => 'Submit {{model}}'}
151 151 end
152 152
153 153 after do
@@ -183,7 +183,7 @@
183 183 :formtastic => {
184 184 :actions => {
185 185 :post => {
186   - :submit => 'Custom Submit %{model}'
  186 + :submit => 'Custom Submit {{model}}'
187 187 }
188 188 }
189 189 }
@@ -225,7 +225,7 @@
225 225 describe 'when no explicit label is provided' do
226 226 describe 'when no I18n-localized label is provided' do
227 227 before do
228   - ::I18n.backend.store_translations :en, :formtastic => {:create => 'Create %{model}'}
  228 + ::I18n.backend.store_translations :en, :formtastic => {:create => 'Create {{model}}'}
229 229 end
230 230
231 231 after do
@@ -261,7 +261,7 @@
261 261 :formtastic => {
262 262 :actions => {
263 263 :post => {
264   - :create => 'Custom Create %{model}'
  264 + :create => 'Custom Create {{model}}'
265 265 }
266 266 }
267 267 }
@@ -303,7 +303,7 @@
303 303 describe 'when no explicit label is provided' do
304 304 describe 'when no I18n-localized label is provided' do
305 305 before do
306   - ::I18n.backend.store_translations :en, :formtastic => {:update => 'Save %{model}'}
  306 + ::I18n.backend.store_translations :en, :formtastic => {:update => 'Save {{model}}'}
307 307 end
308 308
309 309 after do
@@ -340,7 +340,7 @@
340 340 :formtastic => {
341 341 :actions => {
342 342 :post => {
343   - :update => 'Custom Save %{model}'
  343 + :update => 'Custom Save {{model}}'
344 344 }
345 345 }
346 346 }
8 spec/i18n_spec.rb
@@ -26,11 +26,11 @@
26 26 @formtastic_strings = {
27 27 :yes => 'Default Yes',
28 28 :no => 'Default No',
29   - :create => 'Default Create %{model}',
30   - :update => 'Default Update %{model}',
  29 + :create => 'Default Create {{model}}',
  30 + :update => 'Default Update {{model}}',
31 31 :custom_scope => {
32 32 :duck => 'Duck',
33   - :duck_pond => '%{ducks} ducks in a pond'
  33 + :duck_pond => '{{ducks}} ducks in a pond'
34 34 }
35 35 }
36 36 ::I18n.backend.store_translations :en, :formtastic => @formtastic_strings
@@ -71,7 +71,7 @@
71 71
72 72 it "should use default strings" do
73 73 (::Formtastic::I18n::DEFAULT_VALUES.keys).each do |key|
74   - ::Formtastic::I18n.t(key, :model => '%{model}').should == ::Formtastic::I18n::DEFAULT_VALUES[key]
  74 + ::Formtastic::I18n.t(key, :model => '{{model}}').should == ::Formtastic::I18n::DEFAULT_VALUES[key]
75 75 end
76 76 end
77 77
4 spec/spec_helper.rb
... ... @@ -1,8 +1,8 @@
1 1 # coding: utf-8
2 2 require 'rubygems'
3 3
4   -gem 'activesupport', '>=2.3.7'
5   -gem 'actionpack', '>=2.3.7'
  4 +gem 'activesupport', '>=2.3.8'
  5 +gem 'actionpack', '>=2.3.8'
6 6 require 'active_support'
7 7 require 'action_pack'
8 8 require 'action_view'

0 comments on commit 20a7fa4

Please sign in to comment.
Something went wrong with that request. Please try again.