localizable_routes 2.1.0 → 4.0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a671fd3ab32ff2e3e0baef6b610fea00cd60d20f
4
- data.tar.gz: 5606c6396b2f247857c71db72ff6f4b19ca4c2b9
3
+ metadata.gz: 71dac5f3df15c57c0894749b5aa7df9930d737c3
4
+ data.tar.gz: faa001c810b1a2b58803472e17a21d336f56268c
5
5
  SHA512:
6
- metadata.gz: a8af9bf615323a27e1f5d36a20bb4e624dca7f59e90d25a0b19c3692d7a39e593fdf15942cfd07362414dea174e16035e0f5ab247b2919b2d877d5019f8aefa8
7
- data.tar.gz: fa3be04b1f2491fbad0eeb8917a6e1807d72afb9db0bafb6bd44b6a73394c37429480ebe1aa7b9298af814d3b6eb16bb38d222578f982ad48782305630108756
6
+ metadata.gz: cc2937cefbb30c8557440bd610295643e37f0f1453cf40182546fb2b559c8cf9d19ee6caa79d76e570463b667dbf73afe93db1d58f1ec7edb322125e67328755
7
+ data.tar.gz: 0fa84da78c46aab6da6242eba5cb0d87ef837da2269837709904000cb35000b00e709788f6eafeccd41a542b44aa10ac685946d7b96dee1cc08485350846a276
data/README.md CHANGED
@@ -7,6 +7,14 @@
7
7
 
8
8
  Minimalistic toolkit to localize routes in rails.
9
9
 
10
+ ## Why
11
+
12
+ I did this gem to:
13
+
14
+ - Being able to use different configurations on each set of routes.
15
+ - Having most common strategies available out of the box.
16
+ - Prevent bugs using not invasive code.
17
+
10
18
  ## Install
11
19
 
12
20
  Put this line in your Gemfile:
@@ -19,7 +27,9 @@ Then bundle:
19
27
  $ bundle
20
28
  ```
21
29
 
22
- ## Configuration
30
+ ## Usage
31
+
32
+ ### Definitions
23
33
 
24
34
  In your config/routes.rb use the localized method to decide wich routes will be localized:
25
35
  ```ruby
@@ -36,6 +46,8 @@ localized strategy: :domain, locales: { 'domain.uy' => :es, 'domain.us' => :en }
36
46
  end
37
47
  ```
38
48
 
49
+ ### Localization
50
+
39
51
  Put your localizations inside the routes key in your locales yamls:
40
52
  ```yaml
41
53
  es:
@@ -45,9 +57,9 @@ es:
45
57
 
46
58
  NOTE: There is no need to put the full path, just localize each part individually.
47
59
 
48
- ## Usage
60
+ ### Urls
49
61
 
