awesome_translations 0.0.2 → 0.0.3

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: eb9aa28cecb9db09e8e5b94091ee641118f753da
4
- data.tar.gz: 10209c2fad35cfebb5b404f3a037c437a180844a
3
+ metadata.gz: edc14b800bd267a02cb1107d191c60ff2fd5b327
4
+ data.tar.gz: 61084c5bb4ffab536c371abf1f26736fd51c54b1
5
5
  SHA512:
6
- metadata.gz: c5c58a3b8caeefb176258e7edc2dc6c310a65c984ce04c7886d2c25b55a69d20901a5c8ce61ebe8c43ace2d08421db038eeadd061b345338a3f7e74330b09e1a
7
- data.tar.gz: 7c0c29cb0deba63f6e46bc109fb4ba08317b155c20903d45a3958ebe12c5742f9d1aa9275d3151460e08651260063438926dc1b32042f6a87526e2badf6e7fe0
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
- translated_value = AwesomeTranslations::TranslatedValue.new(
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.
@@ -1,3 +1,3 @@
1
1
  module AwesomeTranslations
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -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"
@@ -4990,3 +4990,87 @@ Completed 200 OK in 5ms (Views: 4.9ms | ActiveRecord: 0.0ms)
4990
4990
   (0.2ms) rollback transaction
4991
4991
   (0.1ms) begin transaction
4992
4992
   (0.1ms) rollback transaction
4993
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
4994
+  (0.1ms) begin transaction
4995
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
4996
+  (0.1ms) rollback transaction
4997
+  (0.1ms) begin transaction
4998
+  (0.1ms) rollback transaction
4999
+  (0.0ms) begin transaction
5000
+  (0.1ms) rollback transaction
5001
+  (0.0ms) begin transaction
5002
+  (0.1ms) rollback transaction
5003
+  (0.0ms) begin transaction
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
+  (0.2ms) rollback transaction
5009
+  (0.1ms) begin transaction
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
+  (0.1ms) rollback transaction
5015
+  (0.0ms) begin transaction
5016
+  (0.1ms) rollback transaction
5017
+  (0.0ms) begin transaction
5018
+  (0.0ms) rollback transaction
5019
+  (0.0ms) begin transaction
5020
+ Processing by AwesomeTranslations::HandlersController#index as HTML
5021
+ Completed 200 OK in 9ms (Views: 9.1ms | ActiveRecord: 0.0ms)
5022
+  (0.1ms) rollback transaction
5023
+  (0.0ms) begin transaction
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
+  (0.2ms) rollback transaction
5028
+  (0.1ms) begin transaction
5029
+  (0.1ms) rollback transaction
5030
+  (0.1ms) begin transaction
5031
+  (0.1ms) rollback transaction
5032
+  (0.1ms) begin transaction
5033
+  (0.1ms) rollback transaction
5034
+  (0.1ms) begin transaction
5035
+  (0.1ms) rollback transaction
5036
+  (0.1ms) begin transaction
5037
+  (0.1ms) rollback transaction
5038
+  (0.1ms) begin transaction
5039
+  (0.1ms) rollback transaction
5040
+  (0.1ms) begin transaction
5041
+  (0.1ms) rollback transaction
5042
+  (0.1ms) begin transaction
5043
+  (0.2ms) rollback transaction
5044
+  (0.1ms) begin transaction
5045
+  (0.1ms) rollback transaction
5046
+  (0.2ms) begin transaction
5047
+  (0.1ms) rollback transaction
5048
+  (0.1ms) begin transaction
5049
+  (0.1ms) rollback transaction
5050
+  (0.2ms) begin transaction
5051
+  (0.1ms) rollback transaction
5052
+  (0.1ms) begin transaction
5053
+  (0.0ms) rollback transaction
5054
+  (0.2ms) begin transaction
5055
+  (0.1ms) rollback transaction
5056
+  (0.1ms) begin transaction
5057
+  (0.1ms) rollback transaction
5058
+  (0.1ms) begin transaction
5059
+  (0.2ms) SAVEPOINT active_record_1
5060
+ User Exists (0.3ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = 'rgonzalez@browseblab.com' LIMIT 1
5061
+ SQL (0.5ms) INSERT INTO "users" ("age", "email", "password") VALUES (?, ?, ?) [["age", 0], ["email", "rgonzalez@browseblab.com"], ["password", "nibh in"]]
5062
+  (0.1ms) RELEASE SAVEPOINT active_record_1
5063
+ Processing by UsersController#index as HTML
5064
+ User Load (0.2ms) SELECT "users".* FROM "users"
5065
+ Completed 200 OK in 21ms (Views: 20.1ms | ActiveRecord: 0.2ms)
5066
+  (0.5ms) rollback transaction
5067
+  (0.2ms) begin transaction
5068
+  (0.2ms) rollback transaction
5069
+  (0.2ms) begin transaction
5070
+  (0.2ms) rollback transaction
5071
+  (0.1ms) begin transaction
5072
+  (0.1ms) rollback transaction
5073
+  (0.0ms) begin transaction
5074
+  (0.1ms) rollback transaction
5075
+  (0.1ms) begin transaction
5076
+  (0.1ms) rollback transaction
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.2
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-02 00:00:00.000000000 Z
11
+ date: 2015-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails