afalkear_translation_center 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (174) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +293 -0
  4. data/Rakefile +40 -0
  5. data/app/assets/images/translation_center/badr_it.png +0 -0
  6. data/app/assets/images/translation_center/loading.gif +0 -0
  7. data/app/assets/images/translation_center/translation_center_logo.png +0 -0
  8. data/app/assets/javascripts/translation_center/application.js +75 -0
  9. data/app/assets/javascripts/translation_center/bootstrap.js +2025 -0
  10. data/app/assets/javascripts/translation_center/categories.js +18 -0
  11. data/app/assets/javascripts/translation_center/center.js +55 -0
  12. data/app/assets/javascripts/translation_center/inspector.js.erb +59 -0
  13. data/app/assets/javascripts/translation_center/jquery-ui.js +14912 -0
  14. data/app/assets/javascripts/translation_center/jquery.jeditable.mini.js +38 -0
  15. data/app/assets/javascripts/translation_center/routes.js +15 -0
  16. data/app/assets/javascripts/translation_center/spin.min.js +1 -0
  17. data/app/assets/javascripts/translation_center/translation_keys.js +31 -0
  18. data/app/assets/javascripts/translation_center/translations.js +245 -0
  19. data/app/assets/stylesheets/translation_center/application.css +49 -0
  20. data/app/assets/stylesheets/translation_center/bootstrap.css +5894 -0
  21. data/app/assets/stylesheets/translation_center/categories.css +29 -0
  22. data/app/assets/stylesheets/translation_center/center.css +28 -0
  23. data/app/assets/stylesheets/translation_center/inspector.css +110 -0
  24. data/app/assets/stylesheets/translation_center/translation_keys.css +48 -0
  25. data/app/assets/stylesheets/translation_center/translations.css +32 -0
  26. data/app/controllers/translation_center/application_controller.rb +42 -0
  27. data/app/controllers/translation_center/categories_controller.rb +61 -0
  28. data/app/controllers/translation_center/center_controller.rb +67 -0
  29. data/app/controllers/translation_center/translation_keys_controller.rb +93 -0
  30. data/app/controllers/translation_center/translations_controller.rb +78 -0
  31. data/app/helpers/translation_center/application_helper.rb +58 -0
  32. data/app/helpers/translation_center/categories_helper.rb +4 -0
  33. data/app/helpers/translation_center/center_helper.rb +19 -0
  34. data/app/helpers/translation_center/translation_keys_helper.rb +4 -0
  35. data/app/helpers/translation_center/translations_helper.rb +4 -0
  36. data/app/models/translation_center/activity_query.rb +46 -0
  37. data/app/models/translation_center/category.rb +46 -0
  38. data/app/models/translation_center/translation.rb +94 -0
  39. data/app/models/translation_center/translation_key.rb +188 -0
  40. data/app/views/layouts/translation_center/application.html.haml +82 -0
  41. data/app/views/translation_center/categories/_category.html.haml +11 -0
  42. data/app/views/translation_center/categories/index.html.haml +7 -0
  43. data/app/views/translation_center/categories/keys.js.haml +10 -0
  44. data/app/views/translation_center/categories/show.html.haml +32 -0
  45. data/app/views/translation_center/categories/show.js.haml +7 -0
  46. data/app/views/translation_center/center/_activity.html.haml +49 -0
  47. data/app/views/translation_center/center/dashboard.html.haml +102 -0
  48. data/app/views/translation_center/center/manage.js.haml +3 -0
  49. data/app/views/translation_center/center/search_activity.js.haml +1 -0
  50. data/app/views/translation_center/errors/exception.html.haml +50 -0
  51. data/app/views/translation_center/translation_keys/_form.html.haml +18 -0
  52. data/app/views/translation_center/translation_keys/_show.html.haml +27 -0
  53. data/app/views/translation_center/translation_keys/_show_keys.html.haml +25 -0
  54. data/app/views/translation_center/translation_keys/_translation_keys.html.haml +16 -0
  55. data/app/views/translation_center/translation_keys/destroy.js.haml +4 -0
  56. data/app/views/translation_center/translation_keys/show.html.haml +8 -0
  57. data/app/views/translation_center/translation_keys/translations.js.haml +3 -0
  58. data/app/views/translation_center/translations/_accept_translation.html.haml +6 -0
  59. data/app/views/translation_center/translations/_index.html.haml +9 -0
  60. data/app/views/translation_center/translations/_search_results.html.haml +30 -0
  61. data/app/views/translation_center/translations/_show.html.haml +35 -0
  62. data/app/views/translation_center/translations/accept.js.haml +18 -0
  63. data/app/views/translation_center/translations/destroy.js.haml +11 -0
  64. data/app/views/translation_center/translations/search.html.haml +2 -0
  65. data/app/views/translation_center/translations/search.js.haml +1 -0
  66. data/app/views/translation_center/translations/unaccept.js.haml +9 -0
  67. data/app/views/translation_center/translations/unvote.js.haml +1 -0
  68. data/app/views/translation_center/translations/vote.js.haml +1 -0
  69. data/config/routes.rb +34 -0
  70. data/lib/afalkear_translation_center.rb +12 -0
  71. data/lib/generators/translation_center/USAGE +6 -0
  72. data/lib/generators/translation_center/add_lang/add_lang_generator.rb +31 -0
  73. data/lib/generators/translation_center/add_lang/templates/migrations/add_lang_status_translation_keys.rb +5 -0
  74. data/lib/generators/translation_center/install/install_generator.rb +38 -0
  75. data/lib/generators/translation_center/install/templates/assets/translation_center_logo.png +0 -0
  76. data/lib/generators/translation_center/install/templates/config/translation_center.yml +55 -0
  77. data/lib/generators/translation_center/install/templates/migrations/create_translation_center_categories.rb +9 -0
  78. data/lib/generators/translation_center/install/templates/migrations/create_translation_center_translation_keys.rb +16 -0
  79. data/lib/generators/translation_center/install/templates/migrations/create_translation_center_translations.rb +32 -0
  80. data/lib/tasks/translation_center.rake +56 -0
  81. data/lib/translation_center/acts_as_translator.rb +22 -0
  82. data/lib/translation_center/engine.rb +15 -0
  83. data/lib/translation_center/locale/en.yml +75 -0
  84. data/lib/translation_center/translation_helpers.rb +133 -0
  85. data/lib/translation_center/translations_transfer.rb +131 -0
  86. data/lib/translation_center/version.rb +3 -0
  87. data/test/dummy/README.rdoc +261 -0
  88. data/test/dummy/Rakefile +7 -0
  89. data/test/dummy/app/assets/images/translation_center_logo.png +0 -0
  90. data/test/dummy/app/assets/javascripts/application.js +16 -0
  91. data/test/dummy/app/assets/javascripts/articles.js +2 -0
  92. data/test/dummy/app/assets/stylesheets/application.css +14 -0
  93. data/test/dummy/app/assets/stylesheets/articles.css +4 -0
  94. data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
  95. data/test/dummy/app/controllers/application_controller.rb +6 -0
  96. data/test/dummy/app/controllers/articles_controller.rb +85 -0
  97. data/test/dummy/app/helpers/application_helper.rb +2 -0
  98. data/test/dummy/app/helpers/articles_helper.rb +2 -0
  99. data/test/dummy/app/models/article.rb +7 -0
  100. data/test/dummy/app/models/user.rb +16 -0
  101. data/test/dummy/app/views/articles/_form.html.haml +16 -0
  102. data/test/dummy/app/views/articles/edit.html.haml +7 -0
  103. data/test/dummy/app/views/articles/index.html.haml +32 -0
  104. data/test/dummy/app/views/articles/new.html.haml +5 -0
  105. data/test/dummy/app/views/articles/show.html.haml +14 -0
  106. data/test/dummy/app/views/layouts/application.html.erb +15 -0
  107. data/test/dummy/config/application.rb +60 -0
  108. data/test/dummy/config/boot.rb +10 -0
  109. data/test/dummy/config/database.yml +42 -0
  110. data/test/dummy/config/environment.rb +5 -0
  111. data/test/dummy/config/environments/development.rb +37 -0
  112. data/test/dummy/config/environments/production.rb +67 -0
  113. data/test/dummy/config/environments/test.rb +37 -0
  114. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  115. data/test/dummy/config/initializers/devise.rb +240 -0
  116. data/test/dummy/config/initializers/inflections.rb +15 -0
  117. data/test/dummy/config/initializers/mime_types.rb +5 -0
  118. data/test/dummy/config/initializers/secret_token.rb +7 -0
  119. data/test/dummy/config/initializers/session_store.rb +8 -0
  120. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  121. data/test/dummy/config/locales/ar.yml +6 -0
  122. data/test/dummy/config/locales/de.yml +2 -0
  123. data/test/dummy/config/locales/devise.en.yml +59 -0
  124. data/test/dummy/config/locales/en.yml +361 -0
  125. data/test/dummy/config/routes.rb +10 -0
  126. data/test/dummy/config/translation_center.yml +58 -0
  127. data/test/dummy/config.ru +4 -0
  128. data/test/dummy/db/migrate/20130410082611_devise_create_users.rb +46 -0
  129. data/test/dummy/db/migrate/20130410082701_create_articles.rb +10 -0
  130. data/test/dummy/db/migrate/20130410084711234392_create_translation_center_categories.rb +9 -0
  131. data/test/dummy/db/migrate/20130410084711235054_create_translation_center_translation_keys.rb +14 -0
  132. data/test/dummy/db/migrate/20130410084711235601_create_translation_center_translations.rb +13 -0
  133. data/test/dummy/db/migrate/20130410084711235602_install_audited.rb +28 -0
  134. data/test/dummy/db/migrate/20130410084711_acts_as_votable_migration.rb +23 -0
  135. data/test/dummy/db/migrate/20130410113111070575_add_de_status_translation_center_translation_keys.rb +5 -0
  136. data/test/dummy/db/migrate/20130417134539377014_add_ar_status_translation_center_translation_keys.rb +5 -0
  137. data/test/dummy/db/migrate/20130506103956_fix_translation_user_relation.rb +12 -0
  138. data/test/dummy/db/migrate/20130801102022_add_indicies.rb +8 -0
  139. data/test/dummy/db/schema.rb +110 -0
  140. data/test/dummy/log/test.log +0 -0
  141. data/test/dummy/public/404.html +26 -0
  142. data/test/dummy/public/422.html +26 -0
  143. data/test/dummy/public/500.html +25 -0
  144. data/test/dummy/public/favicon.ico +0 -0
  145. data/test/dummy/script/rails +6 -0
  146. data/test/dummy/spec/spec_helper.rb +38 -0
  147. data/test/dummy/test/fixtures/articles.yml +9 -0
  148. data/test/dummy/test/fixtures/posts.yml +9 -0
  149. data/test/dummy/test/fixtures/users.yml +11 -0
  150. data/test/dummy/test/functional/articles_controller_test.rb +49 -0
  151. data/test/dummy/test/functional/posts_controller_test.rb +49 -0
  152. data/test/dummy/test/unit/article_test.rb +7 -0
  153. data/test/dummy/test/unit/helpers/articles_helper_test.rb +4 -0
  154. data/test/dummy/test/unit/helpers/posts_helper_test.rb +4 -0
  155. data/test/dummy/test/unit/post_test.rb +7 -0
  156. data/test/dummy/test/unit/user_test.rb +7 -0
  157. data/test/fixtures/translation_center/categories.yml +7 -0
  158. data/test/fixtures/translation_center/translation_keys.yml +11 -0
  159. data/test/fixtures/translation_center/translations.yml +15 -0
  160. data/test/functional/translation_center/categories_controller_test.rb +51 -0
  161. data/test/functional/translation_center/center_controller_test.rb +9 -0
  162. data/test/functional/translation_center/translation_keys_controller_test.rb +51 -0
  163. data/test/functional/translation_center/translations_controller_test.rb +51 -0
  164. data/test/integration/navigation_test.rb +10 -0
  165. data/test/test_helper.rb +15 -0
  166. data/test/translation_center_test.rb +7 -0
  167. data/test/unit/helpers/translation_center/categories_helper_test.rb +6 -0
  168. data/test/unit/helpers/translation_center/center_helper_test.rb +6 -0
  169. data/test/unit/helpers/translation_center/translation_keys_helper_test.rb +6 -0
  170. data/test/unit/helpers/translation_center/translations_helper_test.rb +6 -0
  171. data/test/unit/translation_center/category_test.rb +9 -0
  172. data/test/unit/translation_center/translation_key_test.rb +9 -0
  173. data/test/unit/translation_center/translation_test.rb +9 -0
  174. metadata +418 -0
