translation_center 1.7.2 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +38 -2
  3. data/Rakefile +8 -13
  4. data/app/assets/javascripts/translation_center/application.js +1 -1
  5. data/app/assets/stylesheets/translation_center/application.css +1 -1
  6. data/app/assets/stylesheets/translation_center/translation_keys.css +3 -1
  7. data/app/controllers/translation_center/application_controller.rb +2 -2
  8. data/app/controllers/translation_center/translation_keys_controller.rb +4 -4
  9. data/app/models/translation_center/activity_query.rb +2 -3
  10. data/app/models/translation_center/category.rb +7 -2
  11. data/app/models/translation_center/translation.rb +54 -32
  12. data/app/models/translation_center/translation_key.rb +29 -18
  13. data/app/views/layouts/translation_center/application.html.haml +0 -2
  14. data/app/views/translation_center/translation_keys/_translation_keys.html.haml +3 -1
  15. data/app/views/translation_center/translations/_show.html.haml +3 -3
  16. data/config/routes.rb +3 -3
  17. data/db/development.sqlite3 +0 -0
  18. data/{test/dummy/db/migrate/20130410082611_devise_create_users.rb → db/migrate/20130410082600_devise_create_users.rb} +0 -0
  19. data/{test/dummy/db/migrate/20130410082701_create_articles.rb → db/migrate/20130410082601_create_articles.rb} +0 -0
  20. data/{test/dummy/db/migrate/20130410084711234392_create_translation_center_categories.rb → db/migrate/20130410084602_create_translation_center_categories.rb} +0 -0
  21. data/{test/dummy/db/migrate/20130410084711235054_create_translation_center_translation_keys.rb → db/migrate/20130410084603_create_translation_center_translation_keys.rb} +0 -0
  22. data/{test/dummy/db/migrate/20130410084711235601_create_translation_center_translations.rb → db/migrate/20130410084604_create_translation_center_translations.rb} +0 -0
  23. data/{test/dummy/db/migrate/20130410084711_acts_as_votable_migration.rb → db/migrate/20130410084605_acts_as_votable_migration.rb} +1 -0
  24. data/{test/dummy/db/migrate/20130410084711235602_install_audited.rb → db/migrate/20130410084606_install_audited.rb} +0 -0
  25. data/{test/dummy/db/migrate/20130410113111070575_add_de_status_translation_center_translation_keys.rb → db/migrate/20130410113607_add_de_status_translation_center_translation_keys.rb} +0 -0
  26. data/{test/dummy/db/migrate/20130417134539377014_add_ar_status_translation_center_translation_keys.rb → db/migrate/20130417134608_add_ar_status_translation_center_translation_keys.rb} +0 -0
  27. data/{test/dummy/db/migrate/20130506103956_fix_translation_user_relation.rb → db/migrate/20130506103609_fix_translation_user_relation.rb} +0 -0
  28. data/{test/dummy/db/migrate/20130801102022_add_indicies.rb → db/migrate/20130801102610_add_indicies.rb} +0 -0
  29. data/{test/dummy/db → db}/schema.rb +13 -13
  30. data/{test/dummy/public/favicon.ico → db/test.sqlite3} +0 -0
  31. data/lib/generators/translation_center/add_lang/add_lang_generator.rb +5 -2
  32. data/lib/generators/translation_center/install/install_generator.rb +4 -4
  33. data/lib/translation_center/acts_as_translator.rb +1 -1
  34. data/lib/translation_center/engine.rb +7 -0
  35. data/lib/translation_center/translation_helpers.rb +1 -1
  36. data/lib/translation_center/translations_transfer.rb +6 -5
  37. data/lib/translation_center/version.rb +1 -1
  38. data/spec/controllers/categories_controller_spec.rb +47 -0
  39. data/spec/controllers/center_controller_spec.rb +77 -0
  40. data/spec/controllers/translation_keys_controller_spec.rb +87 -0
  41. data/spec/controllers/translations_controller_spec.rb +70 -0
  42. data/{test → spec}/dummy/README.rdoc +0 -0
  43. data/{test → spec}/dummy/Rakefile +0 -0
  44. data/{test → spec}/dummy/app/assets/javascripts/application.js +0 -1
  45. data/{test → spec}/dummy/app/assets/stylesheets/application.css +0 -1
  46. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  47. data/{test → spec}/dummy/app/helpers/application_helper.rb +0 -0
  48. data/{test → spec}/dummy/app/models/user.rb +2 -5
  49. data/{test → spec}/dummy/app/views/layouts/application.html.erb +0 -1
  50. data/{test → spec}/dummy/config.ru +0 -0
  51. data/{test → spec}/dummy/config/application.rb +10 -5
  52. data/{test → spec}/dummy/config/boot.rb +0 -0
  53. data/spec/dummy/config/database.yml +25 -0
  54. data/{test → spec}/dummy/config/environment.rb +2 -0
  55. data/{test → spec}/dummy/config/environments/development.rb +0 -0
  56. data/{test → spec}/dummy/config/environments/production.rb +0 -0
  57. data/{test → spec}/dummy/config/environments/test.rb +2 -2
  58. data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
  59. data/{test → spec}/dummy/config/initializers/devise.rb +3 -1
  60. data/{test → spec}/dummy/config/initializers/inflections.rb +0 -0
  61. data/{test → spec}/dummy/config/initializers/mime_types.rb +0 -0
  62. data/{test → spec}/dummy/config/initializers/secret_token.rb +1 -1
  63. data/{test → spec}/dummy/config/initializers/session_store.rb +1 -1
  64. data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +1 -1
  65. data/{test → spec}/dummy/config/locales/devise.en.yml +0 -0
  66. data/spec/dummy/config/locales/en.yml +5 -0
  67. data/spec/dummy/config/routes.rb +7 -0
  68. data/{test → spec}/dummy/config/translation_center.yml +23 -6
  69. data/spec/dummy/db/migrate/20130410082611_devise_create_users.translation_center.rb +46 -0
  70. data/spec/dummy/db/migrate/20130410082701_create_articles.translation_center.rb +10 -0
  71. data/spec/dummy/db/migrate/20130410084702_create_translation_center_categories.translation_center.rb +9 -0
  72. data/spec/dummy/db/migrate/20130410084703_create_translation_center_translation_keys.translation_center.rb +14 -0
  73. data/spec/dummy/db/migrate/20130410084704_create_translation_center_translations.translation_center.rb +13 -0
  74. data/spec/dummy/db/migrate/20130410084711_acts_as_votable_migration.translation_center.rb +24 -0
  75. data/spec/dummy/db/migrate/20130410084712_install_audited.translation_center.rb +28 -0
  76. data/spec/dummy/db/migrate/20130410113113_add_de_status_translation_center_translation_keys.translation_center.rb +5 -0
  77. data/spec/dummy/db/migrate/20130417134534_add_ar_status_translation_center_translation_keys.rb +5 -0
  78. data/spec/dummy/db/migrate/20130506103956_fix_translation_user_relation.translation_center.rb +12 -0
  79. data/spec/dummy/db/migrate/20130801102021_add_indicies.translation_center.rb +8 -0
  80. data/spec/dummy/db/schema.rb +111 -0
  81. data/{test → spec}/dummy/public/404.html +0 -0
  82. data/{test → spec}/dummy/public/422.html +0 -0
  83. data/{test → spec}/dummy/public/500.html +0 -0
  84. data/spec/dummy/public/favicon.ico +0 -0
  85. data/{test → spec}/dummy/script/rails +0 -0
  86. data/spec/factories/category_factory.rb +5 -0
  87. data/spec/factories/translation_factory.rb +8 -0
  88. data/spec/factories/translation_key_factory.rb +5 -0
  89. data/spec/factories/user_factory.rb +6 -0
  90. data/spec/factories/vote_factory.rb +13 -0
  91. data/spec/lib/generators/translation_center/add_lang/add_lang_generator_spec.rb +26 -0
  92. data/spec/models/translation_center/category_spec.rb +39 -0
  93. data/spec/models/translation_center/translation_key_spec.rb +145 -0
  94. data/spec/models/translation_center/translation_spec.rb +117 -0
  95. data/spec/schema.rb +112 -0
  96. data/spec/spec_helper.rb +52 -0
  97. data/spec/support/devise.rb +3 -0
  98. metadata +360 -208
  99. data/test/dummy/app/assets/images/translation_center_logo.png +0 -0
  100. data/test/dummy/app/assets/javascripts/articles.js +0 -2
  101. data/test/dummy/app/assets/stylesheets/articles.css +0 -4
  102. data/test/dummy/app/assets/stylesheets/scaffold.css +0 -56
  103. data/test/dummy/app/controllers/application_controller.rb +0 -6
  104. data/test/dummy/app/controllers/articles_controller.rb +0 -85
  105. data/test/dummy/app/helpers/articles_helper.rb +0 -2
  106. data/test/dummy/app/models/article.rb +0 -7
  107. data/test/dummy/app/views/articles/_form.html.haml +0 -16
  108. data/test/dummy/app/views/articles/edit.html.haml +0 -7
  109. data/test/dummy/app/views/articles/index.html.haml +0 -32
  110. data/test/dummy/app/views/articles/new.html.haml +0 -5
  111. data/test/dummy/app/views/articles/show.html.haml +0 -14
  112. data/test/dummy/config/database.yml +0 -42
  113. data/test/dummy/config/locales/ar.yml +0 -6
  114. data/test/dummy/config/locales/de.yml +0 -2
  115. data/test/dummy/config/locales/en.yml +0 -361
  116. data/test/dummy/config/routes.rb +0 -10
  117. data/test/dummy/spec/spec_helper.rb +0 -38
  118. data/test/dummy/test/fixtures/articles.yml +0 -9
  119. data/test/dummy/test/fixtures/posts.yml +0 -9
  120. data/test/dummy/test/fixtures/users.yml +0 -11
  121. data/test/dummy/test/functional/articles_controller_test.rb +0 -49
  122. data/test/dummy/test/functional/posts_controller_test.rb +0 -49
  123. data/test/dummy/test/unit/article_test.rb +0 -7
  124. data/test/dummy/test/unit/helpers/articles_helper_test.rb +0 -4
  125. data/test/dummy/test/unit/helpers/posts_helper_test.rb +0 -4
  126. data/test/dummy/test/unit/post_test.rb +0 -7
  127. data/test/dummy/test/unit/user_test.rb +0 -7
  128. data/test/fixtures/translation_center/categories.yml +0 -7
  129. data/test/fixtures/translation_center/translation_keys.yml +0 -11
  130. data/test/fixtures/translation_center/translations.yml +0 -15
  131. data/test/functional/translation_center/categories_controller_test.rb +0 -51
  132. data/test/functional/translation_center/center_controller_test.rb +0 -9
  133. data/test/functional/translation_center/translation_keys_controller_test.rb +0 -51
  134. data/test/functional/translation_center/translations_controller_test.rb +0 -51
  135. data/test/integration/navigation_test.rb +0 -10
  136. data/test/test_helper.rb +0 -15
  137. data/test/translation_center_test.rb +0 -7
  138. data/test/unit/helpers/translation_center/categories_helper_test.rb +0 -6
  139. data/test/unit/helpers/translation_center/center_helper_test.rb +0 -6
  140. data/test/unit/helpers/translation_center/translation_keys_helper_test.rb +0 -6
  141. data/test/unit/helpers/translation_center/translations_helper_test.rb +0 -6
  142. data/test/unit/translation_center/category_test.rb +0 -9
  143. data/test/unit/translation_center/translation_key_test.rb +0 -9
  144. data/test/unit/translation_center/translation_test.rb +0 -9
@@ -1,10 +0,0 @@
1
- Rails.application.routes.draw do
2
-
3
- resources :articles
4
-
5
- devise_for :users
6
-
7
- mount TranslationCenter::Engine => "/translation_center"
8
-
9
- root to: "articles#index"
10
- end
@@ -1,38 +0,0 @@
1
- # This file is copied to spec/ when you run 'rails generate rspec:install'
2
- ENV["RAILS_ENV"] ||= 'test'
3
- require File.expand_path("../../config/environment", __FILE__)
4
- require 'rspec/rails'
5
- require 'rspec/autorun'
6
-
7
- # Requires supporting ruby files with custom matchers and macros, etc,
8
- # in spec/support/ and its subdirectories.
9
- Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
10
-
11
- RSpec.configure do |config|
12
- # ## Mock Framework
13
- #
14
- # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
15
- #
16
- # config.mock_with :mocha
17
- # config.mock_with :flexmock
18
- # config.mock_with :rr
19
-
20
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
21
- config.fixture_path = "#{::Rails.root}/spec/fixtures"
22
-
23
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
24
- # examples within a transaction, remove the following line or assign false
25
- # instead of true.
26
- config.use_transactional_fixtures = true
27
-
28
- # If true, the base class of anonymous controllers will be inferred
29
- # automatically. This will be the default behavior in future versions of
30
- # rspec-rails.
31
- config.infer_base_class_for_anonymous_controllers = false
32
-
33
- # Run specs in random order to surface order dependencies. If you find an
34
- # order dependency and want to debug it, you can fix the order by providing
35
- # the seed, which is printed after each run.
36
- # --seed 1234
37
- config.order = "random"
38
- end
@@ -1,9 +0,0 @@
1
- # Read about fixtures at http://api.rubyonrails.org/classes/Fixtures.html
2
-
3
- one:
4
- title: MyString
5
- content: MyText
6
-
7
- two:
8
- title: MyString
9
- content: MyText
@@ -1,9 +0,0 @@
1
- # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
-
3
- one:
4
- title: MyString
5
- content: MyText
6
-
7
- two:
8
- title: MyString
9
- content: MyText
@@ -1,11 +0,0 @@
1
- # Read about fixtures at http://api.rubyonrails.org/classes/Fixtures.html
2
-
3
- # This model initially had no columns defined. If you add columns to the
4
- # model remove the '{}' from the fixture names and add the columns immediately
5
- # below each fixture, per the syntax in the comments below
6
- #
7
- one: {}
8
- # column: value
9
- #
10
- two: {}
11
- # column: value
@@ -1,49 +0,0 @@
1
- require 'test_helper'
2
-
3
- class ArticlesControllerTest < ActionController::TestCase
4
- setup do
5
- @article = articles(:one)
6
- end
7
-
8
- test "should get index" do
9
- get :index
10
- assert_response :success
11
- assert_not_nil assigns(:articles)
12
- end
13
-
14
- test "should get new" do
15
- get :new
16
- assert_response :success
17
- end
18
-
19
- test "should create article" do
20
- assert_difference('Article.count') do
21
- post :create, article: @article.attributes
22
- end
23
-
24
- assert_redirected_to article_path(assigns(:article))
25
- end
26
-
27
- test "should show article" do
28
- get :show, id: @article.to_param
29
- assert_response :success
30
- end
31
-
32
- test "should get edit" do
33
- get :edit, id: @article.to_param
34
- assert_response :success
35
- end
36
-
37
- test "should update article" do
38
- put :update, id: @article.to_param, article: @article.attributes
39
- assert_redirected_to article_path(assigns(:article))
40
- end
41
-
42
- test "should destroy article" do
43
- assert_difference('Article.count', -1) do
44
- delete :destroy, id: @article.to_param
45
- end
46
-
47
- assert_redirected_to articles_path
48
- end
49
- end
@@ -1,49 +0,0 @@
1
- require 'test_helper'
2
-
3
- class PostsControllerTest < ActionController::TestCase
4
- setup do
5
- @post = posts(:one)
6
- end
7
-
8
- test "should get index" do
9
- get :index
10
- assert_response :success
11
- assert_not_nil assigns(:posts)
12
- end
13
-
14
- test "should get new" do
15
- get :new
16
- assert_response :success
17
- end
18
-
19
- test "should create post" do
20
- assert_difference('Post.count') do
21
- post :create, post: { content: @post.content, title: @post.title }
22
- end
23
-
24
- assert_redirected_to post_path(assigns(:post))
25
- end
26
-
27
- test "should show post" do
28
- get :show, id: @post
29
- assert_response :success
30
- end
31
-
32
- test "should get edit" do
33
- get :edit, id: @post
34
- assert_response :success
35
- end
36
-
37
- test "should update post" do
38
- put :update, id: @post, post: { content: @post.content, title: @post.title }
39
- assert_redirected_to post_path(assigns(:post))
40
- end
41
-
42
- test "should destroy post" do
43
- assert_difference('Post.count', -1) do
44
- delete :destroy, id: @post
45
- end
46
-
47
- assert_redirected_to posts_path
48
- end
49
- end
@@ -1,7 +0,0 @@
1
- require 'test_helper'
2
-
3
- class ArticleTest < ActiveSupport::TestCase
4
- # test "the truth" do
5
- # assert true
6
- # end
7
- end
@@ -1,4 +0,0 @@
1
- require 'test_helper'
2
-
3
- class ArticlesHelperTest < ActionView::TestCase
4
- end
@@ -1,4 +0,0 @@
1
- require 'test_helper'
2
-
3
- class PostsHelperTest < ActionView::TestCase
4
- end
@@ -1,7 +0,0 @@
1
- require 'test_helper'
2
-
3
- class PostTest < ActiveSupport::TestCase
4
- # test "the truth" do
5
- # assert true
6
- # end
7
- end
@@ -1,7 +0,0 @@
1
- require 'test_helper'
2
-
3
- class UserTest < ActiveSupport::TestCase
4
- # test "the truth" do
5
- # assert true
6
- # end
7
- end
@@ -1,7 +0,0 @@
1
- # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
-
3
- one:
4
- name: MyString
5
-
6
- two:
7
- name: MyString
@@ -1,11 +0,0 @@
1
- # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
-
3
- one:
4
- name: MyString
5
- category_id: 1
6
- last_accessed: 2012-11-21
7
-
8
- two:
9
- name: MyString
10
- category_id: 1
11
- last_accessed: 2012-11-21
@@ -1,15 +0,0 @@
1
- # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
-
3
- one:
4
- translation_key_id: 1
5
- value: MyString
6
- lang: MyString
7
- status: MyString
8
- user_id: 1
9
-
10
- two:
11
- translation_key_id: 1
12
- value: MyString
13
- lang: MyString
14
- status: MyString
15
- user_id: 1
@@ -1,51 +0,0 @@
1
- require 'test_helper'
2
-
3
- module TranslationCenter
4
- class CategoriesControllerTest < ActionController::TestCase
5
- setup do
6
- @category = categories(:one)
7
- end
8
-
9
- test "should get index" do
10
- get :index
11
- assert_response :success
12
- assert_not_nil assigns(:categories)
13
- end
14
-
15
- test "should get new" do
16
- get :new
17
- assert_response :success
18
- end
19
-
20
- test "should create category" do
21
- assert_difference('Category.count') do
22
- post :create, category: { name: @category.name }
23
- end
24
-
25
- assert_redirected_to category_path(assigns(:category))
26
- end
27
-
28
- test "should show category" do
29
- get :show, id: @category
30
- assert_response :success
31
- end
32
-
33
- test "should get edit" do
34
- get :edit, id: @category
35
- assert_response :success
36
- end
37
-
38
- test "should update category" do
39
- put :update, id: @category, category: { name: @category.name }
40
- assert_redirected_to category_path(assigns(:category))
41
- end
42
-
43
- test "should destroy category" do
44
- assert_difference('Category.count', -1) do
45
- delete :destroy, id: @category
46
- end
47
-
48
- assert_redirected_to categories_path
49
- end
50
- end
51
- end
@@ -1,9 +0,0 @@
1
- require 'test_helper'
2
-
3
- module TranslationCenter
4
- class CenterControllerTest < ActionController::TestCase
5
- # test "the truth" do
6
- # assert true
7
- # end
8
- end
9
- end
@@ -1,51 +0,0 @@
1
- require 'test_helper'
2
-
3
- module TranslationCenter
4
- class TranslationKeysControllerTest < ActionController::TestCase
5
- setup do
6
- @translation_key = translation_keys(:one)
7
- end
8
-
9
- test "should get index" do
10
- get :index
11
- assert_response :success
12
- assert_not_nil assigns(:translation_keys)
13
- end
14
-
15
- test "should get new" do
16
- get :new
17
- assert_response :success
18
- end
19
-
20
- test "should create translation_key" do
21
- assert_difference('TranslationKey.count') do
22
- post :create, translation_key: { category_id: @translation_key.category_id, last_accessed: @translation_key.last_accessed, name: @translation_key.name }
23
- end
24
-
25
- assert_redirected_to translation_key_path(assigns(:translation_key))
26
- end
27
-
28
- test "should show translation_key" do
29
- get :show, id: @translation_key
30
- assert_response :success
31
- end
32
-
33
- test "should get edit" do
34
- get :edit, id: @translation_key
35
- assert_response :success
36
- end
37
-
38
- test "should update translation_key" do
39
- put :update, id: @translation_key, translation_key: { category_id: @translation_key.category_id, last_accessed: @translation_key.last_accessed, name: @translation_key.name }
40
- assert_redirected_to translation_key_path(assigns(:translation_key))
41
- end
42
-
43
- test "should destroy translation_key" do
44
- assert_difference('TranslationKey.count', -1) do
45
- delete :destroy, id: @translation_key
46
- end
47
-
48
- assert_redirected_to translation_keys_path
49
- end
50
- end
51
- end
@@ -1,51 +0,0 @@
1
- require 'test_helper'
2
-
3
- module TranslationCenter
4
- class TranslationsControllerTest < ActionController::TestCase
5
- setup do
6
- @translation = translations(:one)
7
- end
8
-
9
- test "should get index" do
10
- get :index
11
- assert_response :success
12
- assert_not_nil assigns(:translations)
13
- end
14
-
15
- test "should get new" do
16
- get :new
17
- assert_response :success
18
- end
19
-
20
- test "should create translation" do
21
- assert_difference('Translation.count') do
22
- post :create, translation: { lang: @translation.lang, status: @translation.status, translation_key_id: @translation.translation_key_id, user_id: @translation.user_id, value: @translation.value }
23
- end
24
-
25
- assert_redirected_to translation_path(assigns(:translation))
26
- end
27
-
28
- test "should show translation" do
29
- get :show, id: @translation
30
- assert_response :success
31
- end
32
-
33
- test "should get edit" do
34
- get :edit, id: @translation
35
- assert_response :success
36
- end
37
-
38
- test "should update translation" do
39
- put :update, id: @translation, translation: { lang: @translation.lang, status: @translation.status, translation_key_id: @translation.translation_key_id, user_id: @translation.user_id, value: @translation.value }
40
- assert_redirected_to translation_path(assigns(:translation))
41
- end
42
-
43
- test "should destroy translation" do
44
- assert_difference('Translation.count', -1) do
45
- delete :destroy, id: @translation
46
- end
47
-
48
- assert_redirected_to translations_path
49
- end
50
- end
51
- end
@@ -1,10 +0,0 @@
1
- require 'test_helper'
2
-
3
- class NavigationTest < ActionDispatch::IntegrationTest
4
- fixtures :all
5
-
6
- # test "the truth" do
7
- # assert true
8
- # end
9
- end
10
-