mongo_translatable 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +26 -0
- data/.gitmodules +3 -0
- data/LICENSE +295 -0
- data/README.rdoc +131 -0
- data/Rakefile +55 -0
- data/VERSION +1 -0
- data/app/controllers/translations_controller.rb +150 -0
- data/app/helpers/translations_helper.rb +71 -0
- data/app/views/layouts/translations.html.erb +18 -0
- data/app/views/translations/_form.html.erb +50 -0
- data/app/views/translations/_translatable_value.html.erb +17 -0
- data/app/views/translations/_translation_field.html.erb +34 -0
- data/app/views/translations/_translation_field_input.html.erb +8 -0
- data/app/views/translations/edit.html.erb +8 -0
- data/app/views/translations/index.html.erb +22 -0
- data/app/views/translations/new.html.erb +7 -0
- data/app/views/translations/show.html.erb +12 -0
- data/config/locales/en.yml +33 -0
- data/config/locales/fr.yml +18 -0
- data/lib/mongo_translatable.rb +336 -0
- data/lib/mongo_translatable_configuration.rb +5 -0
- data/lib/translatables_helper.rb +227 -0
- data/lib/translations_controller_helpers.rb +37 -0
- data/rails/init.rb +3 -0
- data/test/full_2_3_5_app_with_tests/.gitignore +27 -0
- data/test/full_2_3_5_app_with_tests/README +1 -0
- data/test/full_2_3_5_app_with_tests/Rakefile +10 -0
- data/test/full_2_3_5_app_with_tests/app/controllers/application_controller.rb +26 -0
- data/test/full_2_3_5_app_with_tests/app/controllers/items_controller.rb +85 -0
- data/test/full_2_3_5_app_with_tests/app/helpers/application_helper.rb +3 -0
- data/test/full_2_3_5_app_with_tests/app/helpers/items_helper.rb +2 -0
- data/test/full_2_3_5_app_with_tests/app/models/comment.rb +3 -0
- data/test/full_2_3_5_app_with_tests/app/models/item.rb +5 -0
- data/test/full_2_3_5_app_with_tests/app/models/not_swapped_in_record.rb +3 -0
- data/test/full_2_3_5_app_with_tests/app/models/person.rb +3 -0
- data/test/full_2_3_5_app_with_tests/app/models/recipe.rb +21 -0
- data/test/full_2_3_5_app_with_tests/app/views/items/edit.html.erb +24 -0
- data/test/full_2_3_5_app_with_tests/app/views/items/index.html.erb +24 -0
- data/test/full_2_3_5_app_with_tests/app/views/items/new.html.erb +23 -0
- data/test/full_2_3_5_app_with_tests/app/views/items/show.html.erb +21 -0
- data/test/full_2_3_5_app_with_tests/app/views/layouts/items.html.erb +19 -0
- data/test/full_2_3_5_app_with_tests/config/boot.rb +110 -0
- data/test/full_2_3_5_app_with_tests/config/database.yml +22 -0
- data/test/full_2_3_5_app_with_tests/config/environment.rb +54 -0
- data/test/full_2_3_5_app_with_tests/config/environments/development.rb +17 -0
- data/test/full_2_3_5_app_with_tests/config/environments/production.rb +28 -0
- data/test/full_2_3_5_app_with_tests/config/environments/test.rb +28 -0
- data/test/full_2_3_5_app_with_tests/config/initializers/backtrace_silencers.rb +7 -0
- data/test/full_2_3_5_app_with_tests/config/initializers/inflections.rb +10 -0
- data/test/full_2_3_5_app_with_tests/config/initializers/mime_types.rb +5 -0
- data/test/full_2_3_5_app_with_tests/config/initializers/new_rails_defaults.rb +21 -0
- data/test/full_2_3_5_app_with_tests/config/initializers/session_store.rb +15 -0
- data/test/full_2_3_5_app_with_tests/config/locales.yml +5 -0
- data/test/full_2_3_5_app_with_tests/config/locales/en.yml +4 -0
- data/test/full_2_3_5_app_with_tests/config/locales/fr.yml +4 -0
- data/test/full_2_3_5_app_with_tests/config/locales/zh.yml +4 -0
- data/test/full_2_3_5_app_with_tests/config/routes.rb +4 -0
- data/test/full_2_3_5_app_with_tests/db/migrate/20100407010602_create_items.rb +14 -0
- data/test/full_2_3_5_app_with_tests/db/migrate/20100504234216_create_not_swapped_in_records.rb +15 -0
- data/test/full_2_3_5_app_with_tests/db/migrate/20100509011052_create_people.rb +13 -0
- data/test/full_2_3_5_app_with_tests/db/migrate/20100509042718_create_comments.rb +14 -0
- data/test/full_2_3_5_app_with_tests/db/migrate/20110112023516_create_recipes.rb +14 -0
- data/test/full_2_3_5_app_with_tests/db/schema.rb +56 -0
- data/test/full_2_3_5_app_with_tests/db/seeds.rb +7 -0
- data/test/full_2_3_5_app_with_tests/doc/README_FOR_APP +2 -0
- data/test/full_2_3_5_app_with_tests/public/404.html +30 -0
- data/test/full_2_3_5_app_with_tests/public/422.html +30 -0
- data/test/full_2_3_5_app_with_tests/public/500.html +30 -0
- data/test/full_2_3_5_app_with_tests/public/favicon.ico +0 -0
- data/test/full_2_3_5_app_with_tests/public/images/rails.png +0 -0
- data/test/full_2_3_5_app_with_tests/public/index.html +275 -0
- data/test/full_2_3_5_app_with_tests/public/javascripts/application.js +2 -0
- data/test/full_2_3_5_app_with_tests/public/javascripts/controls.js +963 -0
- data/test/full_2_3_5_app_with_tests/public/javascripts/dragdrop.js +973 -0
- data/test/full_2_3_5_app_with_tests/public/javascripts/effects.js +1128 -0
- data/test/full_2_3_5_app_with_tests/public/javascripts/prototype.js +4320 -0
- data/test/full_2_3_5_app_with_tests/public/robots.txt +5 -0
- data/test/full_2_3_5_app_with_tests/public/stylesheets/scaffold.css +54 -0
- data/test/full_2_3_5_app_with_tests/script/about +4 -0
- data/test/full_2_3_5_app_with_tests/script/console +3 -0
- data/test/full_2_3_5_app_with_tests/script/dbconsole +3 -0
- data/test/full_2_3_5_app_with_tests/script/destroy +3 -0
- data/test/full_2_3_5_app_with_tests/script/generate +3 -0
- data/test/full_2_3_5_app_with_tests/script/performance/benchmarker +3 -0
- data/test/full_2_3_5_app_with_tests/script/performance/profiler +3 -0
- data/test/full_2_3_5_app_with_tests/script/plugin +3 -0
- data/test/full_2_3_5_app_with_tests/script/runner +3 -0
- data/test/full_2_3_5_app_with_tests/script/server +3 -0
- data/test/full_2_3_5_app_with_tests/test/factories.rb +18 -0
- data/test/full_2_3_5_app_with_tests/test/functional/translations_controller_test.rb +66 -0
- data/test/full_2_3_5_app_with_tests/test/integration/translation_test.rb +72 -0
- data/test/full_2_3_5_app_with_tests/test/performance/browsing_test.rb +9 -0
- data/test/full_2_3_5_app_with_tests/test/selenium.rb +83 -0
- data/test/full_2_3_5_app_with_tests/test/test_helper.rb +86 -0
- data/test/full_2_3_5_app_with_tests/test/unit/helpers/translatables_helper_test.rb +37 -0
- data/test/full_2_3_5_app_with_tests/test/unit/helpers/translations_helper_test.rb +62 -0
- data/test/full_2_3_5_app_with_tests/test/unit/mongo_translatable_test.rb +342 -0
- data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/init.rb +1 -0
- data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/lib/routing_filter.rb +94 -0
- data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/lib/routing_filter/base.rb +31 -0
- data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/lib/routing_filter/force_extension.rb +57 -0
- data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/lib/routing_filter/locale.rb +70 -0
- data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/lib/routing_filter/pagination.rb +33 -0
- data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/lib/routing_filter/uuid_token.rb +78 -0
- data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/force_extension_spec.rb +65 -0
- data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/generation_spec.rb +367 -0
- data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/pagination_extension_spec.rb +19 -0
- data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/recognition_spec.rb +76 -0
- data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/routing_filter_spec.rb +114 -0
- data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/spec_helper.rb +108 -0
- metadata +309 -0
data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/pagination_extension_spec.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
|
3
|
+
describe 'RoutingFilter::Pagination' do
|
4
|
+
include RoutingFilterHelpers
|
5
|
+
|
6
|
+
before :each do
|
7
|
+
setup_environment(:pagination)
|
8
|
+
end
|
9
|
+
|
10
|
+
describe 'url generation' do
|
11
|
+
it 'appends the segments /pages/:page to the generated path' do
|
12
|
+
section_path(1, :page => 2).should == '/sections/1/pages/2'
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'appends the segments /pages/:page to the generated path excluding http get params' do
|
16
|
+
section_path(1, :page => 2, :foo => 'bar').should == '/sections/1/pages/2?foo=bar'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
|
3
|
+
describe 'RoutingFilter', 'url recognition' do
|
4
|
+
include RoutingFilterHelpers
|
5
|
+
|
6
|
+
before :each do
|
7
|
+
setup_environment :locale, :pagination
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'recognizes the path /de/sections/1 and sets the :locale param' do
|
11
|
+
should_recognize_path '/de/sections/1', @section_params.update(:locale => 'de')
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'recognizes the path /sections/1/pages/1 and sets the :page param' do
|
15
|
+
should_recognize_path '/sections/1/pages/1', @section_params.update(:page => 1)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'recognizes the path /de/sections/1/pages/1 and sets the :locale param' do
|
19
|
+
should_recognize_path '/de/sections/1/pages/1', @section_params.update(:locale => 'de', :page => 1)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'recognizes the path /sections/1/articles/1 and sets the :locale param' do
|
23
|
+
should_recognize_path '/sections/1/articles/1', @article_params
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'recognizes the path /de/sections/1/articles/1 and sets the :locale param' do
|
27
|
+
should_recognize_path '/de/sections/1/articles/1', @article_params.update(:locale => 'de')
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'recognizes the path /de/sections/1/articles/1/pages/1 and sets the :locale param' do
|
31
|
+
should_recognize_path '/de/sections/1/articles/1/pages/1', @article_params.update(:locale => 'de', :page => 1)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'recognizes the path /sections/1 and does not set a :locale param' do
|
35
|
+
should_recognize_path '/sections/1', @section_params
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'recognizes the path /sections/1 and does not set a :page param' do
|
39
|
+
should_recognize_path '/sections/1', @section_params
|
40
|
+
end
|
41
|
+
|
42
|
+
# Test that routing errors are thrown for invalid locales
|
43
|
+
it 'does not recognizes the path /aa/sections/1 and does not set a :locale param' do
|
44
|
+
begin
|
45
|
+
should_recognize_path '/aa/sections/1', @section_params.update(:locale => 'aa')
|
46
|
+
false
|
47
|
+
rescue ActionController::RoutingError
|
48
|
+
true
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'recognizes the path /en-US/sections/1 and sets a :locale param' do
|
53
|
+
should_recognize_path '/en-US/sections/1', @section_params.update(:locale => 'en-US')
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'recognizes the path /sections/1/articles/1 and does not set a :locale param' do
|
57
|
+
should_recognize_path '/sections/1/articles/1', @article_params
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'recognizes the path /sections/1/articles/1 and does not set a :page param' do
|
61
|
+
should_recognize_path '/sections/1/articles/1', @article_params
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'invalid locale: does not recognize the path /aa/sections/1/articles/1 and does not set a :locale param' do
|
65
|
+
lambda { @set.recognize_path('/aa/sections/1/articles/1', {}) }.should raise_error(ActionController::RoutingError)
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'recognizes the path /en-US/sections/1/articles/1 and sets a :locale param' do
|
69
|
+
should_recognize_path '/en-US/sections/1/articles/1', @article_params.update(:locale => 'en-US')
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'unescapes the path for the filters' do
|
73
|
+
@set.should_receive(:recognize_path_without_filtering).with('/sections/motörhead', 'test')
|
74
|
+
@set.recognize_path('/sections/mot%C3%B6rhead', 'test')
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
|
3
|
+
describe 'RoutingFilter' do
|
4
|
+
include RoutingFilterHelpers
|
5
|
+
|
6
|
+
before :each do
|
7
|
+
setup_environment :locale, :pagination
|
8
|
+
end
|
9
|
+
|
10
|
+
def recognize_path(path = '/de/sections/1', options = {})
|
11
|
+
@set.recognize_path(path, options)
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'installs filters to the route set' do
|
15
|
+
@locale_filter.should be_instance_of(RoutingFilter::Locale)
|
16
|
+
@pagination_filter.should be_instance_of(RoutingFilter::Pagination)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'calls the first filter for route recognition' do
|
20
|
+
@locale_filter.should_receive(:around_recognize).and_return :foo => :bar
|
21
|
+
recognize_path.should == { :foo => :bar }
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'calls the second filter for route recognition' do
|
25
|
+
@pagination_filter.should_receive(:around_recognize).and_return :foo => :bar
|
26
|
+
recognize_path.should == { :foo => :bar, :locale => 'de' }
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'calls the first filter for url generation' do
|
30
|
+
@locale_filter.should_receive(:around_generate).and_return '/en/sections/1?page=2'
|
31
|
+
url_for(:controller => 'sections', :action => 'show', :section_id => 1)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'calls the second filter for url generation' do
|
35
|
+
@pagination_filter.should_receive(:around_generate).and_return '/sections/1?page=2'
|
36
|
+
url_for(:controller => 'sections', :action => 'show', :section_id => 1)
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'calls the first filter for named route url_helper' do
|
40
|
+
@locale_filter.should_receive(:around_generate).and_return '/en/sections/1'
|
41
|
+
section_path(:section_id => 1)
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'calls the filter for named route url_helper with "optimized" generation blocks' do
|
45
|
+
# at_least(1) since the inline code comments in ActionController::Routing::RouteSet::NamedRouteCollection#define_url_helper also call us (as of http://github.com/rails/rails/commit/a2270ef2594b97891994848138614657363f2806)
|
46
|
+
@locale_filter.should_receive(:around_generate).at_least(1).and_return '/en/sections/1'
|
47
|
+
section_path(1)
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'calls the filter for named route polymorphic_path' do
|
51
|
+
# at_least(1) since the inline code comments in ActionController::Routing::RouteSet::NamedRouteCollection#define_url_helper also call us (as of http://github.com/rails/rails/commit/a2270ef2594b97891994848138614657363f2806)
|
52
|
+
@locale_filter.should_receive(:around_generate).at_least(1).and_return '/en/sections/1'
|
53
|
+
section_path(Section.new)
|
54
|
+
end
|
55
|
+
|
56
|
+
# When filters are set up in the order:
|
57
|
+
#
|
58
|
+
# map.filter :locale
|
59
|
+
# map.filter :pagination
|
60
|
+
#
|
61
|
+
# Then #around_recognize should be first called on the locale filter and then
|
62
|
+
# on the pagination filter. Whereas #around_generate should be first called
|
63
|
+
# on the pagination filter and then on the locale filter. Right?
|
64
|
+
|
65
|
+
it 'calls #around_recognize in the expected order' do
|
66
|
+
params = { :id => "1", :page => 2, :controller => "sections", :action => "show" }
|
67
|
+
@pagination_filter.stub!(:around_recognize).and_return({ :page => 2, :controller => "sections", :action => "show" })
|
68
|
+
|
69
|
+
recognize_path('/de/sections/1/pages/2')[:locale].should == "de"
|
70
|
+
recognize_path('/de/sections/1/pages/2')[:page].should == 2
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'calls #around_generate in the expected order' do
|
74
|
+
@locale_filter.stub!(:around_generate).and_return('de/sections/1')
|
75
|
+
section_path(1, :page => 2).should == "de/sections/1/pages/2"
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'does not call deactivated filters' do
|
79
|
+
with_deactivated_filters(RoutingFilter::Locale) do
|
80
|
+
@locale_filter.should_not_receive(:around_generate)
|
81
|
+
section_path(Section.new)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'still calls successors of deactivated filters' do
|
86
|
+
with_deactivated_filters(RoutingFilter::Locale) do
|
87
|
+
@pagination_filter.should_receive(:around_recognize).and_return :foo => :bar
|
88
|
+
recognize_path('/sections/1').should == { :foo => :bar }
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
# chain
|
93
|
+
|
94
|
+
it 'adds filters in the order they are registered' do
|
95
|
+
@set.filters[0].should == @locale_filter
|
96
|
+
@set.filters[1].should == @pagination_filter
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'returns the previous filter as a predecessor of a filter' do
|
100
|
+
@set.filters.predecessor(@pagination_filter).should == @locale_filter
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'returns the nil as a predecessor of the first filter' do
|
104
|
+
@set.filters.successor(@pagination_filter).should be_nil
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'returns the next filter as a successor of a filter' do
|
108
|
+
@set.filters.successor(@locale_filter).should == @pagination_filter
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'returns the nil as a successor of the last filter' do
|
112
|
+
@set.filters.successor(@pagination_filter).should be_nil
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
$: << File.dirname(__FILE__)
|
2
|
+
$: << File.dirname(__FILE__) + '/../lib/'
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'action_pack'
|
6
|
+
require 'active_support'
|
7
|
+
require 'action_controller'
|
8
|
+
require 'action_controller/test_process'
|
9
|
+
require 'active_support/vendor'
|
10
|
+
require 'spec'
|
11
|
+
|
12
|
+
require 'routing_filter'
|
13
|
+
require 'routing_filter/locale'
|
14
|
+
require 'routing_filter/pagination'
|
15
|
+
|
16
|
+
class Site
|
17
|
+
end
|
18
|
+
|
19
|
+
class Section
|
20
|
+
def id; 1 end
|
21
|
+
alias :to_param :id
|
22
|
+
def type; 'Section' end
|
23
|
+
def path; 'section' end
|
24
|
+
end
|
25
|
+
|
26
|
+
class Article
|
27
|
+
def to_param; 1 end
|
28
|
+
end
|
29
|
+
|
30
|
+
module RoutingFilterHelpers
|
31
|
+
def draw_routes(&block)
|
32
|
+
set = returning ActionController::Routing::RouteSet.new do |set|
|
33
|
+
class << set; def clear!; end; end
|
34
|
+
set.draw &block
|
35
|
+
silence_warnings{ ActionController::Routing.const_set 'Routes', set }
|
36
|
+
end
|
37
|
+
set
|
38
|
+
end
|
39
|
+
|
40
|
+
def instantiate_controller(params)
|
41
|
+
returning ActionController::Base.new do |controller|
|
42
|
+
request = ActionController::TestRequest.new
|
43
|
+
url = ActionController::UrlRewriter.new(request, params)
|
44
|
+
controller.stub!(:request).and_return request
|
45
|
+
controller.instance_variable_set :@url, url
|
46
|
+
controller
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def should_recognize_path(path, params)
|
51
|
+
@set.recognize_path(path, {}).should == params
|
52
|
+
end
|
53
|
+
|
54
|
+
def home_path(*args)
|
55
|
+
@controller.send :home_path, *args
|
56
|
+
end
|
57
|
+
|
58
|
+
def home_url(*args)
|
59
|
+
@controller.send :home_url, *args
|
60
|
+
end
|
61
|
+
|
62
|
+
def section_path(*args)
|
63
|
+
@controller.send :section_path, *args
|
64
|
+
end
|
65
|
+
|
66
|
+
def section_article_path(*args)
|
67
|
+
@controller.send :section_article_path, *args
|
68
|
+
end
|
69
|
+
|
70
|
+
def admin_articles_path(*args)
|
71
|
+
@controller.send :admin_articles_path, *args
|
72
|
+
end
|
73
|
+
|
74
|
+
def url_for(*args)
|
75
|
+
@controller.send :url_for, *args
|
76
|
+
end
|
77
|
+
|
78
|
+
def setup_environment(*filters)
|
79
|
+
RoutingFilter::Locale.locales = [:en, 'en-US', :de, :fi, 'en-UK']
|
80
|
+
RoutingFilter::Locale.include_default_locale = true
|
81
|
+
I18n.default_locale = :en
|
82
|
+
I18n.locale = :en
|
83
|
+
|
84
|
+
@controller = instantiate_controller :locale => 'de', :id => 1
|
85
|
+
@set = draw_routes do |map|
|
86
|
+
yield map if block_given?
|
87
|
+
filters.each { |filter| map.filter filter }
|
88
|
+
map.section 'sections/:id.:format', :controller => 'sections', :action => "show"
|
89
|
+
map.section_article 'sections/:section_id/articles/:id', :controller => 'articles', :action => "show"
|
90
|
+
map.admin_articles 'admin/articles/:id', :controller => 'admin/articles', :action => "index"
|
91
|
+
map.home '/', :controller => 'home', :action => 'index'
|
92
|
+
end
|
93
|
+
|
94
|
+
@section_params = {:controller => 'sections', :action => "show", :id => "1"}
|
95
|
+
@article_params = {:controller => 'articles', :action => "show", :section_id => "1", :id => "1"}
|
96
|
+
@locale_filter = @set.filters.first
|
97
|
+
@pagination_filter = @set.filters.last
|
98
|
+
end
|
99
|
+
|
100
|
+
def with_deactivated_filters(*filters, &block)
|
101
|
+
states = filters.inject({}) do |states, filter|
|
102
|
+
states[filter], filter.active = filter.active, false
|
103
|
+
states
|
104
|
+
end
|
105
|
+
yield
|
106
|
+
states.each { |filter, state| filter.active = state }
|
107
|
+
end
|
108
|
+
end
|
metadata
ADDED
@@ -0,0 +1,309 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mongo_translatable
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Walter McGinnis
|
14
|
+
- Kieran Pilkington
|
15
|
+
- Breccan McLeod-Lundy
|
16
|
+
autorequire:
|
17
|
+
bindir: bin
|
18
|
+
cert_chain: []
|
19
|
+
|
20
|
+
date: 2011-03-11 00:00:00 +13:00
|
21
|
+
default_executable:
|
22
|
+
dependencies:
|
23
|
+
- !ruby/object:Gem::Dependency
|
24
|
+
name: mongo_mapper
|
25
|
+
prerelease: false
|
26
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
hash: 5
|
32
|
+
segments:
|
33
|
+
- 0
|
34
|
+
- 7
|
35
|
+
- 3
|
36
|
+
version: 0.7.3
|
37
|
+
type: :runtime
|
38
|
+
version_requirements: *id001
|
39
|
+
- !ruby/object:Gem::Dependency
|
40
|
+
name: activerecord
|
41
|
+
prerelease: false
|
42
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - "="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
hash: 9
|
48
|
+
segments:
|
49
|
+
- 2
|
50
|
+
- 3
|
51
|
+
- 5
|
52
|
+
version: 2.3.5
|
53
|
+
type: :runtime
|
54
|
+
version_requirements: *id002
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: shoulda
|
57
|
+
prerelease: false
|
58
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
hash: 33
|
64
|
+
segments:
|
65
|
+
- 2
|
66
|
+
- 10
|
67
|
+
- 3
|
68
|
+
version: 2.10.3
|
69
|
+
type: :development
|
70
|
+
version_requirements: *id003
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: factory_girl
|
73
|
+
prerelease: false
|
74
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - "="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
hash: 25
|
80
|
+
segments:
|
81
|
+
- 1
|
82
|
+
- 2
|
83
|
+
- 3
|
84
|
+
version: 1.2.3
|
85
|
+
type: :development
|
86
|
+
version_requirements: *id004
|
87
|
+
- !ruby/object:Gem::Dependency
|
88
|
+
name: webrat
|
89
|
+
prerelease: false
|
90
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
hash: 13
|
96
|
+
segments:
|
97
|
+
- 0
|
98
|
+
- 5
|
99
|
+
- 3
|
100
|
+
version: 0.5.3
|
101
|
+
type: :development
|
102
|
+
version_requirements: *id005
|
103
|
+
description: Rails specific I18n model localization meant to tie-in to existing ActiveRecord models, ala Globalize2, backed by MongoDB rather than an RDBMS. May include UI elements, too.
|
104
|
+
email: walter@katipo.co.nz
|
105
|
+
executables: []
|
106
|
+
|
107
|
+
extensions: []
|
108
|
+
|
109
|
+
extra_rdoc_files:
|
110
|
+
- LICENSE
|
111
|
+
- README.rdoc
|
112
|
+
files:
|
113
|
+
- .document
|
114
|
+
- .gitignore
|
115
|
+
- .gitmodules
|
116
|
+
- LICENSE
|
117
|
+
- README.rdoc
|
118
|
+
- Rakefile
|
119
|
+
- VERSION
|
120
|
+
- app/controllers/translations_controller.rb
|
121
|
+
- app/helpers/translations_helper.rb
|
122
|
+
- app/views/layouts/translations.html.erb
|
123
|
+
- app/views/translations/_form.html.erb
|
124
|
+
- app/views/translations/_translatable_value.html.erb
|
125
|
+
- app/views/translations/_translation_field.html.erb
|
126
|
+
- app/views/translations/_translation_field_input.html.erb
|
127
|
+
- app/views/translations/edit.html.erb
|
128
|
+
- app/views/translations/index.html.erb
|
129
|
+
- app/views/translations/new.html.erb
|
130
|
+
- app/views/translations/show.html.erb
|
131
|
+
- config/locales/en.yml
|
132
|
+
- config/locales/fr.yml
|
133
|
+
- lib/mongo_translatable.rb
|
134
|
+
- lib/mongo_translatable_configuration.rb
|
135
|
+
- lib/translatables_helper.rb
|
136
|
+
- lib/translations_controller_helpers.rb
|
137
|
+
- rails/init.rb
|
138
|
+
- test/full_2_3_5_app_with_tests/.gitignore
|
139
|
+
- test/full_2_3_5_app_with_tests/README
|
140
|
+
- test/full_2_3_5_app_with_tests/Rakefile
|
141
|
+
- test/full_2_3_5_app_with_tests/app/controllers/application_controller.rb
|
142
|
+
- test/full_2_3_5_app_with_tests/app/controllers/items_controller.rb
|
143
|
+
- test/full_2_3_5_app_with_tests/app/helpers/application_helper.rb
|
144
|
+
- test/full_2_3_5_app_with_tests/app/helpers/items_helper.rb
|
145
|
+
- test/full_2_3_5_app_with_tests/app/models/comment.rb
|
146
|
+
- test/full_2_3_5_app_with_tests/app/models/item.rb
|
147
|
+
- test/full_2_3_5_app_with_tests/app/models/not_swapped_in_record.rb
|
148
|
+
- test/full_2_3_5_app_with_tests/app/models/person.rb
|
149
|
+
- test/full_2_3_5_app_with_tests/app/models/recipe.rb
|
150
|
+
- test/full_2_3_5_app_with_tests/app/views/items/edit.html.erb
|
151
|
+
- test/full_2_3_5_app_with_tests/app/views/items/index.html.erb
|
152
|
+
- test/full_2_3_5_app_with_tests/app/views/items/new.html.erb
|
153
|
+
- test/full_2_3_5_app_with_tests/app/views/items/show.html.erb
|
154
|
+
- test/full_2_3_5_app_with_tests/app/views/layouts/items.html.erb
|
155
|
+
- test/full_2_3_5_app_with_tests/config/boot.rb
|
156
|
+
- test/full_2_3_5_app_with_tests/config/database.yml
|
157
|
+
- test/full_2_3_5_app_with_tests/config/environment.rb
|
158
|
+
- test/full_2_3_5_app_with_tests/config/environments/development.rb
|
159
|
+
- test/full_2_3_5_app_with_tests/config/environments/production.rb
|
160
|
+
- test/full_2_3_5_app_with_tests/config/environments/test.rb
|
161
|
+
- test/full_2_3_5_app_with_tests/config/initializers/backtrace_silencers.rb
|
162
|
+
- test/full_2_3_5_app_with_tests/config/initializers/inflections.rb
|
163
|
+
- test/full_2_3_5_app_with_tests/config/initializers/mime_types.rb
|
164
|
+
- test/full_2_3_5_app_with_tests/config/initializers/new_rails_defaults.rb
|
165
|
+
- test/full_2_3_5_app_with_tests/config/initializers/session_store.rb
|
166
|
+
- test/full_2_3_5_app_with_tests/config/locales.yml
|
167
|
+
- test/full_2_3_5_app_with_tests/config/locales/en.yml
|
168
|
+
- test/full_2_3_5_app_with_tests/config/locales/fr.yml
|
169
|
+
- test/full_2_3_5_app_with_tests/config/locales/zh.yml
|
170
|
+
- test/full_2_3_5_app_with_tests/config/routes.rb
|
171
|
+
- test/full_2_3_5_app_with_tests/db/migrate/20100407010602_create_items.rb
|
172
|
+
- test/full_2_3_5_app_with_tests/db/migrate/20100504234216_create_not_swapped_in_records.rb
|
173
|
+
- test/full_2_3_5_app_with_tests/db/migrate/20100509011052_create_people.rb
|
174
|
+
- test/full_2_3_5_app_with_tests/db/migrate/20100509042718_create_comments.rb
|
175
|
+
- test/full_2_3_5_app_with_tests/db/migrate/20110112023516_create_recipes.rb
|
176
|
+
- test/full_2_3_5_app_with_tests/db/schema.rb
|
177
|
+
- test/full_2_3_5_app_with_tests/db/seeds.rb
|
178
|
+
- test/full_2_3_5_app_with_tests/doc/README_FOR_APP
|
179
|
+
- test/full_2_3_5_app_with_tests/log/production.log
|
180
|
+
- test/full_2_3_5_app_with_tests/log/server.log
|
181
|
+
- test/full_2_3_5_app_with_tests/public/404.html
|
182
|
+
- test/full_2_3_5_app_with_tests/public/422.html
|
183
|
+
- test/full_2_3_5_app_with_tests/public/500.html
|
184
|
+
- test/full_2_3_5_app_with_tests/public/favicon.ico
|
185
|
+
- test/full_2_3_5_app_with_tests/public/images/rails.png
|
186
|
+
- test/full_2_3_5_app_with_tests/public/index.html
|
187
|
+
- test/full_2_3_5_app_with_tests/public/javascripts/application.js
|
188
|
+
- test/full_2_3_5_app_with_tests/public/javascripts/controls.js
|
189
|
+
- test/full_2_3_5_app_with_tests/public/javascripts/dragdrop.js
|
190
|
+
- test/full_2_3_5_app_with_tests/public/javascripts/effects.js
|
191
|
+
- test/full_2_3_5_app_with_tests/public/javascripts/prototype.js
|
192
|
+
- test/full_2_3_5_app_with_tests/public/robots.txt
|
193
|
+
- test/full_2_3_5_app_with_tests/public/stylesheets/scaffold.css
|
194
|
+
- test/full_2_3_5_app_with_tests/script/about
|
195
|
+
- test/full_2_3_5_app_with_tests/script/console
|
196
|
+
- test/full_2_3_5_app_with_tests/script/dbconsole
|
197
|
+
- test/full_2_3_5_app_with_tests/script/destroy
|
198
|
+
- test/full_2_3_5_app_with_tests/script/generate
|
199
|
+
- test/full_2_3_5_app_with_tests/script/performance/benchmarker
|
200
|
+
- test/full_2_3_5_app_with_tests/script/performance/profiler
|
201
|
+
- test/full_2_3_5_app_with_tests/script/plugin
|
202
|
+
- test/full_2_3_5_app_with_tests/script/runner
|
203
|
+
- test/full_2_3_5_app_with_tests/script/server
|
204
|
+
- test/full_2_3_5_app_with_tests/test/factories.rb
|
205
|
+
- test/full_2_3_5_app_with_tests/test/functional/translations_controller_test.rb
|
206
|
+
- test/full_2_3_5_app_with_tests/test/integration/translation_test.rb
|
207
|
+
- test/full_2_3_5_app_with_tests/test/performance/browsing_test.rb
|
208
|
+
- test/full_2_3_5_app_with_tests/test/selenium.rb
|
209
|
+
- test/full_2_3_5_app_with_tests/test/test_helper.rb
|
210
|
+
- test/full_2_3_5_app_with_tests/test/unit/helpers/translatables_helper_test.rb
|
211
|
+
- test/full_2_3_5_app_with_tests/test/unit/helpers/translations_helper_test.rb
|
212
|
+
- test/full_2_3_5_app_with_tests/test/unit/mongo_translatable_test.rb
|
213
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/init.rb
|
214
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/lib/routing_filter/base.rb
|
215
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/lib/routing_filter/force_extension.rb
|
216
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/lib/routing_filter/locale.rb
|
217
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/lib/routing_filter/pagination.rb
|
218
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/lib/routing_filter/uuid_token.rb
|
219
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/lib/routing_filter.rb
|
220
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/force_extension_spec.rb
|
221
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/generation_spec.rb
|
222
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/pagination_extension_spec.rb
|
223
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/recognition_spec.rb
|
224
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/routing_filter_spec.rb
|
225
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/spec_helper.rb
|
226
|
+
has_rdoc: true
|
227
|
+
homepage: http://github.com/kete/mongo_translatable
|
228
|
+
licenses: []
|
229
|
+
|
230
|
+
post_install_message:
|
231
|
+
rdoc_options:
|
232
|
+
- --charset=UTF-8
|
233
|
+
require_paths:
|
234
|
+
- lib
|
235
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
236
|
+
none: false
|
237
|
+
requirements:
|
238
|
+
- - ">="
|
239
|
+
- !ruby/object:Gem::Version
|
240
|
+
hash: 3
|
241
|
+
segments:
|
242
|
+
- 0
|
243
|
+
version: "0"
|
244
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
245
|
+
none: false
|
246
|
+
requirements:
|
247
|
+
- - ">="
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
hash: 3
|
250
|
+
segments:
|
251
|
+
- 0
|
252
|
+
version: "0"
|
253
|
+
requirements: []
|
254
|
+
|
255
|
+
rubyforge_project:
|
256
|
+
rubygems_version: 1.3.7
|
257
|
+
signing_key:
|
258
|
+
specification_version: 3
|
259
|
+
summary: MongoDB backed Rails specific I18n model localization meant to tie-in to existing ActiveRecord models
|
260
|
+
test_files:
|
261
|
+
- test/full_2_3_5_app_with_tests/app/controllers/application_controller.rb
|
262
|
+
- test/full_2_3_5_app_with_tests/app/controllers/items_controller.rb
|
263
|
+
- test/full_2_3_5_app_with_tests/app/helpers/application_helper.rb
|
264
|
+
- test/full_2_3_5_app_with_tests/app/helpers/items_helper.rb
|
265
|
+
- test/full_2_3_5_app_with_tests/app/models/comment.rb
|
266
|
+
- test/full_2_3_5_app_with_tests/app/models/item.rb
|
267
|
+
- test/full_2_3_5_app_with_tests/app/models/not_swapped_in_record.rb
|
268
|
+
- test/full_2_3_5_app_with_tests/app/models/person.rb
|
269
|
+
- test/full_2_3_5_app_with_tests/app/models/recipe.rb
|
270
|
+
- test/full_2_3_5_app_with_tests/config/boot.rb
|
271
|
+
- test/full_2_3_5_app_with_tests/config/environment.rb
|
272
|
+
- test/full_2_3_5_app_with_tests/config/environments/development.rb
|
273
|
+
- test/full_2_3_5_app_with_tests/config/environments/production.rb
|
274
|
+
- test/full_2_3_5_app_with_tests/config/environments/test.rb
|
275
|
+
- test/full_2_3_5_app_with_tests/config/initializers/backtrace_silencers.rb
|
276
|
+
- test/full_2_3_5_app_with_tests/config/initializers/inflections.rb
|
277
|
+
- test/full_2_3_5_app_with_tests/config/initializers/mime_types.rb
|
278
|
+
- test/full_2_3_5_app_with_tests/config/initializers/new_rails_defaults.rb
|
279
|
+
- test/full_2_3_5_app_with_tests/config/initializers/session_store.rb
|
280
|
+
- test/full_2_3_5_app_with_tests/config/routes.rb
|
281
|
+
- test/full_2_3_5_app_with_tests/db/migrate/20100407010602_create_items.rb
|
282
|
+
- test/full_2_3_5_app_with_tests/db/migrate/20100504234216_create_not_swapped_in_records.rb
|
283
|
+
- test/full_2_3_5_app_with_tests/db/migrate/20100509011052_create_people.rb
|
284
|
+
- test/full_2_3_5_app_with_tests/db/migrate/20100509042718_create_comments.rb
|
285
|
+
- test/full_2_3_5_app_with_tests/db/migrate/20110112023516_create_recipes.rb
|
286
|
+
- test/full_2_3_5_app_with_tests/db/schema.rb
|
287
|
+
- test/full_2_3_5_app_with_tests/db/seeds.rb
|
288
|
+
- test/full_2_3_5_app_with_tests/test/factories.rb
|
289
|
+
- test/full_2_3_5_app_with_tests/test/functional/translations_controller_test.rb
|
290
|
+
- test/full_2_3_5_app_with_tests/test/integration/translation_test.rb
|
291
|
+
- test/full_2_3_5_app_with_tests/test/performance/browsing_test.rb
|
292
|
+
- test/full_2_3_5_app_with_tests/test/selenium.rb
|
293
|
+
- test/full_2_3_5_app_with_tests/test/test_helper.rb
|
294
|
+
- test/full_2_3_5_app_with_tests/test/unit/helpers/translatables_helper_test.rb
|
295
|
+
- test/full_2_3_5_app_with_tests/test/unit/helpers/translations_helper_test.rb
|
296
|
+
- test/full_2_3_5_app_with_tests/test/unit/mongo_translatable_test.rb
|
297
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/init.rb
|
298
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/lib/routing_filter/base.rb
|
299
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/lib/routing_filter/force_extension.rb
|
300
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/lib/routing_filter/locale.rb
|
301
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/lib/routing_filter/pagination.rb
|
302
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/lib/routing_filter/uuid_token.rb
|
303
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/lib/routing_filter.rb
|
304
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/force_extension_spec.rb
|
305
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/generation_spec.rb
|
306
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/pagination_extension_spec.rb
|
307
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/recognition_spec.rb
|
308
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/routing_filter_spec.rb
|
309
|
+
- test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/spec_helper.rb
|