@@ -0,0 +1,18 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
3
+
4
+ $(document).ready(function(){
5
+
6
+ // when filter changes
7
+ $('.keys_filter').click(function(){
8
+ $('#current_filter').val($(this).attr('id'));
9
+ $.ajax({
10
+ url: Routes.translation_center_category_path + Category.key() + '.js',
11
+ data: { filter: Filter.key() }
12
+ });
13
+ $($('.keys_filter').parent()).removeClass('active');
14
+ $($(this).parent()).addClass('active');
15
+ });
16
+
17
+
18
+ });
@@ -0,0 +1,55 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
3
+
4
+ $(document).ready(function(){
5
+
6
+ $('.datepicker').datepicker({"format": "dd/mm/yyyy", "weekStart": 1, "autoclose": true});
7
+
8
+ $('.language_from').click(function(){
9
+ var language_from = $.trim($(this).attr('lang_sym'));
10
+ $.ajax({
11
+ type: 'POST',
12
+ url: Routes.translation_center_set_lang_from_path,
13
+ data: { lang : language_from },
14
+ success: function(){
15
+ location.reload();
16
+ }
17
+ });
18
+ });
19
+
20
+ $('#search_activity').click(function(){
21
+ $.ajax({
22
+ type: 'GET',
23
+ url: Routes.translation_center_search_activity_path + '.js',
24
+ data: $('#search_form').serialize()
25
+ });
26
+ return false;
27
+ });
28
+
29
+ $('#search_reset').click(function(){
30
+ $('#search_form').children('input').each(function(){
31
+ $(this).val('')
32
+ })
33
+ $('#search_form').children('select').val('');
34
+ $('#search_activity').click();
35
+ });
36
+
37
+ $(document).on('click', '.pagination a', function(){
38
+ $.ajax({
39
+ type: "GET",
40
+ url: $(this).attr("href"),
41
+ dataType: "script"
42
+ });
43
+ return false;
44
+ });
45
+
46
+ $("body").on({
47
+ ajaxStart: function() {
48
+ $('#loading').show();
49
+ },
50
+ ajaxStop: function() {
51
+ $('#loading').hide();
52
+ }
53
+ });
54
+
55
+ });
@@ -0,0 +1,59 @@
1
+ // Get the translation center engine root path
2
+ translation_center_root = "<%= Rails.application.routes.url_helpers.translation_center_path %>"
3
+
4
+ translation_center_translation_key_path = function(id) { return translation_center_root + '/translation_keys/' + id }
5
+
6
+ $(document).ready(function() {
7
+ attachInspectorLinks();
8
+ });
9
+
10
+ // after any ajax request attach the inspector links
11
+ $(document).ajaxComplete(function() {
12
+ attachInspectorLinks();
13
+ });
14
+
15
+ function attachInspectorLinks(){
16
+ if($('body').children('#tc-inspector-links').length == 0 && $('#tc_no_inspector').length == 0 )
17
+ $('body').append('<div id="tc-inspector-links"></div>');
18
+
19
+ // for each key add a link that goes to the key page
20
+ $('.tc-inspector-key').each(function(){
21
+ var top = $(this).offset().top - 20;
22
+ var left = $(this).offset().left - 10;
23
+ var id = $(this).data('id');
24
+ // missing translation will be in red while translated will be in green
25
+ var badgeClass = getBadge($(this).data('type'));
26
+ $('#tc-inspector-links').append($('<a>').attr('title', 'Click to visit key').attr('target', 'key_inspect').attr('href', translation_center_translation_key_path(id) + "?lang_to=" + $(this).data('locale')).attr('data-id', id).attr('style', 'left:' + left + 'px;top:' + top + 'px' ).attr('class', 'icon-edit tc-badge ' + badgeClass + ' tc-inspector-link'));
27
+
28
+ });
29
+
30
+ // highlight the key when user hovers over it
31
+ $(".tc-inspector-link").mouseover(function() {
32
+ var id = $(this).data('id');
33
+ var key = $('.tc-inspector-key[data-id=' + id + ']');
34
+ var color = getColor(key.data('type'));
35
+ key.css('color', color);
36
+ }).mouseout(function(){
37
+ var id = $(this).data('id');
38
+ $('.tc-inspector-key[data-id=' + id + ']').css('color', '');
39
+ });
40
+
41
+ }
42
+
43
+ function getBadge(status) {
44
+ if(status == 'untranslated')
45
+ return 'tc-badge-important'
46
+ else if(status == 'pending')
47
+ return 'tc-badge-warning'
48
+ else
49
+ return 'tc-badge-success'
50
+ }
51
+
52
+ function getColor(status) {
53
+ if(status == 'untranslated')
54
+ return 'red'
55
+ else if(status == 'pending')
56
+ return 'orange'
57
+ else
58
+ return 'green'
59
+ }