awesome_translations 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/awesome_translations/group.rb +20 -2
- data/app/models/awesome_translations/translation.rb +14 -1
- data/app/views/awesome_translations/handlers/show.html.haml +6 -0
- data/lib/awesome_translations/version.rb +1 -1
- data/lib/awesome_translations.rb +1 -1
- data/spec/dummy/log/test.log +84 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edc14b800bd267a02cb1107d191c60ff2fd5b327
|
4
|
+
data.tar.gz: 61084c5bb4ffab536c371abf1f26736fd51c54b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3aca07ea68d89f24310f1380fb7124248b24fdc54706731720e3170420b22b1e36c9884f126a3f4460dcfe8e2f91195fae9929eb4fe72d7910301e42aae071b4
|
7
|
+
data.tar.gz: b724e8cf1edab7c58d5f899c2c50a938c25247693f30a63c42e5efede15c4f6becf721e9770f58566972b9f9181a0b22c8e604ffb348f1add995228b595061d4
|
@@ -13,8 +13,26 @@ class AwesomeTranslations::Group
|
|
13
13
|
@handler, @id, @data = args[:handler], args[:id], args[:data]
|
14
14
|
end
|
15
15
|
|
16
|
-
def translations
|
17
|
-
@handler.translations_for_group(self)
|
16
|
+
def translations(args = {})
|
17
|
+
translations_list = @handler.translations_for_group(self)
|
18
|
+
|
19
|
+
args.each do |key, value|
|
20
|
+
if key == :finished
|
21
|
+
translations_list = translations_list.select { |translation| translation.finished? } if value
|
22
|
+
elsif key == :unfinished
|
23
|
+
translations_list = translations_list.select { |translation| translation.unfinished? } if value
|
24
|
+
else
|
25
|
+
raise "Unknown key: #{key}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
return translations_list
|
30
|
+
end
|
31
|
+
|
32
|
+
def translations_count(args = {})
|
33
|
+
count = 0
|
34
|
+
translations(args).each { count += 1 }
|
35
|
+
return count
|
18
36
|
end
|
19
37
|
|
20
38
|
def to_param
|
@@ -26,7 +26,7 @@ class AwesomeTranslations::Translation
|
|
26
26
|
I18n.available_locales.each do |locale|
|
27
27
|
next unless value_for?(locale)
|
28
28
|
|
29
|
-
|
29
|
+
result << AwesomeTranslations::TranslatedValue.new(
|
30
30
|
file: "#{dir}/#{locale}.yml",
|
31
31
|
key: @key,
|
32
32
|
locale: locale,
|
@@ -37,6 +37,19 @@ class AwesomeTranslations::Translation
|
|
37
37
|
return result
|
38
38
|
end
|
39
39
|
|
40
|
+
def finished?
|
41
|
+
I18n.available_locales.each do |locale|
|
42
|
+
next if value_for?(locale)
|
43
|
+
return false
|
44
|
+
end
|
45
|
+
|
46
|
+
return true
|
47
|
+
end
|
48
|
+
|
49
|
+
def unfinished?
|
50
|
+
!finished?
|
51
|
+
end
|
52
|
+
|
40
53
|
def translated_value_for_locale(locale)
|
41
54
|
AwesomeTranslations::TranslatedValue.new(
|
42
55
|
file: "#{dir}/#{locale}.yml",
|
@@ -3,10 +3,16 @@
|
|
3
3
|
%table
|
4
4
|
%thead
|
5
5
|
%th Group
|
6
|
+
%th Translations
|
7
|
+
%th Finished
|
8
|
+
%th Unfinished
|
6
9
|
%tbody
|
7
10
|
- @groups.each do |group|
|
8
11
|
%tr
|
9
12
|
%td= link_to group.name, handler_group_path(@handler, group)
|
13
|
+
%td= group.translations_count
|
14
|
+
%td= group.translations_count(finished: true)
|
15
|
+
%td= group.translations_count(unfinished: true)
|
10
16
|
- if @groups.empty?
|
11
17
|
%tr
|
12
18
|
%td.error{colspan: 2} No groups were found.
|
data/lib/awesome_translations.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require "awesome_translations/engine"
|
2
1
|
require "haml"
|
3
2
|
require "string-cases"
|
4
3
|
require "array_enumerator"
|
5
4
|
|
6
5
|
module AwesomeTranslations
|
7
6
|
autoload :Config, "#{File.dirname(__FILE__)}/awesome_translations/config"
|
7
|
+
autoload :Engine, "#{File.dirname(__FILE__)}/awesome_translations/engine"
|
8
8
|
autoload :ErbInspector, "#{File.dirname(__FILE__)}/awesome_translations/erb_inspector"
|
9
9
|
autoload :Handlers, "#{File.dirname(__FILE__)}/awesome_translations/handlers"
|
10
10
|
autoload :ObjectExtensions, "awesome_translations/object_extensions"
|
data/spec/dummy/log/test.log
CHANGED
@@ -4990,3 +4990,87 @@ Completed 200 OK in 5ms (Views: 4.9ms | ActiveRecord: 0.0ms)
|
|
4990
4990
|
[1m[36m (0.2ms)[0m [1mrollback transaction[0m
|
4991
4991
|
[1m[35m (0.1ms)[0m begin transaction
|
4992
4992
|
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
4993
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
4994
|
+
[1m[35m (0.1ms)[0m begin transaction
|
4995
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
4996
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
4997
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
4998
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
4999
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
5000
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
5001
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
5002
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
5003
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
5004
|
+
Processing by AwesomeTranslations::GroupsController#update as HTML
|
5005
|
+
Parameters: {"handler_id"=>"model_handler", "id"=>"User", "t"=>{"activerecord.attributes.user.password"=>"[FILTERED]"}}
|
5006
|
+
Redirected to http://test.host/handlers/model_handler/groups/User
|
5007
|
+
Completed 302 Found in 394ms (ActiveRecord: 0.0ms)
|
5008
|
+
[1m[35m (0.2ms)[0m rollback transaction
|
5009
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
5010
|
+
Processing by AwesomeTranslations::GroupsController#update as HTML
|
5011
|
+
Parameters: {"handler_id"=>"model_handler", "id"=>"Role", "t"=>{"activerecord.attributes.role.role"=>{"da"=>"Rolle", "de"=>"Die type", "en"=>"Role"}}}
|
5012
|
+
Redirected to http://test.host/handlers/model_handler/groups/Role
|
5013
|
+
Completed 302 Found in 319ms (ActiveRecord: 0.0ms)
|
5014
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
5015
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
5016
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
5017
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
5018
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
5019
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
5020
|
+
Processing by AwesomeTranslations::HandlersController#index as HTML
|
5021
|
+
Completed 200 OK in 9ms (Views: 9.1ms | ActiveRecord: 0.0ms)
|
5022
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
5023
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
5024
|
+
Processing by AwesomeTranslations::HandlersController#show as HTML
|
5025
|
+
Parameters: {"id"=>"model_handler"}
|
5026
|
+
Completed 200 OK in 490ms (Views: 490.2ms | ActiveRecord: 0.0ms)
|
5027
|
+
[1m[35m (0.2ms)[0m rollback transaction
|
5028
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
5029
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
5030
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
5031
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
5032
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
5033
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
5034
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
5035
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
5036
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
5037
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
5038
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
5039
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
5040
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
5041
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
5042
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
5043
|
+
[1m[35m (0.2ms)[0m rollback transaction
|
5044
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
5045
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
5046
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
5047
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
5048
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
5049
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
5050
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
5051
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
5052
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
5053
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
5054
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
5055
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
5056
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
5057
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
5058
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
5059
|
+
[1m[35m (0.2ms)[0m SAVEPOINT active_record_1
|
5060
|
+
[1m[36mUser Exists (0.3ms)[0m [1mSELECT 1 AS one FROM "users" WHERE "users"."email" = 'rgonzalez@browseblab.com' LIMIT 1[0m
|
5061
|
+
[1m[35mSQL (0.5ms)[0m INSERT INTO "users" ("age", "email", "password") VALUES (?, ?, ?) [["age", 0], ["email", "rgonzalez@browseblab.com"], ["password", "nibh in"]]
|
5062
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
5063
|
+
Processing by UsersController#index as HTML
|
5064
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users"
|
5065
|
+
Completed 200 OK in 21ms (Views: 20.1ms | ActiveRecord: 0.2ms)
|
5066
|
+
[1m[36m (0.5ms)[0m [1mrollback transaction[0m
|
5067
|
+
[1m[35m (0.2ms)[0m begin transaction
|
5068
|
+
[1m[36m (0.2ms)[0m [1mrollback transaction[0m
|
5069
|
+
[1m[35m (0.2ms)[0m begin transaction
|
5070
|
+
[1m[36m (0.2ms)[0m [1mrollback transaction[0m
|
5071
|
+
[1m[35m (0.1ms)[0m begin transaction
|
5072
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
5073
|
+
[1m[35m (0.0ms)[0m begin transaction
|
5074
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
5075
|
+
[1m[35m (0.1ms)[0m begin transaction
|
5076
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awesome_translations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kasper Johansen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|