50
- Helpers will continue working the same:
62
+ Url helpers will continue working the same:
51
63
  ```ruby
52
64
  param_path # Will output /en/pagina in case I18n.locale is :es for param strategy
53
65
 
data/Rakefile CHANGED
@@ -4,24 +4,8 @@ rescue LoadError
4
4
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
5
  end
6
6
 
7
- require 'rdoc/task'
8
-
9
- RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'LocalizableRoutes'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.rdoc')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
15
- end
16
-
17
-
18
-
19
-
20
7
  Bundler::GemHelper.install_tasks
21
8
 
22
- APP_RAKEFILE = File.expand_path('../test/dummy/Rakefile', __FILE__)
23
- load 'rails/tasks/engine.rake'
24
-
25
9
  require 'rake/testtask'
26
10
 
27
11
  Rake::TestTask.new(:test) do |t|
@@ -29,7 +13,7 @@ Rake::TestTask.new(:test) do |t|
29
13
  t.libs << 'test'
30
14
  t.pattern = 'test/**/*_test.rb'
31
15
  t.verbose = false
16
+ t.warning = false
32
17
  end
33
18
 
34
-
35
19
  task default: :test
@@ -1,6 +1,7 @@
1
1
  require 'localizable_routes/extensions/action_dispatch/named_route_collection'
2
2
  require 'localizable_routes/extensions/action_dispatch/mapper'
3
3
  require 'localizable_routes/railtie'
4
+ require 'localizable_routes/version'
4
5
 
5
6
  module LocalizableRoutes
6
7
  end
@@ -1,7 +1,7 @@
1
1
  module LocalizableRoutes
2
2
  class Railtie < Rails::Railtie
3
3
 
4
- initializer 'localizable_routes' do
4
+ initializer 'localizable_routes.extensions' do
5
5
  ::ActionDispatch::Routing::RouteSet::NamedRouteCollection.include(
6
6
  LocalizableRoutes::Extensions::ActionDispatch::NamedRouteCollection
7
7
  )
@@ -1,5 +1,5 @@
1
1
  module LocalizableRoutes
2
2
 
3
- VERSION = '2.1.0'
3
+ VERSION = '4.0.0.0'
4
4
 
5
5
  end
@@ -0,0 +1,6 @@
1
+ class NestedController < ApplicationController
2
+
3
+ def index
4
+ end
5
+
6
+ end
@@ -1,14 +1,12 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
- <head>
4
- <title>Dummy</title>
5
- <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
- <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+ <%= yield %>
11
+ </body>
14
12
  </html>
@@ -1,3 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
+
2
3
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
4
  load Gem.bin_path('bundler', 'bundle')
data/test/dummy/bin/rails CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+
2
3
  APP_PATH = File.expand_path('../../config/application', __FILE__)
3
4
  require_relative '../config/boot'
4
5
  require 'rails/commands'
data/test/dummy/bin/rake CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+
2
3
  require_relative '../config/boot'
3
4
  require 'rake'
4
5
  Rake.application.run
data/test/dummy/bin/setup CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+
2
3
  require 'pathname'
3
4
 
4
5
  # path to your application root.
@@ -0,0 +1,7 @@
1
+ development:
2
+ adapter: postgresql
3
+ database: gem_development
4
+
5
+ test:
6
+ adapter: postgresql
7
+ database: gem_test
@@ -0,0 +1,3 @@
1
+ test:
2
+ adapter: <%= 'jdbc' if RUBY_ENGINE == 'jruby' %>postgresql
3
+ database: travis
@@ -1,4 +1,4 @@
1
- Dummy::Application.configure do
1
+ Rails.application.configure do
2
2
  # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
4
  # In the development environment your application's code is reloaded on
@@ -1,4 +1,4 @@
1
- Dummy::Application.configure do
1
+ Rails.application.configure do
2
2
  # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
4
  # Code is not reloaded between requests.
@@ -1,4 +1,4 @@
1
- Dummy::Application.configure do
1
+ Rails.application.configure do
2
2
  # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
4
  # The test environment is used exclusively to run your application's
@@ -17,7 +17,7 @@ Dummy::Application.configure do
17
17
  config.static_cache_control = 'public, max-age=3600'
18
18
 
19
19
  # Show full error reports and disable caching.
20
- config.consider_all_requests_local = true
20
+ config.consider_all_requests_local = true
21
21
  config.action_controller.perform_caching = false
22
22
 
23
23
  # Raise exceptions instead of rendering exception templates.
@@ -7,3 +7,8 @@
7
7
  ActiveSupport.on_load(:action_controller) do
8
8
  wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
9
  end
10
+
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end
@@ -4,7 +4,6 @@ en:
4
4
  edit: "edit"
5
5
  namespace: "namespace"
6
6
  nested: "nested"
7
- nesteds: "nesteds"
8
7
  simple: "simple"
9
8
  resource: "resource"
10
9
  resources: "resources"
@@ -4,7 +4,6 @@ es:
4
4
  edit: "editar"
5
5
  namespace: "nombre-de-espacio"
6
6
  nested: "anidado"
7
- nesteds: "anidados"
8
7
  simple: "simple"
9
8
  resource: "recurso"
10
9
  resources: "recursos"
@@ -2,12 +2,12 @@ Rails.application.routes.draw do
2
2
 
3
3
  concern :routes do
4
4
  root to: 'pages#index'
5
+ get 'simple', to: 'pages#simple', as: :simple
6
+ get 'complex/:p1/:p2', to: 'pages#complex', as: :complex
5
7
  namespace :namespace do
6
8
  get 'nested', to: 'pages#nested', as: :nested
7
9
  resources :resources
8
10
  end
9
- get 'simple', to: 'pages#simple', as: :simple
10
- get 'complex/:p1/:p2', to: 'pages#complex', as: :complex
11
11
  resources :resources do
12
12
  member do
13
13
  get 'member'
@@ -15,7 +15,7 @@ Rails.application.routes.draw do
15
15
  collection do
16
16
  get 'collection'
17
17
  end
18
- resources :nesteds
18
+ resources :nested
19
19
  end
20
20
  end
21
21
 
@@ -11,10 +11,10 @@
11
11
  # if you're sharing your code publicly.
12
12
 
13
13
  development:
14
- secret_key_base: 921ea9f25943669d3a4b0a6c8762cb6a97a00c42732c84b3a4c80900d4f2be79081cad03e0ec8d5d0f2f293874b2bbd04c1444e7a6d6b9147de8f4ffb3acff11
14
+ secret_key_base: 2c1c8d4cbaa726b21aa6483b7d556125f4897508e2b94f8b3ddaec675168382c9b3b6eb5a9359d2fade03f539c16ac1ef905891c2410f2fd00b83b76c1666feb
15
15
 
16
16
  test:
17
- secret_key_base: 0e085a62fbfd58069441e0eb7dd8c3d0a7035017443181a5fba2c04041a03f8d0d427216ac56a51da79125898d125bb9fb8badb48404919fe3188eb309231570
17
+ secret_key_base: 9dd531171128e7c3d11dd2c5c18c84ba43d29b677043002634a6f4d58bf2687a283b7b6dc6af741d63c3824f11fa1f858010d7c2509a932023f2ece0d3bfe6cf
18
18
 
19
19
  # Do not keep production secrets in the repository,
20
20
  # instead read values from the environment.
@@ -1,241 +1,4 @@
1
1
  -------------------------
2
- HelpersTest: test_helpers
3
- -------------------------
4
- -----------------------
5
- RoutesTest: test_routes
6
- -----------------------
7
- -----------------------
8
- RoutesTest: test_routes
9
- -----------------------
10
- -------------------------
11
- HelpersTest: test_helpers
12
- -------------------------
13
- -------------------------
14
- HelpersTest: test_helpers
15
- -------------------------
16
- -----------------------
17
- RoutesTest: test_routes
18
- -----------------------
19
- -------------------------
20
- HelpersTest: test_helpers
21
- -------------------------
22
- -----------------------
23
- RoutesTest: test_routes
24
- -----------------------
25
- -------------------------
26
- HelpersTest: test_helpers
27
- -------------------------
28
- -----------------------
29
- RoutesTest: test_routes
30
- -----------------------
31
- -------------------------
32
- HelpersTest: test_helpers
33
- -------------------------
34
- -----------------------
35
- RoutesTest: test_routes
36
- -----------------------
37
- -------------------------
38
- HelpersTest: test_helpers
39
- -------------------------
40
- -----------------------
41
- RoutesTest: test_routes
42
- -----------------------
43
- -----------------------------
44
- RoutesTest: test_param_routes
45
- -----------------------------
46
- -------------------------
47
- HelpersTest: test_helpers
48
- -------------------------
49
- -------------------------
50
- HelpersTest: test_helpers
51
- -------------------------
52
- -----------------------------
53
- RoutesTest: test_param_routes
54
- -----------------------------
55
- -------------------------
56
- HelpersTest: test_helpers
57
- -------------------------
58
- -----------------------------
59
- RoutesTest: test_param_routes
60
- -----------------------------
61
- -----------------------------
62
- RoutesTest: test_param_routes
63
- -----------------------------
64
- -------------------------
65
- HelpersTest: test_helpers
66
- -------------------------
67
- -------------------------
68
- HelpersTest: test_helpers
69
- -------------------------
70
- -----------------------------
71
- RoutesTest: test_param_routes
72
- -----------------------------
73
- -------------------------
74
- HelpersTest: test_helpers
75
- -------------------------
76
- -----------------------------
77
- RoutesTest: test_param_routes
78
- -----------------------------
79
- -------------------------
80
- HelpersTest: test_helpers
81
- -------------------------
82
- -----------------------------
83
- RoutesTest: test_param_routes
84
- -----------------------------
85
- -------------------------
86
- HelpersTest: test_helpers
87
- -------------------------
88
- -----------------------------
89
- RoutesTest: test_param_routes
90
- -----------------------------
91
- -----------------------------
92
- RoutesTest: test_param_routes
93
- -----------------------------
94
- -------------------------
95
- HelpersTest: test_helpers
96
- -------------------------
97
- -----------------------------
98
- RoutesTest: test_param_routes
99
- -----------------------------
100
- -------------------------
101
- HelpersTest: test_helpers
102
- -------------------------
103
- -------------------------
104
- HelpersTest: test_helpers
105
- -------------------------
106
- -------------------------
107
- HelpersTest: test_helpers
108
- -------------------------
109
- -----------------------------
110
- RoutesTest: test_param_routes
111
- -----------------------------
112
- -------------------------
113
- HelpersTest: test_helpers
114
- -------------------------
115
- -----------------------------
116
- RoutesTest: test_param_routes
117
- -----------------------------
118
- -------------------------
119
- HelpersTest: test_helpers
120
- -------------------------
121
- -----------------------------
122
- RoutesTest: test_param_routes
123
- -----------------------------
124
- -------------------------
125
- HelpersTest: test_helpers
126
- -------------------------
127
- -----------------------------
128
- RoutesTest: test_param_routes
129
- -----------------------------
130
- -------------------------
131
- HelpersTest: test_helpers
132
- -------------------------
133
- -----------------------------
134
- RoutesTest: test_param_routes
135
- -----------------------------
136
- -------------------------
137
- HelpersTest: test_helpers
138
- -------------------------
139
- -----------------------------
140
- RoutesTest: test_param_routes
141
- -----------------------------
142
- -------------------------
143
- HelpersTest: test_helpers
144
- -------------------------
145
- -------------------------
146
- HelpersTest: test_helpers
147
- -------------------------
148
- -----------------------------
149
- RoutesTest: test_param_routes
150
- -----------------------------
151
- -------------------------
152
- HelpersTest: test_helpers
153
- -------------------------
154
- -----------------------------
155
- RoutesTest: test_param_routes
156
- -----------------------------
157
- -----------------------------
158
- RoutesTest: test_param_routes
159
- -----------------------------
160
- -------------------------
161
- HelpersTest: test_helpers
162
- -------------------------
163
- -------------------------
164
- HelpersTest: test_helpers
165
- -------------------------
166
- -----------------------------
167
- RoutesTest: test_param_routes
168
- -----------------------------
169
- -------------------------
170
- HelpersTest: test_helpers
171
- -------------------------
172
- -----------------------------
173
- RoutesTest: test_param_routes
174
- -----------------------------
175
- -------------------------
176
- HelpersTest: test_helpers
177
- -------------------------
178
- -----------------------------
179
- RoutesTest: test_param_routes
180
- -----------------------------
181
- -------------------------
182
- HelpersTest: test_helpers
183
- -------------------------
184
- -----------------------------
185
- RoutesTest: test_param_routes
186
- -----------------------------
187
- -------------------------
188
- HelpersTest: test_helpers
189
- -------------------------
190
- -------------------------
191
- HelpersTest: test_helpers
192
- -------------------------
193
- -----------------------------
194
- RoutesTest: test_param_routes
195
- -----------------------------
196
- -----------------------------
197
- RoutesTest: test_param_routes
198
- -----------------------------
199
- -------------------------
200
- HelpersTest: test_helpers
201
- -------------------------
202
- -----------------------------
203
- RoutesTest: test_param_routes
204
- -----------------------------
205
- -------------------------
206
- HelpersTest: test_helpers
207
- -------------------------
208
- -----------------------------
209
- RoutesTest: test_param_routes
210
- -----------------------------
211
- -------------------------
212
- HelpersTest: test_helpers
213
- -------------------------
214
- -----------------------------
215
- RoutesTest: test_param_routes
216
- -----------------------------
217
- -------------------------
218
- HelpersTest: test_helpers
219
- -------------------------
220
- -------------------------
221
- HelpersTest: test_helpers
222
- -------------------------
223
- -----------------------------
224
- RoutesTest: test_param_routes
225
- -----------------------------
226
- -----------------------------
227
- RoutesTest: test_param_routes
228
- -----------------------------
229
- -------------------------
230
- HelpersTest: test_helpers
231
- -------------------------
232
- -------------------------
233
- HelpersTest: test_helpers
234
- -------------------------
235
- -----------------------------
236
- RoutesTest: test_param_routes
237
- -----------------------------
238
- -------------------------
239
2
  HelpersTest: test_methods
240
3
  -------------------------
241
4
  -----------------------
@@ -259,9 +22,6 @@ RoutesTest: test_params
259
22
  -------------------------
260
23
  HelpersTest: test_methods
261
24
  -------------------------
262
- -----------------------
263
- RoutesTest: test_params
264
- -----------------------
265
25
  -------------------------
266
26
  HelpersTest: test_methods
267
27
  -------------------------
@@ -274,12 +34,6 @@ HelpersTest: test_methods
274
34
  -----------------------
275
35
  RoutesTest: test_params
276
36
  -----------------------
277
- -------------------------
278
- HelpersTest: test_methods
279
- -------------------------
280
- -------------------------
281
- HelpersTest: test_methods
282
- -------------------------
283
37
  -----------------------
284
38
  RoutesTest: test_params
285
39
  -----------------------
@@ -292,21 +46,12 @@ RoutesTest: test_params
292
46
  -------------------------
293
47
  HelpersTest: test_methods
294
48
  -------------------------
295
- -----------------------
296
- RoutesTest: test_params
297
- -----------------------
298
49
  -------------------------
299
50
  HelpersTest: test_methods
300
51
  -------------------------
301
52
  -----------------------
302
53
  RoutesTest: test_params
303
54
  -----------------------
304
- -----------------------
305
- RoutesTest: test_params
306
- -----------------------
307
- -------------------------
308
- HelpersTest: test_methods
309
- -------------------------
310
55
  -------------------------
311
56
  HelpersTest: test_methods
312
57
  -------------------------
@@ -325,63 +70,15 @@ HelpersTest: test_methods
325
70
  -----------------------
326
71
  RoutesTest: test_params
327
72
  -----------------------
328
- -------------------------
329
- HelpersTest: test_methods
330
- -------------------------
331
73
  -----------------------
332
74
  RoutesTest: test_params
333
75
  -----------------------
334
76
  -------------------------
335
77
  HelpersTest: test_methods
336
78
  -------------------------
337
- -----------------------
338
- RoutesTest: test_params
339
- -----------------------
340
- -----------------------
341
- RoutesTest: test_params
342
- -----------------------
343
- -------------------------
344
- HelpersTest: test_methods
345
- -------------------------
346
- -----------------------
347
- RoutesTest: test_params
348
- -----------------------
349
- -------------------------
350
- HelpersTest: test_methods
351
- -------------------------
352
- -------------------------
353
- HelpersTest: test_methods
354
- -------------------------
355
- -----------------------
356
- RoutesTest: test_params
357
- -----------------------
358
- -------------------------
359
- HelpersTest: test_methods
360
- -------------------------
361
- -----------------------
362
- RoutesTest: test_params
363
- -----------------------
364
- -------------------------
365
- HelpersTest: test_methods
366
- -------------------------
367
- -----------------------
368
- RoutesTest: test_params
369
- -----------------------
370
- -------------------------
371
- HelpersTest: test_methods
372
- -------------------------
373
- -----------------------
374
- RoutesTest: test_params
375
- -----------------------
376
79
  -------------------------
377
80
  HelpersTest: test_methods
378
81
  -------------------------
379
82
  -----------------------
380
83
  RoutesTest: test_params
381
84
  -----------------------
382
- -----------------------
383
- RoutesTest: test_params
384
- -----------------------
385
- -------------------------
386
- HelpersTest: test_methods
387
- -------------------------
@@ -1,67 +1,61 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
- <head>
4
- <title>The page you were looking for doesn't exist (404)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- body {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
-
15
- div.dialog {
16
- width: 95%;
17
- max-width: 33em;
18
- margin: 4em auto 0;
19
- }
20
-
21
- div.dialog > div {
22
- border: 1px solid #CCC;
23
- border-right-color: #999;
24
- border-left-color: #999;
25
- border-bottom-color: #BBB;
26
- border-top: #B00100 solid 4px;
27
- border-top-left-radius: 9px;
28
- border-top-right-radius: 9px;
29
- background-color: white;
30
- padding: 7px 12% 0;
31
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
- }
33
-
34
- h1 {
35
- font-size: 100%;
36
- color: #730E15;
37
- line-height: 1.5em;
38
- }
39
-
40
- div.dialog > p {
41
- margin: 0 0 1em;
42
- padding: 1em;
43
- background-color: #F7F7F7;
44
- border: 1px solid #CCC;
45
- border-right-color: #999;
46
- border-left-color: #999;
47
- border-bottom-color: #999;
48
- border-bottom-left-radius: 4px;
49
- border-bottom-right-radius: 4px;
50
- border-top-color: #DADADA;
51
- color: #666;
52
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
- }
54
- </style>
55
- </head>
56
-
57
- <body>
58
- <!-- This file lives in public/404.html -->
59
- <div class="dialog">
60
- <div>
61
- <h1>The page you were looking for doesn't exist.</h1>
62
- <p>You may have mistyped the address or the page may have moved.</p>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+ div.dialog {
15
+ width: 95%;
16
+ max-width: 33em;
17
+ margin: 4em auto 0;
18
+ }
19
+ div.dialog > div {
20
+ border: 1px solid #CCC;
21
+ border-right-color: #999;
22
+ border-left-color: #999;
23
+ border-bottom-color: #BBB;
24
+ border-top: #B00100 solid 4px;
25
+ border-top-left-radius: 9px;
26
+ border-top-right-radius: 9px;
27
+ background-color: white;
28
+ padding: 7px 12% 0;
29
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
30
+ }
31
+ h1 {
32
+ font-size: 100%;
33
+ color: #730E15;
34
+ line-height: 1.5em;
35
+ }
36
+ div.dialog > p {
37
+ margin: 0 0 1em;
38
+ padding: 1em;
39
+ background-color: #F7F7F7;
40
+ border: 1px solid #CCC;
41
+ border-right-color: #999;
42
+ border-left-color: #999;
43
+ border-bottom-color: #999;
44
+ border-bottom-left-radius: 4px;
45
+ border-bottom-right-radius: 4px;
46
+ border-top-color: #DADADA;
47
+ color: #666;
48
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
49
+ }
50
+ </style>
51
+ </head>
52
+ <body>
53
+ <div class="dialog">
54
+ <div>
55
+ <h1>The page you were looking for doesn't exist.</h1>
56
+ <p>You may have mistyped the address or the page may have moved.</p>
57
+ </div>
58
+ <p>If you are the application owner check the logs for more information.</p>
63
59
  </div>
64
- <p>If you are the application owner check the logs for more information.</p>
65
- </div>
66
- </body>
60
+ </body>
67
61
  </html>
@@ -1,67 +1,61 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
- <head>
4
- <title>The change you wanted was rejected (422)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- body {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
-
15
- div.dialog {
16
- width: 95%;
17
- max-width: 33em;
18
- margin: 4em auto 0;
19
- }
20
-
21
- div.dialog > div {
22
- border: 1px solid #CCC;
23
- border-right-color: #999;
24
- border-left-color: #999;
25
- border-bottom-color: #BBB;
26
- border-top: #B00100 solid 4px;
27
- border-top-left-radius: 9px;
28
- border-top-right-radius: 9px;
29
- background-color: white;
30
- padding: 7px 12% 0;
31
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
- }
33
-
34
- h1 {
35
- font-size: 100%;
36
- color: #730E15;
37
- line-height: 1.5em;
38
- }
39
-
40
- div.dialog > p {
41
- margin: 0 0 1em;
42
- padding: 1em;
43
- background-color: #F7F7F7;
44
- border: 1px solid #CCC;
45
- border-right-color: #999;
46
- border-left-color: #999;
47
- border-bottom-color: #999;
48
- border-bottom-left-radius: 4px;
49
- border-bottom-right-radius: 4px;
50
- border-top-color: #DADADA;
51
- color: #666;
52
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
- }
54
- </style>
55
- </head>
56
-
57
- <body>
58
- <!-- This file lives in public/422.html -->
59
- <div class="dialog">
60
- <div>
61
- <h1>The change you wanted was rejected.</h1>
62
- <p>Maybe you tried to change something you didn't have access to.</p>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+ div.dialog {
15
+ width: 95%;
16
+ max-width: 33em;
17
+ margin: 4em auto 0;
18
+ }
19
+ div.dialog > div {
20
+ border: 1px solid #CCC;
21
+ border-right-color: #999;
22
+ border-left-color: #999;
23
+ border-bottom-color: #BBB;
24
+ border-top: #B00100 solid 4px;
25
+ border-top-left-radius: 9px;
26
+ border-top-right-radius: 9px;
27
+ background-color: white;
28
+ padding: 7px 12% 0;
29
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
30
+ }
31
+ h1 {
32
+ font-size: 100%;
33
+ color: #730E15;
34
+ line-height: 1.5em;
35
+ }
36
+ div.dialog > p {
37
+ margin: 0 0 1em;
38
+ padding: 1em;
39
+ background-color: #F7F7F7;
40
+ border: 1px solid #CCC;
41
+ border-right-color: #999;
42
+ border-left-color: #999;
43
+ border-bottom-color: #999;
44
+ border-bottom-left-radius: 4px;
45
+ border-bottom-right-radius: 4px;
46
+ border-top-color: #DADADA;
47
+ color: #666;
48
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
49
+ }
50
+ </style>
51
+ </head>
52
+ <body>
53
+ <div class="dialog">
54
+ <div>
55
+ <h1>The change you wanted was rejected.</h1>
56
+ <p>Maybe you tried to change something you didn't have access to.</p>
57
+ </div>
58
+ <p>If you are the application owner check the logs for more information.</p>
63
59
  </div>
64
- <p>If you are the application owner check the logs for more information.</p>
65
- </div>
66
- </body>
60
+ </body>
67
61
  </html>
@@ -1,66 +1,60 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
- <head>
4
- <title>We're sorry, but something went wrong (500)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- body {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
-
15
- div.dialog {
16
- width: 95%;
17
- max-width: 33em;
18
- margin: 4em auto 0;
19
- }
20
-
21
- div.dialog > div {
22
- border: 1px solid #CCC;
23
- border-right-color: #999;
24
- border-left-color: #999;
25
- border-bottom-color: #BBB;
26
- border-top: #B00100 solid 4px;
27
- border-top-left-radius: 9px;
28
- border-top-right-radius: 9px;
29
- background-color: white;
30
- padding: 7px 12% 0;
31
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
- }
33
-
34
- h1 {
35
- font-size: 100%;
36
- color: #730E15;
37
- line-height: 1.5em;
38
- }
39
-
40
- div.dialog > p {
41
- margin: 0 0 1em;
42
- padding: 1em;
43
- background-color: #F7F7F7;
44
- border: 1px solid #CCC;
45
- border-right-color: #999;
46
- border-left-color: #999;
47
- border-bottom-color: #999;
48
- border-bottom-left-radius: 4px;
49
- border-bottom-right-radius: 4px;
50
- border-top-color: #DADADA;
51
- color: #666;
52
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
- }
54
- </style>
55
- </head>
56
-
57
- <body>
58
- <!-- This file lives in public/500.html -->
59
- <div class="dialog">
60
- <div>
61
- <h1>We're sorry, but something went wrong.</h1>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+ div.dialog {
15
+ width: 95%;
16
+ max-width: 33em;
17
+ margin: 4em auto 0;
18
+ }
19
+ div.dialog > div {
20
+ border: 1px solid #CCC;
21
+ border-right-color: #999;
22
+ border-left-color: #999;
23
+ border-bottom-color: #BBB;
24
+ border-top: #B00100 solid 4px;
25
+ border-top-left-radius: 9px;
26
+ border-top-right-radius: 9px;
27
+ background-color: white;
28
+ padding: 7px 12% 0;
29
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
30
+ }
31
+ h1 {
32
+ font-size: 100%;
33
+ color: #730E15;
34
+ line-height: 1.5em;
35
+ }
36
+ div.dialog > p {
37
+ margin: 0 0 1em;
38
+ padding: 1em;
39
+ background-color: #F7F7F7;
40
+ border: 1px solid #CCC;
41
+ border-right-color: #999;
42
+ border-left-color: #999;
43
+ border-bottom-color: #999;
44
+ border-bottom-left-radius: 4px;
45
+ border-bottom-right-radius: 4px;
46
+ border-top-color: #DADADA;
47
+ color: #666;
48
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
49
+ }
50
+ </style>
51
+ </head>
52
+ <body>
53
+ <div class="dialog">
54
+ <div>
55
+ <h1>We're sorry, but something went wrong.</h1>
56
+ </div>
57
+ <p>If you are the application owner check the logs for more information.</p>
62
58
  </div>
63
- <p>If you are the application owner check the logs for more information.</p>
64
- </div>
65
- </body>
59
+ </body>
66
60
  </html>
@@ -1,8 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
- class HelpersTest < ActionView::TestCase
4
- include Rails.application.routes.url_helpers
5
- include I18nSupport
3
+ class HelperTest < ActionView::TestCase
4
+ include Rails.application.routes.url_helpers, I18nSupport
6
5
 
7
6
  test 'methods' do
8
7
  iterate_locales do |locale|
@@ -52,15 +51,15 @@ class HelpersTest < ActionView::TestCase
52
51
  member_param_resource_path(10, locale: locale)
53
52
  )
54
53
  assert_equal(
55
- "/#{locale}/#{t('routes.resources')}/10/#{t('routes.nesteds')}",
56
- param_resource_nesteds_path(10, locale: locale)
54
+ "/#{locale}/#{t('routes.resources')}/10/#{t('routes.nested')}",
55
+ param_resource_nested_index_path(10, locale: locale)
57
56
  )
58
57
  assert_equal(
59
- "/#{locale}/#{t('routes.resources')}/10/#{t('routes.nesteds')}/#{t('routes.new')}",
58
+ "/#{locale}/#{t('routes.resources')}/10/#{t('routes.nested')}/#{t('routes.new')}",
60
59
  new_param_resource_nested_path(10, locale: locale)
61
60
  )
62
61
  assert_equal(
63
- "/#{locale}/#{t('routes.resources')}/10/#{t('routes.nesteds')}/4/#{t('routes.edit')}",
62
+ "/#{locale}/#{t('routes.resources')}/10/#{t('routes.nested')}/4/#{t('routes.edit')}",
64
63
  edit_param_resource_nested_path(10, 4, locale: locale)
65
64
  )
66
65
 
@@ -109,15 +108,15 @@ class HelpersTest < ActionView::TestCase
109
108
  member_subdomain_resource_url(10, subdomain: locale)
110
109
  )
111
110
  assert_equal(
112
- "http://#{locale}.test.host/#{t('routes.resources')}/10/#{t('routes.nesteds')}",
113
- subdomain_resource_nesteds_url(10, subdomain: locale)
111
+ "http://#{locale}.test.host/#{t('routes.resources')}/10/#{t('routes.nested')}",
112
+ subdomain_resource_nested_index_url(10, subdomain: locale)
114
113
  )
115
114
  assert_equal(
116
- "http://#{locale}.test.host/#{t('routes.resources')}/10/#{t('routes.nesteds')}/#{t('routes.new')}",
115
+ "http://#{locale}.test.host/#{t('routes.resources')}/10/#{t('routes.nested')}/#{t('routes.new')}",
117
116
  new_subdomain_resource_nested_url(10, subdomain: locale)
118
117
  )
119
118
  assert_equal(
120
- "http://#{locale}.test.host/#{t('routes.resources')}/10/#{t('routes.nesteds')}/4/#{t('routes.edit')}",
119
+ "http://#{locale}.test.host/#{t('routes.resources')}/10/#{t('routes.nested')}/4/#{t('routes.edit')}",
121
120
  edit_subdomain_resource_nested_url(10, 4, subdomain: locale)
122
121
  )
123
122
 
@@ -167,15 +166,15 @@ class HelpersTest < ActionView::TestCase
167
166
  member_domain_resource_url(10, domain: domain)
168
167
  )
169
168
  assert_equal(
170
- "http://#{domain}/#{t('routes.resources')}/10/#{t('routes.nesteds')}",
171
- domain_resource_nesteds_url(10, domain: domain)
169
+ "http://#{domain}/#{t('routes.resources')}/10/#{t('routes.nested')}",
170
+ domain_resource_nested_index_url(10, domain: domain)
172
171
  )
173
172
  assert_equal(
174
- "http://#{domain}/#{t('routes.resources')}/10/#{t('routes.nesteds')}/#{t('routes.new')}",
173
+ "http://#{domain}/#{t('routes.resources')}/10/#{t('routes.nested')}/#{t('routes.new')}",
175
174
  new_domain_resource_nested_url(10, domain: domain)
176
175
  )
177
176
  assert_equal(
178
- "http://#{domain}/#{t('routes.resources')}/10/#{t('routes.nesteds')}/4/#{t('routes.edit')}",
177
+ "http://#{domain}/#{t('routes.resources')}/10/#{t('routes.nested')}/4/#{t('routes.edit')}",
179
178
  edit_domain_resource_nested_url(10, 4, domain: domain)
180
179
  )
181
180
 
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class RoutesTest < ActionDispatch::IntegrationTest
3
+ class RouteTest < ActionDispatch::IntegrationTest
4
4
  include I18nSupport
5
5
 
6
6
  test 'params' do
@@ -51,16 +51,16 @@ class RoutesTest < ActionDispatch::IntegrationTest
51
51
  "/#{locale}/#{t('routes.resources')}/10/#{t('routes.member')}"
52
52
  )
53
53
  assert_recognizes(
54
- { controller: 'nesteds', action: 'index', resource_id: '10', locale: locale.to_s },
55
- "/#{locale}/#{t('routes.resources')}/10/#{t('routes.nesteds')}"
54
+ { controller: 'nested', action: 'index', resource_id: '10', locale: locale.to_s },
55
+ "/#{locale}/#{t('routes.resources')}/10/#{t('routes.nested')}"
56
56
  )
57
57
  assert_recognizes(
58
- { controller: 'nesteds', action: 'new', resource_id: '10', locale: locale.to_s },
59
- "/#{locale}/#{t('routes.resources')}/10/#{t('routes.nesteds')}/#{t('routes.new')}"
58
+ { controller: 'nested', action: 'new', resource_id: '10', locale: locale.to_s },
59
+ "/#{locale}/#{t('routes.resources')}/10/#{t('routes.nested')}/#{t('routes.new')}"
60
60
  )
61
61
  assert_recognizes(
62
- { controller: 'nesteds', action: 'edit', resource_id: '10', id: '4', locale: locale.to_s },
63
- "/#{locale}/#{t('routes.resources')}/10/#{t('routes.nesteds')}/4/#{t('routes.edit')}"
62
+ { controller: 'nested', action: 'edit', resource_id: '10', id: '4', locale: locale.to_s },
63
+ "/#{locale}/#{t('routes.resources')}/10/#{t('routes.nested')}/4/#{t('routes.edit')}"
64
64
  )
65
65
 
66
66
  host = "#{locale}.test.host"
@@ -109,16 +109,16 @@ class RoutesTest < ActionDispatch::IntegrationTest
109
109
  "http://#{host}/#{t('routes.resources')}/10/#{t('routes.member')}"
110
110
  )
111
111
  assert_recognizes(
112
- { controller: 'nesteds', action: 'index', resource_id: '10', subdomain: locale.to_s },
113
- "http://#{host}/#{t('routes.resources')}/10/#{t('routes.nesteds')}"
112
+ { controller: 'nested', action: 'index', resource_id: '10', subdomain: locale.to_s },
113
+ "http://#{host}/#{t('routes.resources')}/10/#{t('routes.nested')}"
114
114
  )
115
115
  assert_recognizes(
116
- { controller: 'nesteds', action: 'new', resource_id: '10', subdomain: locale.to_s },
117
- "http://#{host}/#{t('routes.resources')}/10/#{t('routes.nesteds')}/#{t('routes.new')}"
116
+ { controller: 'nested', action: 'new', resource_id: '10', subdomain: locale.to_s },
117
+ "http://#{host}/#{t('routes.resources')}/10/#{t('routes.nested')}/#{t('routes.new')}"
118
118
  )
119
119
  assert_recognizes(
120
- { controller: 'nesteds', action: 'edit', resource_id: '10', id: '4', subdomain: locale.to_s },
121
- "http://#{host}/#{t('routes.resources')}/10/#{t('routes.nesteds')}/4/#{t('routes.edit')}"
120
+ { controller: 'nested', action: 'edit', resource_id: '10', id: '4', subdomain: locale.to_s },
121
+ "http://#{host}/#{t('routes.resources')}/10/#{t('routes.nested')}/4/#{t('routes.edit')}"
122
122
  )
123
123
 
124
124
  host = domain = "test.#{locale}"
@@ -167,16 +167,16 @@ class RoutesTest < ActionDispatch::IntegrationTest
167
167
  "http://#{host}/#{t('routes.resources')}/10/#{t('routes.member')}"
168
168
  )
169
169
  assert_recognizes(
170
- { controller: 'nesteds', action: 'index', resource_id: '10', domain: domain },
171
- "http://#{host}/#{t('routes.resources')}/10/#{t('routes.nesteds')}"
170
+ { controller: 'nested', action: 'index', resource_id: '10', domain: domain },
171
+ "http://#{host}/#{t('routes.resources')}/10/#{t('routes.nested')}"
172
172
  )
173
173
  assert_recognizes(
174
- { controller: 'nesteds', action: 'new', resource_id: '10', domain: domain },
175
- "http://#{host}/#{t('routes.resources')}/10/#{t('routes.nesteds')}/#{t('routes.new')}"
174
+ { controller: 'nested', action: 'new', resource_id: '10', domain: domain },
175
+ "http://#{host}/#{t('routes.resources')}/10/#{t('routes.nested')}/#{t('routes.new')}"
176
176
  )
177
177
  assert_recognizes(
178
- { controller: 'nesteds', action: 'edit', resource_id: '10', id: '4', domain: domain },
179
- "http://#{host}/#{t('routes.resources')}/10/#{t('routes.nesteds')}/4/#{t('routes.edit')}"
178
+ { controller: 'nested', action: 'edit', resource_id: '10', id: '4', domain: domain },
179
+ "http://#{host}/#{t('routes.resources')}/10/#{t('routes.nested')}/4/#{t('routes.edit')}"
180
180
  )
181
181
 
182
182
  end
@@ -1,4 +1,5 @@
1
1
  module I18nSupport
2
+ extend ActiveSupport::Concern
2
3
 
3
4
  def iterate_locales
4
5
  I18n.available_locales.each do |locale|
data/test/test_helper.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # Configure Rails Environment
2
2
  ENV['RAILS_ENV'] = 'test'
3
3
 
4
- require File.expand_path('../dummy/config/environment.rb', __FILE__)
4
+ require File.expand_path('../../test/dummy/config/environment.rb', __FILE__)
5
5
  require 'rails/test_help'
6
6
 
7
7
  # Filter out Minitest backtrace while allowing backtrace from other libraries
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: localizable_routes
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 4.0.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - mmontossi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-17 00:00:00.000000000 Z
11
+ date: 2016-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -30,9 +30,9 @@ dependencies:
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: 4.3.0
33
- description: Minimalistic toolkit to localize routes in rails.
33
+ description: Flexible toolkit to localize routes in rails.
34
34
  email:
35
- - mmontossi@buyin.io
35
+ - mmontossi@gmail.com
36
36
  executables: []
37
37
  extensions: []
38
38
  extra_rdoc_files: []
@@ -51,7 +51,7 @@ files:
51
51
  - test/dummy/app/controllers/application_controller.rb
52
52
  - test/dummy/app/controllers/namespace/pages_controller.rb
53
53
  - test/dummy/app/controllers/namespace/resources_controller.rb
54
- - test/dummy/app/controllers/nesteds_controller.rb
54
+ - test/dummy/app/controllers/nested_controller.rb
55
55
  - test/dummy/app/controllers/pages_controller.rb
56
56
  - test/dummy/app/controllers/resources_controller.rb
57
57
  - test/dummy/app/helpers/application_helper.rb
@@ -63,6 +63,8 @@ files:
63
63
  - test/dummy/config.ru
64
64
  - test/dummy/config/application.rb
65
65
  - test/dummy/config/boot.rb
66
+ - test/dummy/config/database.yml
67
+ - test/dummy/config/database.yml.travis
66
68
  - test/dummy/config/environment.rb
67
69
  - test/dummy/config/environments/development.rb
68
70
  - test/dummy/config/environments/production.rb
@@ -85,8 +87,8 @@ files:
85
87
  - test/dummy/public/422.html
86
88
  - test/dummy/public/500.html
87
89
  - test/dummy/public/favicon.ico
88
- - test/helpers_test.rb
89
- - test/routes_test.rb
90
+ - test/helper_test.rb
91
+ - test/route_test.rb
90
92
  - test/support/i18n_support.rb
91
93
  - test/test_helper.rb
92
94
  homepage: https://github.com/mmontossi/localizable_routes
@@ -119,7 +121,7 @@ test_files:
119
121
  - test/dummy/app/controllers/application_controller.rb
120
122
  - test/dummy/app/controllers/namespace/pages_controller.rb
121
123
  - test/dummy/app/controllers/namespace/resources_controller.rb
122
- - test/dummy/app/controllers/nesteds_controller.rb
124
+ - test/dummy/app/controllers/nested_controller.rb
123
125
  - test/dummy/app/controllers/pages_controller.rb
124
126
  - test/dummy/app/controllers/resources_controller.rb
125
127
  - test/dummy/app/helpers/application_helper.rb
@@ -130,6 +132,8 @@ test_files:
130
132
  - test/dummy/bin/setup
131
133
  - test/dummy/config/application.rb
132
134
  - test/dummy/config/boot.rb
135
+ - test/dummy/config/database.yml
136
+ - test/dummy/config/database.yml.travis
133
137
  - test/dummy/config/environment.rb
134
138
  - test/dummy/config/environments/development.rb
135
139
  - test/dummy/config/environments/production.rb
@@ -154,7 +158,7 @@ test_files:
154
158
  - test/dummy/public/500.html
155
159
  - test/dummy/public/favicon.ico
156
160
  - test/dummy/Rakefile
157
- - test/helpers_test.rb
158
- - test/routes_test.rb
161
+ - test/helper_test.rb
162
+ - test/route_test.rb
159
163
  - test/support/i18n_support.rb
160
164
  - test/test_helper.rb
@@ -1,6 +0,0 @@
1
- class NestedsController < ApplicationController
2
-
3
- def index
4
- end
5
-
6
- end