translatable_routes 1.3.5 → 1.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d558f9e950165aefca940162d56890a6002333d
4
- data.tar.gz: 1c5f5a4d4a6a1618cc527b819837b90c1b4feca6
3
+ metadata.gz: bcb323b671272f53a95fb2bf189081c2b90fa8a7
4
+ data.tar.gz: 1f0e5de66aa5254091520e02e2a8f4693740b749
5
5
  SHA512:
6
- metadata.gz: 9bdc5eca6a98540e953896a98749ebcdbd4cc60d8223bde47275dd5e6160da3edc9179cb31e0216bab2242ed54e5b9c3473b471bbcc4d4b2f7497d1700666798
7
- data.tar.gz: 5b77227f4487b998b487768ed94611b3f67d578452323c26ff4605e541d930eb3a2eab5638cf4589dc3fe8391d5247d6b96d7c2c61602d488839e22aca788d4b
6
+ metadata.gz: 4b6ea0303ec82d7072d2bf56fd022607ed6cd411aa8f0c08d8786f870dd0c43908bc2f5c66b3c83c47ac3517062367d2b06f9eba710954651cc9a7d09c344c0b
7
+ data.tar.gz: af2914ede89ac2f8191ff26a33a78237e9aa64d1e1f293b07d82b6d530d2319627b1054ae6ae9139c363cf2718ab0f9efb77907e7bfe5896ee258e2e9b622d73
@@ -35,7 +35,7 @@ module TranslatableRoutes
35
35
  end
36
36
  end
37
37
  end
38
- else
38
+ elsif !options[:as].nil?
39
39
  options[:as] = "#{options[:as] || action}_#{locale}"
40
40
  end
41
41
  super i18n_path(action, locale), options
@@ -50,11 +50,14 @@ module TranslatableRoutes
50
50
  end
51
51
  if @scope[:scope_level_resource]
52
52
  helper = name_for_action(options[:as], action)
53
- else
53
+ @set.named_routes.define_i18n_url_helper helper
54
+ elsif !options[:as].nil?
54
55
  helper = "#{options[:as] || action}"
55
- helper = "#{@scope[:as]}_#{helper}" if @scope[:as]
56
+ if @scope[:as]
57
+ helper.prepend "#{@scope[:as]}_"
58
+ end
59
+ @set.named_routes.define_i18n_url_helper helper
56
60
  end
57
- @set.named_routes.define_i18n_url_helper helper
58
61
  else
59
62
  super
60
63
  end
@@ -71,7 +74,7 @@ module TranslatableRoutes
71
74
  if part[0] == ':' or part[0] == '*'
72
75
  i18n_path << part
73
76
  else
74
- i18n_path << I18n.t("routes.#{part}", locale: locale, default: part.gsub(/_/, '-'))
77
+ i18n_path << I18n.t("routes.#{part.gsub('-', '_')}", locale: locale, default: part.gsub('_', '-'))
75
78
  end
76
79
  end
77
80
  i18n_path.join('/')
@@ -17,7 +17,7 @@ module TranslatableRoutes
17
17
  target.module_eval do
18
18
  define_method helper do |*args|
19
19
  options = args.extract_options!
20
- suffix = (options[:locale] || I18n.locale).to_s.gsub('-', '_').downcase
20
+ suffix = (options[:locale] || url_options[:locale] || I18n.locale).to_s.gsub('-', '_').downcase
21
21
  send "#{name}_#{suffix}_#{type}", *(args << options)
22
22
  end
23
23
  end
@@ -1,5 +1,5 @@
1
1
  module TranslatableRoutes
2
2
 
3
- VERSION = '1.3.5'
3
+ VERSION = '1.3.6'
4
4
 
5
5
  end
File without changes
data/test/dummy/bin/rails CHANGED
File without changes
data/test/dummy/bin/rake CHANGED
File without changes
@@ -6669,3 +6669,18 @@ HelpersTest: test_helpers
6669
6669
  RoutesTest: test_routes
6670
6670
  -----------------------
6671
6671
   (0.1ms) rollback transaction
6672
+  (0.2ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
6673
+  (0.1ms) select sqlite_version(*)
6674
+  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
6675
+  (0.0ms) SELECT version FROM "schema_migrations"
6676
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
6677
+  (0.1ms) begin transaction
6678
+ -----------------------
6679
+ RoutesTest: test_routes
6680
+ -----------------------
6681
+  (0.1ms) rollback transaction
6682
+  (0.0ms) begin transaction
6683
+ -------------------------
6684
+ HelpersTest: test_helpers
6685
+ -------------------------
6686
+  (0.0ms) rollback transaction
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: translatable_routes
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Museways
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-04 00:00:00.000000000 Z
11
+ date: 2015-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails