tr8n 3.1.1 → 3.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -3
- data/.rspec +2 -0
- data/Gemfile +3 -6
- data/Gemfile.lock +21 -6
- data/README.rdoc +61 -33
- data/Rakefile +1 -11
- data/app/assets/images/tr8n/photo_system.gif +0 -0
- data/app/assets/stylesheets/tr8n/application.css +42 -1
- data/{test/dummy/app/assets/stylesheets/components.css.scss → app/assets/stylesheets/tr8n/component.css.scss} +0 -0
- data/{test/dummy/app/assets/stylesheets → app/assets/stylesheets/tr8n}/layout.css.scss +0 -0
- data/app/assets/stylesheets/tr8n/tr8n.css.scss +16 -8
- data/app/controllers/tr8n/admin/base_controller.rb +1 -1
- data/app/controllers/tr8n/admin/clientsdk_controller.rb +1 -1
- data/app/controllers/tr8n/admin/domain_controller.rb +1 -1
- data/app/controllers/tr8n/admin/forum_controller.rb +1 -1
- data/app/controllers/tr8n/admin/glossary_controller.rb +1 -1
- data/app/controllers/tr8n/admin/language_controller.rb +1 -1
- data/app/controllers/tr8n/admin/translation_controller.rb +1 -1
- data/app/controllers/tr8n/admin/translation_key_controller.rb +5 -1
- data/app/controllers/tr8n/admin/translator_controller.rb +1 -1
- data/app/{helpers/tr8n/application_helper.rb → controllers/tr8n/api/v1/sync_controller.rb} +6 -3
- data/app/controllers/tr8n/awards_controller.rb +12 -12
- data/app/controllers/tr8n/base_controller.rb +140 -137
- data/app/controllers/tr8n/dashboard_controller.rb +2 -1
- data/app/controllers/tr8n/forum_controller.rb +1 -1
- data/app/controllers/tr8n/glossary_controller.rb +1 -1
- data/app/controllers/tr8n/help_controller.rb +1 -1
- data/app/controllers/tr8n/language_cases_controller.rb +43 -45
- data/app/controllers/tr8n/language_controller.rb +1 -1
- data/app/controllers/tr8n/phrases_controller.rb +1 -1
- data/app/controllers/tr8n/translations_controller.rb +1 -1
- data/app/controllers/tr8n/translator_controller.rb +1 -1
- data/app/helpers/tr8n/base_helper.rb +0 -4
- data/app/models/tr8n/base_filter.rb +1 -1
- data/app/models/tr8n/daily_language_metric.rb +1 -1
- data/app/models/tr8n/date_rule.rb +1 -1
- data/app/models/tr8n/gender_list_rule.rb +1 -1
- data/app/models/tr8n/gender_rule.rb +1 -1
- data/app/models/tr8n/glossary.rb +1 -1
- data/app/models/tr8n/glossary_filter.rb +1 -1
- data/app/models/tr8n/integration/ru/russian_gender_list_rule.rb +1 -1
- data/app/models/tr8n/integration/ru/russian_numeric_rule.rb +1 -1
- data/app/models/tr8n/ip_location.rb +1 -1
- data/app/models/tr8n/ip_location_filter.rb +1 -1
- data/app/models/tr8n/language.rb +17 -8
- data/app/models/tr8n/language_case.rb +1 -1
- data/app/models/tr8n/language_case_filter.rb +1 -1
- data/app/models/tr8n/language_case_rule.rb +1 -1
- data/app/models/tr8n/language_case_rule_filter.rb +1 -1
- data/app/models/tr8n/language_case_value_map.rb +1 -1
- data/app/models/tr8n/language_case_value_map_filter.rb +1 -1
- data/app/models/tr8n/language_filter.rb +1 -1
- data/app/models/tr8n/language_forum_abuse_report.rb +1 -1
- data/app/models/tr8n/language_forum_abuse_report_filter.rb +1 -1
- data/app/models/tr8n/language_forum_message.rb +2 -2
- data/app/models/tr8n/language_forum_message_filter.rb +1 -1
- data/app/models/tr8n/language_forum_topic.rb +3 -3
- data/app/models/tr8n/language_forum_topic_filter.rb +1 -1
- data/app/models/tr8n/language_metric.rb +2 -2
- data/app/models/tr8n/language_metric_filter.rb +1 -1
- data/app/models/tr8n/language_rule.rb +37 -2
- data/app/models/tr8n/language_rule_filter.rb +1 -1
- data/app/models/tr8n/language_user.rb +3 -3
- data/app/models/tr8n/language_user_filter.rb +1 -1
- data/app/models/tr8n/list_rule.rb +1 -1
- data/app/models/tr8n/monthly_language_metric.rb +2 -2
- data/app/models/tr8n/numeric_rule.rb +1 -1
- data/app/models/tr8n/sync_log.rb +76 -0
- data/app/{controllers/tr8n/application_controller.rb → models/tr8n/sync_log_filter.rb} +4 -3
- data/app/models/tr8n/total_language_metric.rb +5 -4
- data/app/models/tr8n/translation.rb +61 -13
- data/app/models/tr8n/translation_domain.rb +1 -1
- data/app/models/tr8n/translation_domain_filter.rb +1 -1
- data/app/models/tr8n/translation_filter.rb +1 -1
- data/app/models/tr8n/translation_key.rb +33 -5
- data/app/models/tr8n/translation_key_comment.rb +1 -1
- data/app/models/tr8n/translation_key_comment_filter.rb +1 -1
- data/app/models/tr8n/translation_key_filter.rb +1 -1
- data/app/models/tr8n/translation_key_lock.rb +2 -2
- data/app/models/tr8n/translation_key_lock_filter.rb +1 -1
- data/app/models/tr8n/translation_key_source.rb +2 -2
- data/app/models/tr8n/translation_key_source_filter.rb +1 -1
- data/app/models/tr8n/translation_source.rb +2 -2
- data/app/models/tr8n/translation_source_filter.rb +1 -1
- data/app/models/tr8n/translation_vote.rb +3 -4
- data/app/models/tr8n/translation_vote_filter.rb +1 -1
- data/app/models/tr8n/translator.rb +19 -5
- data/app/models/tr8n/translator_filter.rb +1 -1
- data/app/models/tr8n/translator_following.rb +2 -2
- data/app/models/tr8n/translator_following_filter.rb +1 -1
- data/app/models/tr8n/translator_log.rb +1 -1
- data/app/models/tr8n/translator_log_filter.rb +1 -1
- data/app/models/tr8n/translator_metric.rb +15 -21
- data/app/models/tr8n/translator_metric_filter.rb +1 -1
- data/app/models/tr8n/translator_report.rb +2 -2
- data/app/models/tr8n/translator_report_filter.rb +1 -1
- data/app/models/tr8n/value_rule.rb +1 -1
- data/app/views/tr8n/admin/common/_paginator.html.erb +29 -17
- data/app/views/tr8n/admin/translation_key/_tabs.html.erb +3 -1
- data/app/views/tr8n/admin/translation_key/sync_logs.html.erb +5 -0
- data/app/views/tr8n/awards/index.html.erb +0 -2
- data/app/views/tr8n/common/_paginator.html.erb +24 -6
- data/app/views/tr8n/common/_tabs.html.erb +9 -5
- data/app/views/tr8n/forum/_messages.html.erb +1 -1
- data/app/views/tr8n/forum/index.html.erb +1 -1
- data/app/views/tr8n/glossary/index.html.erb +2 -2
- data/app/views/tr8n/{home → help}/credits.html.erb +0 -0
- data/app/views/tr8n/{home → help}/license.html.erb +0 -0
- data/app/views/tr8n/language_cases/index.html.erb +2 -2
- data/app/views/tr8n/phrases/_comments_module.html.erb +1 -1
- data/app/views/tr8n/phrases/index.html.erb +2 -6
- data/app/views/tr8n/translations/_list.html.erb +2 -6
- data/config/routes.rb +2 -2
- data/config/tr8n/config.yml +48 -13
- data/config/tr8n/rules/default_language_cases.yml +272 -0
- data/config/tr8n/tokens/data.yml +3 -1
- data/db/migrate/20111003194443_create_tr8n_sync_tables.rb +22 -0
- data/db/migrate/20111011013640_add_remote_id_to_tr8n_translators.rb +5 -0
- data/doc/classes.graffle +7049 -5152
- data/doc/classes.pdf +0 -0
- data/lib/generators/tr8n/templates/{create_tr8n_tables.rb → db/create_tr8n_tables.rb} +0 -0
- data/lib/generators/tr8n/templates/layouts/tr8n.html.erb +49 -0
- data/lib/generators/tr8n/templates/layouts/tr8n_admin.html.erb +61 -0
- data/lib/generators/tr8n/tr8n_generator.rb +11 -4
- data/lib/tasks/{tr8n_tasks.rake → tr8n.rake} +4 -0
- data/{app/controllers/tr8n/home_controller.rb → lib/tr8n/cache_adapters/memcached.rb} +12 -15
- data/lib/tr8n/config.rb +96 -53
- data/lib/tr8n/extensions/action_controller_extension.rb +1 -1
- data/lib/tr8n/extensions/action_view_extension.rb +4 -28
- data/lib/tr8n/tokens/data_token.rb +1 -1
- data/lib/tr8n/tokens/method_token.rb +1 -1
- data/lib/tr8n/tokens/transform_token.rb +1 -1
- data/lib/tr8n/version.rb +1 -1
- data/{test/dummy → local/tr8n_server}/Rakefile +1 -1
- data/{test/dummy → local/tr8n_server}/app/assets/javascripts/application.js +0 -0
- data/{test/dummy → local/tr8n_server}/app/assets/stylesheets/admin.css +0 -0
- data/{test/dummy → local/tr8n_server}/app/assets/stylesheets/application.css +0 -0
- data/local/tr8n_server/app/assets/stylesheets/components.css.scss +211 -0
- data/local/tr8n_server/app/assets/stylesheets/layout.css.scss +143 -0
- data/{test/dummy → local/tr8n_server}/app/controllers/admin/admins_controller.rb +0 -0
- data/{test/dummy → local/tr8n_server}/app/controllers/admin/base_controller.rb +0 -0
- data/{test/dummy → local/tr8n_server}/app/controllers/admin/users_controller.rb +0 -0
- data/{test/dummy → local/tr8n_server}/app/controllers/application_controller.rb +5 -0
- data/{test/dummy → local/tr8n_server}/app/controllers/demo_controller.rb +0 -0
- data/local/tr8n_server/app/controllers/home_controller.rb +4 -0
- data/{test/dummy → local/tr8n_server}/app/controllers/login_controller.rb +1 -1
- data/{test/dummy → local/tr8n_server}/app/helpers/application_helper.rb +0 -0
- data/{test/dummy → local/tr8n_server}/app/helpers/home_helper.rb +0 -0
- data/{test/dummy → local/tr8n_server}/app/mailers/.gitkeep +0 -0
- data/{test/dummy → local/tr8n_server}/app/models/.gitkeep +0 -0
- data/{test/dummy → local/tr8n_server}/app/models/admin.rb +0 -0
- data/{test/dummy → local/tr8n_server}/app/models/admin_filter.rb +0 -0
- data/{test/dummy → local/tr8n_server}/app/models/user.rb +0 -0
- data/{test/dummy → local/tr8n_server}/app/views/admin/admins/index.html.erb +0 -0
- data/{test/dummy → local/tr8n_server}/app/views/admin/users/index.html.erb +0 -0
- data/{test/dummy → local/tr8n_server}/app/views/demo/index.rhtml +0 -0
- data/{test/dummy → local/tr8n_server}/app/views/demo/tokens.rhtml +0 -0
- data/{app/views/tr8n → local/tr8n_server/app/views}/home/index.html.erb +1 -2
- data/local/tr8n_server/app/views/kaminari/_first_page.html.erb +11 -0
- data/local/tr8n_server/app/views/kaminari/_gap.html.erb +8 -0
- data/local/tr8n_server/app/views/kaminari/_last_page.html.erb +11 -0
- data/local/tr8n_server/app/views/kaminari/_next_page.html.erb +11 -0
- data/local/tr8n_server/app/views/kaminari/_page.html.erb +12 -0
- data/local/tr8n_server/app/views/kaminari/_paginator.html.erb +23 -0
- data/local/tr8n_server/app/views/kaminari/_prev_page.html.erb +11 -0
- data/{test/dummy → local/tr8n_server}/app/views/layouts/_flashes.html.erb +0 -0
- data/{test/dummy → local/tr8n_server}/app/views/layouts/_footer.html.erb +3 -3
- data/{test/dummy → local/tr8n_server}/app/views/layouts/_header.html.erb +1 -1
- data/{test/dummy → local/tr8n_server}/app/views/layouts/admin.html.erb +0 -0
- data/{test/dummy → local/tr8n_server}/app/views/layouts/application.html.erb +0 -0
- data/local/tr8n_server/app/views/layouts/tr8n.html.erb +51 -0
- data/local/tr8n_server/app/views/layouts/tr8n_admin.html.erb +61 -0
- data/{test/dummy → local/tr8n_server}/app/views/login/index.html.erb +0 -0
- data/{test/dummy → local/tr8n_server}/app/views/login/register.html.erb +8 -13
- data/{test/dummy → local/tr8n_server}/config.ru +1 -1
- data/{test/dummy → local/tr8n_server}/config/application.rb +2 -1
- data/{test/dummy → local/tr8n_server}/config/boot.rb +0 -0
- data/{test/dummy → local/tr8n_server}/config/database.yml +0 -0
- data/{test/dummy → local/tr8n_server}/config/environment.rb +1 -1
- data/{test/dummy → local/tr8n_server}/config/environments/development.rb +3 -1
- data/{test/dummy → local/tr8n_server}/config/environments/production.rb +1 -1
- data/{test/dummy → local/tr8n_server}/config/environments/test.rb +1 -1
- data/{test/dummy → local/tr8n_server}/config/initializers/backtrace_silencers.rb +0 -0
- data/{test/dummy → local/tr8n_server}/config/initializers/inflections.rb +0 -0
- data/{test/dummy → local/tr8n_server}/config/initializers/mime_types.rb +0 -0
- data/{test/dummy → local/tr8n_server}/config/initializers/secret_token.rb +1 -1
- data/{test/dummy → local/tr8n_server}/config/initializers/session_store.rb +2 -2
- data/{test/dummy → local/tr8n_server}/config/initializers/wrap_parameters.rb +0 -0
- data/{test/dummy → local/tr8n_server}/config/locales/en.yml +0 -0
- data/{test/dummy → local/tr8n_server}/config/routes.rb +2 -2
- data/{test/dummy → local/tr8n_server}/config/tr8n/config.yml +40 -11
- data/{test/dummy → local/tr8n_server}/config/tr8n/data/ip_locations.csv +0 -0
- data/{test/dummy → local/tr8n_server}/config/tr8n/rules/default_date_rules.yml +0 -0
- data/{test/dummy → local/tr8n_server}/config/tr8n/rules/default_gender_list_rules.yml +0 -0
- data/{test/dummy → local/tr8n_server}/config/tr8n/rules/default_gender_rules.yml +0 -0
- data/local/tr8n_server/config/tr8n/rules/default_language_cases.yml +272 -0
- data/{test/dummy → local/tr8n_server}/config/tr8n/rules/default_list_rules.yml +0 -0
- data/{test/dummy → local/tr8n_server}/config/tr8n/rules/default_numeric_rules.yml +0 -0
- data/{test/dummy → local/tr8n_server}/config/tr8n/rules/default_value_rules.yml +0 -0
- data/{test/dummy → local/tr8n_server}/config/tr8n/site/default_glossary.yml +0 -0
- data/{test/dummy → local/tr8n_server}/config/tr8n/site/default_languages.yml +0 -0
- data/{test/dummy → local/tr8n_server}/config/tr8n/site/features.yml +0 -0
- data/{test/dummy → local/tr8n_server}/config/tr8n/site/shortcuts.yml +0 -0
- data/{test/dummy → local/tr8n_server}/config/tr8n/site/sitemap.json +0 -0
- data/{test/dummy → local/tr8n_server}/config/tr8n/tokens/data.yml +2 -0
- data/{test/dummy → local/tr8n_server}/config/tr8n/tokens/decorations.yml +0 -0
- data/{test/dummy → local/tr8n_server}/config/will_filter/config.yml +0 -0
- data/{test/dummy → local/tr8n_server}/db/migrate/20101207014543_create_users.rb +0 -0
- data/{test/dummy → local/tr8n_server}/db/migrate/20110113223509_create_admins.rb +0 -0
- data/{test/dummy → local/tr8n_server}/db/migrate/20110930041143_create_will_filter_filters.rb +0 -0
- data/{test/dummy → local/tr8n_server}/db/migrate/20110930041150_create_tr8n_tables.rb +0 -0
- data/local/tr8n_server/db/migrate/20111003194443_create_tr8n_sync_tables.rb +22 -0
- data/local/tr8n_server/db/migrate/20111011013640_add_remote_id_to_tr8n_translators.rb +5 -0
- data/{test/dummy → local/tr8n_server}/db/schema.rb +15 -1
- data/{test/dummy → local/tr8n_server}/lib/assets/.gitkeep +0 -0
- data/{test/dummy → local/tr8n_server}/public/404.html +0 -0
- data/{test/dummy → local/tr8n_server}/public/422.html +0 -0
- data/{test/dummy → local/tr8n_server}/public/500.html +0 -0
- data/{test/dummy → local/tr8n_server}/public/favicon.ico +0 -0
- data/{test/dummy → local/tr8n_server}/script/rails +0 -0
- data/script/rails +1 -1
- data/spec/config/config_spec.rb +10 -0
- data/spec/fake_app.rb +50 -0
- data/spec/lib/data_token_spec.rb +26 -0
- data/spec/lib/transform_token_spec.rb +22 -0
- data/spec/models/translation_key_spec.rb +63 -0
- data/spec/spec_helper.rb +29 -0
- data/tr8n.gemspec +3 -1
- metadata +264 -245
- data/app/assets/images/tr8n/tr8n_logo.png +0 -0
- data/app/assets/images/tr8n/tr8n_logo2.gif +0 -0
- data/app/controllers/tr8n/login_controller.rb +0 -86
- data/app/views/layouts/_footer.html.erb +0 -15
- data/app/views/layouts/_header.html.erb +0 -12
- data/app/views/layouts/_html_head.html.erb +0 -5
- data/app/views/layouts/tr8n.html.erb +0 -21
- data/app/views/layouts/tr8n/application.html.erb +0 -14
- data/app/views/layouts/tr8n_admin.html.erb +0 -33
- data/app/views/tr8n/home/languages.html.erb +0 -7
- data/app/views/tr8n/login/index.html.erb +0 -33
- data/app/views/tr8n/login/register.html.erb +0 -57
- data/config/tr8n/rules/default_cases.yml +0 -141
- data/test/dummy/.sass-cache/32be4db30d38349a3a6e662df9bb5599dc8033b9/actions.css.scssc +0 -0
- data/test/dummy/.sass-cache/32be4db30d38349a3a6e662df9bb5599dc8033b9/buttons.css.scssc +0 -0
- data/test/dummy/.sass-cache/32be4db30d38349a3a6e662df9bb5599dc8033b9/calendar.css.scssc +0 -0
- data/test/dummy/.sass-cache/32be4db30d38349a3a6e662df9bb5599dc8033b9/exporter.css.scssc +0 -0
- data/test/dummy/.sass-cache/32be4db30d38349a3a6e662df9bb5599dc8033b9/filter.css.scssc +0 -0
- data/test/dummy/.sass-cache/32be4db30d38349a3a6e662df9bb5599dc8033b9/results.css.scssc +0 -0
- data/test/dummy/.sass-cache/3d45bab40fcae805deb2750a9342f5b355a9f2bf/components.css.scssc +0 -0
- data/test/dummy/.sass-cache/3d45bab40fcae805deb2750a9342f5b355a9f2bf/layout.css.scssc +0 -0
- data/test/dummy/.sass-cache/50f723c1dd802042d0091035528d53e6d5bc5b50/tr8n.css.scssc +0 -0
- data/test/dummy/.sass-cache/bce64928c8e2edcba72a647a44f05af1ff119c5d/actions.css.scssc +0 -0
- data/test/dummy/.sass-cache/bce64928c8e2edcba72a647a44f05af1ff119c5d/buttons.css.scssc +0 -0
- data/test/dummy/.sass-cache/bce64928c8e2edcba72a647a44f05af1ff119c5d/calendar.css.scssc +0 -0
- data/test/dummy/.sass-cache/bce64928c8e2edcba72a647a44f05af1ff119c5d/exporter.css.scssc +0 -0
- data/test/dummy/.sass-cache/bce64928c8e2edcba72a647a44f05af1ff119c5d/filter.css.scssc +0 -0
- data/test/dummy/.sass-cache/bce64928c8e2edcba72a647a44f05af1ff119c5d/results.css.scssc +0 -0
- data/test/dummy/app/assets/stylesheets/keyboard.css +0 -147
- data/test/dummy/config/tr8n/rules/default_cases.yml +0 -141
- data/test/dummy/log/.gitkeep +0 -0
- data/test/dummy/test/functional/home_controller_test.rb +0 -9
- data/test/dummy/test/unit/helpers/home_helper_test.rb +0 -4
- data/test/integration/navigation_test.rb +0 -10
- data/test/test_helper.rb +0 -10
- data/test/tr8n_test.rb +0 -7
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2010-2011 Michael Berkovich
|
2
|
+
# Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
# a copy of this software and associated documentation files (the
|
@@ -38,7 +38,7 @@ class Tr8n::TranslationSource < ActiveRecord::Base
|
|
38
38
|
def self.find_or_create(source, url)
|
39
39
|
translation_domain = Tr8n::TranslationDomain.find_or_create(url)
|
40
40
|
Tr8n::Cache.fetch("translation_source_#{translation_domain.id}_#{source}") do
|
41
|
-
translation_source =
|
41
|
+
translation_source = where("source = ? and translation_domain_id = ?", source, translation_domain.id).first
|
42
42
|
translation_source ||= create(:source => source, :translation_domain => translation_domain)
|
43
43
|
translation_source.update_attributes(:translation_domain => translation_domain) unless translation_source.translation_domain
|
44
44
|
translation_source
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2010-2011 Michael Berkovich
|
2
|
+
# Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
# a copy of this software and associated documentation files (the
|
@@ -28,9 +28,8 @@ class Tr8n::TranslationVote < ActiveRecord::Base
|
|
28
28
|
belongs_to :translator, :class_name => "Tr8n::Translator"
|
29
29
|
|
30
30
|
def self.find_or_create(translation, translator)
|
31
|
-
vote =
|
32
|
-
vote
|
33
|
-
vote
|
31
|
+
vote = where("translation_id = ? and translator_id = ?", translation.id, translator.id).first
|
32
|
+
vote ||= create(:translation => translation, :translator => translator, :vote => 0)
|
34
33
|
end
|
35
34
|
|
36
35
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2010-2011 Michael Berkovich
|
2
|
+
# Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
# a copy of this software and associated documentation files (the
|
@@ -53,7 +53,7 @@ class Tr8n::Translator < ActiveRecord::Base
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def self.find_or_create(user)
|
56
|
-
trn =
|
56
|
+
trn = where(:user_id => user.id).first
|
57
57
|
trn = create(:user => user) unless trn
|
58
58
|
trn
|
59
59
|
end
|
@@ -62,7 +62,7 @@ class Tr8n::Translator < ActiveRecord::Base
|
|
62
62
|
return unless user
|
63
63
|
|
64
64
|
translator = Tr8n::Translator.find_or_create(user)
|
65
|
-
Tr8n::LanguageUser.
|
65
|
+
Tr8n::LanguageUser.where(:user_id => user.id).each do |lu|
|
66
66
|
lu.update_attributes(:translator => translator)
|
67
67
|
end
|
68
68
|
translator
|
@@ -195,11 +195,21 @@ class Tr8n::Translator < ActiveRecord::Base
|
|
195
195
|
false
|
196
196
|
end
|
197
197
|
|
198
|
+
def system?
|
199
|
+
level == Tr8n::Config.system_level
|
200
|
+
end
|
201
|
+
|
202
|
+
def application?
|
203
|
+
level == Tr8n::Config.application_level
|
204
|
+
end
|
205
|
+
|
198
206
|
def last_logs
|
199
|
-
Tr8n::TranslatorLog.
|
207
|
+
Tr8n::TranslatorLog.where("translator_id = ?", self.id).order("created_at desc").limit(20)
|
200
208
|
end
|
201
209
|
|
202
210
|
def name
|
211
|
+
return "Tr8n Network" if system?
|
212
|
+
|
203
213
|
unless Tr8n::Config.site_user_info_enabled?
|
204
214
|
translator_name = super
|
205
215
|
return translator_name unless translator_name.blank?
|
@@ -214,6 +224,8 @@ class Tr8n::Translator < ActiveRecord::Base
|
|
214
224
|
end
|
215
225
|
|
216
226
|
def gender
|
227
|
+
return "unknown" if system?
|
228
|
+
|
217
229
|
unless Tr8n::Config.site_user_info_enabled?
|
218
230
|
translator_gender = super
|
219
231
|
return translator_gender unless translator_gender.blank?
|
@@ -224,6 +236,8 @@ class Tr8n::Translator < ActiveRecord::Base
|
|
224
236
|
end
|
225
237
|
|
226
238
|
def mugshot
|
239
|
+
return Tr8n::Config.system_image if system?
|
240
|
+
|
227
241
|
return super unless Tr8n::Config.site_user_info_enabled?
|
228
242
|
return Tr8n::Config.silhouette_image unless user
|
229
243
|
img_url = Tr8n::Config.user_mugshot(user)
|
@@ -268,7 +282,7 @@ class Tr8n::Translator < ActiveRecord::Base
|
|
268
282
|
end
|
269
283
|
|
270
284
|
def unfollow(object)
|
271
|
-
tf = Tr8n::TranslatorFollowing.
|
285
|
+
tf = Tr8n::TranslatorFollowing.where("object_type = ? and object_id = ?", object.class.name, object.id).first
|
272
286
|
tf.destroy if tf
|
273
287
|
end
|
274
288
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2010-2011 Michael Berkovich
|
2
|
+
# Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
# a copy of this software and associated documentation files (the
|
@@ -32,7 +32,7 @@ class Tr8n::TranslatorFollowing < ActiveRecord::Base
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def self.following_for(translator, object)
|
35
|
-
|
35
|
+
where("translator_id = ? and object_type = ? and object_id = ?", translator.id, object.class.name, object.id).first
|
36
36
|
end
|
37
37
|
|
38
38
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2010-2011 Michael Berkovich
|
2
|
+
# Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
# a copy of this software and associated documentation files (the
|
@@ -27,30 +27,25 @@ class Tr8n::TranslatorMetric < ActiveRecord::Base
|
|
27
27
|
belongs_to :translator, :class_name => "Tr8n::Translator"
|
28
28
|
belongs_to :language, :class_name => "Tr8n::Language"
|
29
29
|
|
30
|
-
def self.find_or_create(translator, language)
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
tm = find(:first, :conditions => ["translator_id = ? and language_id is null", translator.id])
|
35
|
-
end
|
30
|
+
def self.find_or_create(translator, language = nil)
|
31
|
+
tm = where("translator_id = ?", translator.id)
|
32
|
+
tm = where("language_id = ?", language.id) if language
|
33
|
+
return tm.first if tm.first
|
36
34
|
|
37
|
-
return tm if tm
|
38
35
|
create(:translator => translator, :language => language, :total_translations => 0, :total_votes => 0, :positive_votes => 0, :negative_votes => 0)
|
39
36
|
end
|
40
37
|
|
41
38
|
# updated when an action is done by the translator
|
42
39
|
def update_metrics!
|
43
40
|
if language
|
44
|
-
self.total_translations = Tr8n::Translation.
|
45
|
-
self.total_votes = Tr8n::TranslationVote.
|
46
|
-
|
47
|
-
self.positive_votes = Tr8n::TranslationVote.count(:conditions=>["tr8n_translation_votes.translator_id = ? and tr8n_translation_votes.vote > 0 and tr8n_translations.language_id = ?", translator.id, language.id],
|
48
|
-
:joins => "INNER JOIN tr8n_translations ON tr8n_translations.id = tr8n_translation_votes.translation_id")
|
41
|
+
self.total_translations = Tr8n::Translation.where("translator_id = ? and language_id = ?", translator.id, language.id).count
|
42
|
+
self.total_votes = Tr8n::TranslationVote.where("tr8n_translation_votes.translator_id = ? and tr8n_translations.language_id = ?", translator.id, language.id).joins(:translation).count
|
43
|
+
self.positive_votes = Tr8n::TranslationVote.where("tr8n_translation_votes.translator_id = ? and tr8n_translation_votes.vote > 0 and tr8n_translations.language_id = ?", translator.id, language.id).joins(:translation).count
|
49
44
|
self.negative_votes = self.total_votes - self.positive_votes
|
50
45
|
else
|
51
|
-
self.total_translations = Tr8n::Translation.
|
52
|
-
self.total_votes = Tr8n::TranslationVote.
|
53
|
-
self.positive_votes = Tr8n::TranslationVote.
|
46
|
+
self.total_translations = Tr8n::Translation.where("translator_id = ?", translator.id).count
|
47
|
+
self.total_votes = Tr8n::TranslationVote.where("translator_id = ?", translator.id).count
|
48
|
+
self.positive_votes = Tr8n::TranslationVote.where("translator_id = ? and vote > 0", translator.id).count
|
54
49
|
self.negative_votes = self.total_votes - self.positive_votes
|
55
50
|
end
|
56
51
|
|
@@ -60,11 +55,11 @@ class Tr8n::TranslatorMetric < ActiveRecord::Base
|
|
60
55
|
# updated when an action is done to the translator's translations
|
61
56
|
def update_rank!
|
62
57
|
if language
|
63
|
-
self.accepted_translations = Tr8n::Translation.
|
64
|
-
self.rejected_translations = Tr8n::Translation.
|
58
|
+
self.accepted_translations = Tr8n::Translation.where("translator_id = ? and language_id = ? and rank >= ?", translator.id, language.id, Tr8n::Config.translation_threshold).count
|
59
|
+
self.rejected_translations = Tr8n::Translation.where("translator_id = ? and language_id = ? and rank < ?", translator.id, language.id, 0).count
|
65
60
|
else
|
66
|
-
self.accepted_translations = Tr8n::Translation.
|
67
|
-
self.rejected_translations = Tr8n::Translation.
|
61
|
+
self.accepted_translations = Tr8n::Translation.where("translator_id = ? and rank >= ?", translator.id, Tr8n::Config.translation_threshold).count
|
62
|
+
self.rejected_translations = Tr8n::Translation.where("translator_id = ? and rank < ?", translator.id, 0).count
|
68
63
|
end
|
69
64
|
|
70
65
|
save
|
@@ -72,7 +67,6 @@ class Tr8n::TranslatorMetric < ActiveRecord::Base
|
|
72
67
|
|
73
68
|
def rank
|
74
69
|
return 0 unless total_translations and accepted_translations
|
75
|
-
|
76
70
|
total_translations == 0 ? 0 : (accepted_translations * 100.0/total_translations)
|
77
71
|
end
|
78
72
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2010-2011 Michael Berkovich
|
2
|
+
# Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
# a copy of this software and associated documentation files (the
|
@@ -32,7 +32,7 @@ class Tr8n::TranslatorReport < ActiveRecord::Base
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def self.report_for(translator, object)
|
35
|
-
|
35
|
+
self.where("translator_id = ? and object_type = ? and object_id = ?", translator.id, object.class.name, object.id).first
|
36
36
|
end
|
37
37
|
|
38
38
|
def self.title_for(object)
|
@@ -1,20 +1,32 @@
|
|
1
|
-
<div>
|
2
|
-
<table style="
|
1
|
+
<div style="padding-bottom:10px;padding-top:5px;">
|
2
|
+
<table style="width:100%;">
|
3
3
|
<tr>
|
4
|
-
<td style="text-align:left; vertical-align:top;font-size:11px; font-family:arial;"
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
4
|
+
<td style="text-align:left; vertical-align:top;font-size:11px; font-family:arial;">
|
5
|
+
<%
|
6
|
+
entry_name = options[:subject] || (collection.empty? ? 'entry' : collection.first.class.name.underscore.gsub('_', ' '))
|
7
|
+
output = ""
|
8
|
+
if collection.num_pages < 2
|
9
|
+
case collection.size
|
10
|
+
when 0
|
11
|
+
output = tr("None found", "Paginator message", {}, options)
|
12
|
+
when 1
|
13
|
+
output = tr("Displaying [bold: 1] #{entry_name}", "Paginator message", {}, options)
|
14
|
+
else
|
15
|
+
output = tr("Displaying [bold: all {count}] #{entry_name.pluralize}", "Paginator message", {:count => collection.size}, options)
|
16
|
+
end
|
17
|
+
else
|
18
|
+
output = tr("Displaying #{entry_name.pluralize} [bold: {start_num} - {end_num}] of [bold: {total_count}] in total",
|
19
|
+
"Paginator message", {
|
20
|
+
:start_num => collection.offset_num + 1,
|
21
|
+
:end_num => collection.offset_num + collection.length,
|
22
|
+
:total_count => collection.total_num
|
23
|
+
}, options
|
24
|
+
)
|
25
|
+
end
|
26
|
+
%>
|
27
|
+
<%= output %>
|
28
|
+
</td>
|
29
|
+
<td style="text-align:right; vertical-align:top; font-size:11px; font-family:arial;"><%= paginate(collection) %></td>
|
18
30
|
</tr>
|
19
31
|
</table>
|
20
|
-
</div>
|
32
|
+
</div>
|
@@ -3,7 +3,9 @@
|
|
3
3
|
current_tab ||= ""
|
4
4
|
[["Translation Keys", {:action => :index}],
|
5
5
|
["Comments", {:action => :comments}],
|
6
|
-
["Locks", {:action => :locks}]
|
6
|
+
["Locks", {:action => :locks}],
|
7
|
+
["Sync Logs", {:action => :sync_logs}]
|
8
|
+
].each do |link|
|
7
9
|
if controller.action_name == link.last[:action].to_s
|
8
10
|
current_tab = link.first if current_tab.blank?
|
9
11
|
links << link.first
|
@@ -4,13 +4,11 @@
|
|
4
4
|
|
5
5
|
<div class="section_title">
|
6
6
|
<div style="float:right; font-size:12px; padding-top:5px;">
|
7
|
-
<% unless tr8n_current_language.default? %>
|
8
7
|
<% if params[:mode] == "all" %>
|
9
8
|
<%=link_to(tra("Awards for {language} Language", 'Awards section header', :language => tr8n_current_language.native_name), :mode => :current) %>
|
10
9
|
<% else %>
|
11
10
|
<%=link_to(tra("Awards for All Languages", 'Awards section header'), :mode => :all) %>
|
12
11
|
<% end %>
|
13
|
-
<% end %>
|
14
12
|
</div>
|
15
13
|
|
16
14
|
<% if params[:mode] == "all" %>
|
@@ -2,13 +2,31 @@
|
|
2
2
|
<table style="width:100%;">
|
3
3
|
<tr>
|
4
4
|
<td style="text-align:left; vertical-align:top;font-size:11px; font-family:arial;">
|
5
|
-
<%
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
<%
|
6
|
+
entry_name = options[:subject] || (collection.empty? ? 'entry' : collection.first.class.name.underscore.gsub('_', ' '))
|
7
|
+
output = ""
|
8
|
+
if collection.num_pages < 2
|
9
|
+
case collection.size
|
10
|
+
when 0
|
11
|
+
output = tr("None found", "Paginator message", {}, options)
|
12
|
+
when 1
|
13
|
+
output = tr("Displaying [bold: 1] #{entry_name}", "Paginator message", {}, options)
|
14
|
+
else
|
15
|
+
output = tr("Displaying [bold: all {count}] #{entry_name.pluralize}", "Paginator message", {:count => collection.size}, options)
|
16
|
+
end
|
17
|
+
else
|
18
|
+
output = tr("Displaying #{entry_name.pluralize} [bold: {start_num} - {end_num}] of [bold: {total_count}] in total",
|
19
|
+
"Paginator message", {
|
20
|
+
:start_num => collection.offset_value + 1,
|
21
|
+
:end_num => collection.offset_value + collection.length,
|
22
|
+
:total_count => collection.total_count
|
23
|
+
}, options
|
24
|
+
)
|
25
|
+
end
|
26
|
+
%>
|
27
|
+
<%= output %>
|
10
28
|
</td>
|
11
|
-
<td style="text-align:right; vertical-align:top; font-size:11px; font-family:arial;"><%= paginate(
|
29
|
+
<td style="text-align:right; vertical-align:top; font-size:11px; font-family:arial;"><%= paginate(collection) %></td>
|
12
30
|
</tr>
|
13
31
|
</table>
|
14
32
|
</div>
|
@@ -1,11 +1,15 @@
|
|
1
1
|
<div class="translations_navigation">
|
2
2
|
<div style="font-size:22px; font-weight: bold;padding-bottom:15px;">
|
3
3
|
<%=tra("Translation Tools", "Tabs header") %>
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
- <%=tra("{language} Language", nil, :language => tr8n_current_language.native_name)%>
|
5
|
+
<% if tr8n_current_language.default? %>
|
6
|
+
<% if tr8n_current_user_is_admin? %>
|
7
|
+
<%=link_to(tra("manage", "Link to management section"), "/tr8n/language", :style => "font-size:12px;")%>
|
8
|
+
<% end %>
|
9
|
+
<% else %>
|
10
|
+
<% if tr8n_current_user_is_manager? %>
|
11
|
+
<%=link_to(tra("manage", "Link to management section"), "/tr8n/language", :style => "font-size:12px;")%>
|
12
|
+
<% end %>
|
9
13
|
<% end %>
|
10
14
|
</div>
|
11
15
|
|
@@ -15,7 +15,7 @@
|
|
15
15
|
</div>
|
16
16
|
|
17
17
|
<div class="section">
|
18
|
-
|
18
|
+
<%= tr8n_paginator_tag(@terms, :subject => 'term') %>
|
19
19
|
|
20
20
|
<table style="width:100%">
|
21
21
|
<tr style="border-bottom:1px solid #ccc;">
|
@@ -34,7 +34,7 @@
|
|
34
34
|
<% end %>
|
35
35
|
</table>
|
36
36
|
|
37
|
-
|
37
|
+
<%= tr8n_paginator_tag(@terms, :subject => 'term') %>
|
38
38
|
</div>
|
39
39
|
|
40
40
|
<%= render :partial => "/tr8n/common/footer" %>
|