afalkear_translation_center 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +293 -0
- data/Rakefile +40 -0
- data/app/assets/images/translation_center/badr_it.png +0 -0
- data/app/assets/images/translation_center/loading.gif +0 -0
- data/app/assets/images/translation_center/translation_center_logo.png +0 -0
- data/app/assets/javascripts/translation_center/application.js +75 -0
- data/app/assets/javascripts/translation_center/bootstrap.js +2025 -0
- data/app/assets/javascripts/translation_center/categories.js +18 -0
- data/app/assets/javascripts/translation_center/center.js +55 -0
- data/app/assets/javascripts/translation_center/inspector.js.erb +59 -0
- data/app/assets/javascripts/translation_center/jquery-ui.js +14912 -0
- data/app/assets/javascripts/translation_center/jquery.jeditable.mini.js +38 -0
- data/app/assets/javascripts/translation_center/routes.js +15 -0
- data/app/assets/javascripts/translation_center/spin.min.js +1 -0
- data/app/assets/javascripts/translation_center/translation_keys.js +31 -0
- data/app/assets/javascripts/translation_center/translations.js +245 -0
- data/app/assets/stylesheets/translation_center/application.css +49 -0
- data/app/assets/stylesheets/translation_center/bootstrap.css +5894 -0
- data/app/assets/stylesheets/translation_center/categories.css +29 -0
- data/app/assets/stylesheets/translation_center/center.css +28 -0
- data/app/assets/stylesheets/translation_center/inspector.css +110 -0
- data/app/assets/stylesheets/translation_center/translation_keys.css +48 -0
- data/app/assets/stylesheets/translation_center/translations.css +32 -0
- data/app/controllers/translation_center/application_controller.rb +42 -0
- data/app/controllers/translation_center/categories_controller.rb +61 -0
- data/app/controllers/translation_center/center_controller.rb +67 -0
- data/app/controllers/translation_center/translation_keys_controller.rb +93 -0
- data/app/controllers/translation_center/translations_controller.rb +78 -0
- data/app/helpers/translation_center/application_helper.rb +58 -0
- data/app/helpers/translation_center/categories_helper.rb +4 -0
- data/app/helpers/translation_center/center_helper.rb +19 -0
- data/app/helpers/translation_center/translation_keys_helper.rb +4 -0
- data/app/helpers/translation_center/translations_helper.rb +4 -0
- data/app/models/translation_center/activity_query.rb +46 -0
- data/app/models/translation_center/category.rb +46 -0
- data/app/models/translation_center/translation.rb +94 -0
- data/app/models/translation_center/translation_key.rb +188 -0
- data/app/views/layouts/translation_center/application.html.haml +82 -0
- data/app/views/translation_center/categories/_category.html.haml +11 -0
- data/app/views/translation_center/categories/index.html.haml +7 -0
- data/app/views/translation_center/categories/keys.js.haml +10 -0
- data/app/views/translation_center/categories/show.html.haml +32 -0
- data/app/views/translation_center/categories/show.js.haml +7 -0
- data/app/views/translation_center/center/_activity.html.haml +49 -0
- data/app/views/translation_center/center/dashboard.html.haml +102 -0
- data/app/views/translation_center/center/manage.js.haml +3 -0
- data/app/views/translation_center/center/search_activity.js.haml +1 -0
- data/app/views/translation_center/errors/exception.html.haml +50 -0
- data/app/views/translation_center/translation_keys/_form.html.haml +18 -0
- data/app/views/translation_center/translation_keys/_show.html.haml +27 -0
- data/app/views/translation_center/translation_keys/_show_keys.html.haml +25 -0
- data/app/views/translation_center/translation_keys/_translation_keys.html.haml +16 -0
- data/app/views/translation_center/translation_keys/destroy.js.haml +4 -0
- data/app/views/translation_center/translation_keys/show.html.haml +8 -0
- data/app/views/translation_center/translation_keys/translations.js.haml +3 -0
- data/app/views/translation_center/translations/_accept_translation.html.haml +6 -0
- data/app/views/translation_center/translations/_index.html.haml +9 -0
- data/app/views/translation_center/translations/_search_results.html.haml +30 -0
- data/app/views/translation_center/translations/_show.html.haml +35 -0
- data/app/views/translation_center/translations/accept.js.haml +18 -0
- data/app/views/translation_center/translations/destroy.js.haml +11 -0
- data/app/views/translation_center/translations/search.html.haml +2 -0
- data/app/views/translation_center/translations/search.js.haml +1 -0
- data/app/views/translation_center/translations/unaccept.js.haml +9 -0
- data/app/views/translation_center/translations/unvote.js.haml +1 -0
- data/app/views/translation_center/translations/vote.js.haml +1 -0
- data/config/routes.rb +34 -0
- data/lib/afalkear_translation_center.rb +12 -0
- data/lib/generators/translation_center/USAGE +6 -0
- data/lib/generators/translation_center/add_lang/add_lang_generator.rb +31 -0
- data/lib/generators/translation_center/add_lang/templates/migrations/add_lang_status_translation_keys.rb +5 -0
- data/lib/generators/translation_center/install/install_generator.rb +38 -0
- data/lib/generators/translation_center/install/templates/assets/translation_center_logo.png +0 -0
- data/lib/generators/translation_center/install/templates/config/translation_center.yml +55 -0
- data/lib/generators/translation_center/install/templates/migrations/create_translation_center_categories.rb +9 -0
- data/lib/generators/translation_center/install/templates/migrations/create_translation_center_translation_keys.rb +16 -0
- data/lib/generators/translation_center/install/templates/migrations/create_translation_center_translations.rb +32 -0
- data/lib/tasks/translation_center.rake +56 -0
- data/lib/translation_center/acts_as_translator.rb +22 -0
- data/lib/translation_center/engine.rb +15 -0
- data/lib/translation_center/locale/en.yml +75 -0
- data/lib/translation_center/translation_helpers.rb +133 -0
- data/lib/translation_center/translations_transfer.rb +131 -0
- data/lib/translation_center/version.rb +3 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/images/translation_center_logo.png +0 -0
- data/test/dummy/app/assets/javascripts/application.js +16 -0
- data/test/dummy/app/assets/javascripts/articles.js +2 -0
- data/test/dummy/app/assets/stylesheets/application.css +14 -0
- data/test/dummy/app/assets/stylesheets/articles.css +4 -0
- data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/test/dummy/app/controllers/application_controller.rb +6 -0
- data/test/dummy/app/controllers/articles_controller.rb +85 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/articles_helper.rb +2 -0
- data/test/dummy/app/models/article.rb +7 -0
- data/test/dummy/app/models/user.rb +16 -0
- data/test/dummy/app/views/articles/_form.html.haml +16 -0
- data/test/dummy/app/views/articles/edit.html.haml +7 -0
- data/test/dummy/app/views/articles/index.html.haml +32 -0
- data/test/dummy/app/views/articles/new.html.haml +5 -0
- data/test/dummy/app/views/articles/show.html.haml +14 -0
- data/test/dummy/app/views/layouts/application.html.erb +15 -0
- data/test/dummy/config/application.rb +60 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +42 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/devise.rb +240 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/ar.yml +6 -0
- data/test/dummy/config/locales/de.yml +2 -0
- data/test/dummy/config/locales/devise.en.yml +59 -0
- data/test/dummy/config/locales/en.yml +361 -0
- data/test/dummy/config/routes.rb +10 -0
- data/test/dummy/config/translation_center.yml +58 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/migrate/20130410082611_devise_create_users.rb +46 -0
- data/test/dummy/db/migrate/20130410082701_create_articles.rb +10 -0
- data/test/dummy/db/migrate/20130410084711234392_create_translation_center_categories.rb +9 -0
- data/test/dummy/db/migrate/20130410084711235054_create_translation_center_translation_keys.rb +14 -0
- data/test/dummy/db/migrate/20130410084711235601_create_translation_center_translations.rb +13 -0
- data/test/dummy/db/migrate/20130410084711235602_install_audited.rb +28 -0
- data/test/dummy/db/migrate/20130410084711_acts_as_votable_migration.rb +23 -0
- data/test/dummy/db/migrate/20130410113111070575_add_de_status_translation_center_translation_keys.rb +5 -0
- data/test/dummy/db/migrate/20130417134539377014_add_ar_status_translation_center_translation_keys.rb +5 -0
- data/test/dummy/db/migrate/20130506103956_fix_translation_user_relation.rb +12 -0
- data/test/dummy/db/migrate/20130801102022_add_indicies.rb +8 -0
- data/test/dummy/db/schema.rb +110 -0
- data/test/dummy/log/test.log +0 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/spec/spec_helper.rb +38 -0
- data/test/dummy/test/fixtures/articles.yml +9 -0
- data/test/dummy/test/fixtures/posts.yml +9 -0
- data/test/dummy/test/fixtures/users.yml +11 -0
- data/test/dummy/test/functional/articles_controller_test.rb +49 -0
- data/test/dummy/test/functional/posts_controller_test.rb +49 -0
- data/test/dummy/test/unit/article_test.rb +7 -0
- data/test/dummy/test/unit/helpers/articles_helper_test.rb +4 -0
- data/test/dummy/test/unit/helpers/posts_helper_test.rb +4 -0
- data/test/dummy/test/unit/post_test.rb +7 -0
- data/test/dummy/test/unit/user_test.rb +7 -0
- data/test/fixtures/translation_center/categories.yml +7 -0
- data/test/fixtures/translation_center/translation_keys.yml +11 -0
- data/test/fixtures/translation_center/translations.yml +15 -0
- data/test/functional/translation_center/categories_controller_test.rb +51 -0
- data/test/functional/translation_center/center_controller_test.rb +9 -0
- data/test/functional/translation_center/translation_keys_controller_test.rb +51 -0
- data/test/functional/translation_center/translations_controller_test.rb +51 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +15 -0
- data/test/translation_center_test.rb +7 -0
- data/test/unit/helpers/translation_center/categories_helper_test.rb +6 -0
- data/test/unit/helpers/translation_center/center_helper_test.rb +6 -0
- data/test/unit/helpers/translation_center/translation_keys_helper_test.rb +6 -0
- data/test/unit/helpers/translation_center/translations_helper_test.rb +6 -0
- data/test/unit/translation_center/category_test.rb +9 -0
- data/test/unit/translation_center/translation_key_test.rb +9 -0
- data/test/unit/translation_center/translation_test.rb +9 -0
- 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
|
+
}
|