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,38 @@
1
+
2
+ (function($){$.fn.editable=function(target,options){if('disable'==target){$(this).data('disabled.editable',true);return;}
3
+ if('enable'==target){$(this).data('disabled.editable',false);return;}
4
+ if('destroy'==target){$(this).unbind($(this).data('event.editable')).removeData('disabled.editable').removeData('event.editable');return;}
5
+ var settings=$.extend({},$.fn.editable.defaults,{target:target},options);var plugin=$.editable.types[settings.type].plugin||function(){};var submit=$.editable.types[settings.type].submit||function(){};var buttons=$.editable.types[settings.type].buttons||$.editable.types['defaults'].buttons;var content=$.editable.types[settings.type].content||$.editable.types['defaults'].content;var element=$.editable.types[settings.type].element||$.editable.types['defaults'].element;var reset=$.editable.types[settings.type].reset||$.editable.types['defaults'].reset;var callback=settings.callback||function(){};var onedit=settings.onedit||function(){};var onsubmit=settings.onsubmit||function(){};var onreset=settings.onreset||function(){};var onerror=settings.onerror||reset;if(settings.tooltip){$(this).attr('title',settings.tooltip);}
6
+ settings.autowidth='auto'==settings.width;settings.autoheight='auto'==settings.height;return this.each(function(){var self=this;var savedwidth=$(self).width();var savedheight=$(self).height();$(this).data('event.editable',settings.event);if(!$.trim($(this).html())){$(this).html(settings.placeholder);}
7
+ $(this).bind(settings.event,function(e){if(true===$(this).data('disabled.editable')){return;}
8
+ if(self.editing){return;}
9
+ if(false===onedit.apply(this,[settings,self])){return;}
10
+ e.preventDefault();e.stopPropagation();if(settings.tooltip){$(self).removeAttr('title');}
11
+ if(0==$(self).width()){settings.width=savedwidth;settings.height=savedheight;}else{if(settings.width!='none'){settings.width=settings.autowidth?$(self).width():settings.width;}
12
+ if(settings.height!='none'){settings.height=settings.autoheight?$(self).height():settings.height;}}
13
+ if($(this).html().toLowerCase().replace(/(;|")/g,'')==settings.placeholder.toLowerCase().replace(/(;|")/g,'')){$(this).html('');}
14
+ self.editing=true;self.revert=$(self).html();$(self).html('');var form=$('<form />');if(settings.cssclass){if('inherit'==settings.cssclass){form.attr('class',$(self).attr('class'));}else{form.attr('class',settings.cssclass);}}
15
+ if(settings.style){if('inherit'==settings.style){form.attr('style',$(self).attr('style'));form.css('display',$(self).css('display'));}else{form.attr('style',settings.style);}}
16
+ var input=element.apply(form,[settings,self]);var input_content;if(settings.loadurl){var t=setTimeout(function(){input.disabled=true;content.apply(form,[settings.loadtext,settings,self]);},100);var loaddata={};loaddata[settings.id]=self.id;if($.isFunction(settings.loaddata)){$.extend(loaddata,settings.loaddata.apply(self,[self.revert,settings]));}else{$.extend(loaddata,settings.loaddata);}
17
+ $.ajax({type:settings.loadtype,url:settings.loadurl,data:loaddata,async:false,success:function(result){window.clearTimeout(t);input_content=result;input.disabled=false;}});}else if(settings.data){input_content=settings.data;if($.isFunction(settings.data)){input_content=settings.data.apply(self,[self.revert,settings]);}}else{input_content=self.revert;}
18
+ content.apply(form,[input_content,settings,self]);input.attr('name',settings.name);buttons.apply(form,[settings,self]);$(self).append(form);plugin.apply(form,[settings,self]);$(':input:visible:enabled:first',form).focus();if(settings.select){input.select();}
19
+ input.keydown(function(e){if(e.keyCode==27){e.preventDefault();reset.apply(form,[settings,self]);}});var t;if('cancel'==settings.onblur){input.blur(function(e){t=setTimeout(function(){reset.apply(form,[settings,self]);},500);});}else if('submit'==settings.onblur){input.blur(function(e){t=setTimeout(function(){form.submit();},200);});}else if($.isFunction(settings.onblur)){input.blur(function(e){settings.onblur.apply(self,[input.val(),settings]);});}else{input.blur(function(e){});}
20
+ form.submit(function(e){if(t){clearTimeout(t);}
21
+ e.preventDefault();if(false!==onsubmit.apply(form,[settings,self])){if(false!==submit.apply(form,[settings,self])){if($.isFunction(settings.target)){var str=settings.target.apply(self,[input.val(),settings]);$(self).html(str);self.editing=false;callback.apply(self,[self.innerHTML,settings]);if(!$.trim($(self).html())){$(self).html(settings.placeholder);}}else{var submitdata={};submitdata[settings.name]=input.val();submitdata[settings.id]=self.id;if($.isFunction(settings.submitdata)){$.extend(submitdata,settings.submitdata.apply(self,[self.revert,settings]));}else{$.extend(submitdata,settings.submitdata);}
22
+ if('PUT'==settings.method){submitdata['_method']='put';}
23
+ $(self).html(settings.indicator);var ajaxoptions={type:'POST',data:submitdata,dataType:'html',url:settings.target,success:function(result,status){if(ajaxoptions.dataType=='html'){$(self).html(result);}
24
+ self.editing=false;callback.apply(self,[result,settings]);if(!$.trim($(self).html())){$(self).html(settings.placeholder);}},error:function(xhr,status,error){onerror.apply(form,[settings,self,xhr]);}};$.extend(ajaxoptions,settings.ajaxoptions);$.ajax(ajaxoptions);}}}
25
+ $(self).attr('title',settings.tooltip);return false;});});this.reset=function(form){if(this.editing){if(false!==onreset.apply(form,[settings,self])){$(self).html(self.revert);self.editing=false;if(!$.trim($(self).html())){$(self).html(settings.placeholder);}
26
+ if(settings.tooltip){$(self).attr('title',settings.tooltip);}}}};});};$.editable={types:{defaults:{element:function(settings,original){var input=$('<input type="hidden"></input>');$(this).append(input);return(input);},content:function(string,settings,original){$(':input:first',this).val(string);},reset:function(settings,original){original.reset(this);},buttons:function(settings,original){var form=this;if(settings.submit){if(settings.submit.match(/>$/)){var submit=$(settings.submit).click(function(){if(submit.attr("type")!="submit"){form.submit();}});}else{var submit=$('<button type="submit" />');submit.html(settings.submit);}
27
+ $(this).append(submit);}
28
+ if(settings.cancel){if(settings.cancel.match(/>$/)){var cancel=$(settings.cancel);}else{var cancel=$('<button type="cancel" />');cancel.html(settings.cancel);}
29
+ $(this).append(cancel);$(cancel).click(function(event){if($.isFunction($.editable.types[settings.type].reset)){var reset=$.editable.types[settings.type].reset;}else{var reset=$.editable.types['defaults'].reset;}
30
+ reset.apply(form,[settings,original]);return false;});}}},text:{element:function(settings,original){var input=$('<input />');if(settings.width!='none'){input.width(settings.width);}
31
+ if(settings.height!='none'){input.height(settings.height);}
32
+ input.attr('autocomplete','off');$(this).append(input);return(input);}},textarea:{element:function(settings,original){var textarea=$('<textarea />');if(settings.rows){textarea.attr('rows',settings.rows);}else if(settings.height!="none"){textarea.height(settings.height);}
33
+ if(settings.cols){textarea.attr('cols',settings.cols);}else if(settings.width!="none"){textarea.width(settings.width);}
34
+ $(this).append(textarea);return(textarea);}},select:{element:function(settings,original){var select=$('<select />');$(this).append(select);return(select);},content:function(data,settings,original){if(String==data.constructor){eval('var json = '+data);}else{var json=data;}
35
+ for(var key in json){if(!json.hasOwnProperty(key)){continue;}
36
+ if('selected'==key){continue;}
37
+ var option=$('<option />').val(key).append(json[key]);$('select',this).append(option);}
38
+ $('select',this).children().each(function(){if($(this).val()==json['selected']||$(this).text()==$.trim(original.revert)){$(this).attr('selected','selected');}});}}},addInputType:function(name,input){$.editable.types[name]=input;}};$.fn.editable.defaults={name:'value',id:'id',type:'text',width:'auto',height:'auto',event:'click.editable',onblur:'cancel',loadtype:'GET',loadtext:'Loading...',placeholder:'Click to edit',loaddata:{},submitdata:{},ajaxoptions:{}};})(jQuery);
@@ -0,0 +1,15 @@
1
+ Routes = {
2
+ translation_center_category_path: translation_center_root + 'categories/',
3
+ translation_center_set_lang_to_path: translation_center_root + 'set_language_to/',
4
+ translation_center_set_lang_from_path: translation_center_root + 'set_language_from/',
5
+ translation_center_search_activity_path: translation_center_root + 'search_activity',
6
+ translation_center_search_translation_keys_path: translation_center_root + '/translation_keys/search',
7
+ translation_center_translation_key_path: function(id) { return translation_center_root + 'translation_keys/' + id },
8
+ translation_center_category_more_keys_path: function(id) { return translation_center_root + 'categories/' + id + '/more_keys' },
9
+ translation_center_translation_accept_path: function(id) { return translation_center_root + 'translations/' + id + '/accept' },
10
+ translation_center_translation_unaccept_path: function(id) { return translation_center_root + 'translations/' + id + '/unaccept' },
11
+ translation_center_translation_key_translations_path: function(id) { return translation_center_root + 'translation_keys/' + id + '/translations' },
12
+ translation_center_translation_vote_path: function(id) { return translation_center_root + 'translations/' + id + '/vote' },
13
+ translation_center_translation_unvote_path: function(id) { return translation_center_root + 'translations/' + id + '/unvote' },
14
+ translation_center_translation_key_update_translation_path: function(id) { return translation_center_root + 'translation_keys/' + id + '/update_translation' }
15
+ }
@@ -0,0 +1 @@
1
+ (function(t,e){if(typeof exports=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else t.Spinner=e()})(this,function(){"use strict";var t=["webkit","Moz","ms","O"],e={},i;function o(t,e){var i=document.createElement(t||"div"),o;for(o in e)i[o]=e[o];return i}function n(t){for(var e=1,i=arguments.length;e<i;e++)t.appendChild(arguments[e]);return t}var r=function(){var t=o("style",{type:"text/css"});n(document.getElementsByTagName("head")[0],t);return t.sheet||t.styleSheet}();function s(t,o,n,s){var a=["opacity",o,~~(t*100),n,s].join("-"),f=.01+n/s*100,l=Math.max(1-(1-t)/o*(100-f),t),d=i.substring(0,i.indexOf("Animation")).toLowerCase(),u=d&&"-"+d+"-"||"";if(!e[a]){r.insertRule("@"+u+"keyframes "+a+"{"+"0%{opacity:"+l+"}"+f+"%{opacity:"+t+"}"+(f+.01)+"%{opacity:1}"+(f+o)%100+"%{opacity:"+t+"}"+"100%{opacity:"+l+"}"+"}",r.cssRules.length);e[a]=1}return a}function a(e,i){var o=e.style,n,r;if(o[i]!==undefined)return i;i=i.charAt(0).toUpperCase()+i.slice(1);for(r=0;r<t.length;r++){n=t[r]+i;if(o[n]!==undefined)return n}}function f(t,e){for(var i in e)t.style[a(t,i)||i]=e[i];return t}function l(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)if(t[o]===undefined)t[o]=i[o]}return t}function d(t){var e={x:t.offsetLeft,y:t.offsetTop};while(t=t.offsetParent)e.x+=t.offsetLeft,e.y+=t.offsetTop;return e}var u={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:"#000",direction:1,speed:1,trail:100,opacity:1/4,fps:20,zIndex:2e9,className:"spinner",top:"auto",left:"auto",position:"relative"};function p(t){if(typeof this=="undefined")return new p(t);this.opts=l(t||{},p.defaults,u)}p.defaults={};l(p.prototype,{spin:function(t){this.stop();var e=this,n=e.opts,r=e.el=f(o(0,{className:n.className}),{position:n.position,width:0,zIndex:n.zIndex}),s=n.radius+n.length+n.width,a,l;if(t){t.insertBefore(r,t.firstChild||null);l=d(t);a=d(r);f(r,{left:(n.left=="auto"?l.x-a.x+(t.offsetWidth>>1):parseInt(n.left,10)+s)+"px",top:(n.top=="auto"?l.y-a.y+(t.offsetHeight>>1):parseInt(n.top,10)+s)+"px"})}r.setAttribute("role","progressbar");e.lines(r,e.opts);if(!i){var u=0,p=(n.lines-1)*(1-n.direction)/2,c,h=n.fps,m=h/n.speed,y=(1-n.opacity)/(m*n.trail/100),g=m/n.lines;(function v(){u++;for(var t=0;t<n.lines;t++){c=Math.max(1-(u+(n.lines-t)*g)%m*y,n.opacity);e.opacity(r,t*n.direction+p,c,n)}e.timeout=e.el&&setTimeout(v,~~(1e3/h))})()}return e},stop:function(){var t=this.el;if(t){clearTimeout(this.timeout);if(t.parentNode)t.parentNode.removeChild(t);this.el=undefined}return this},lines:function(t,e){var r=0,a=(e.lines-1)*(1-e.direction)/2,l;function d(t,i){return f(o(),{position:"absolute",width:e.length+e.width+"px",height:e.width+"px",background:t,boxShadow:i,transformOrigin:"left",transform:"rotate("+~~(360/e.lines*r+e.rotate)+"deg) translate("+e.radius+"px"+",0)",borderRadius:(e.corners*e.width>>1)+"px"})}for(;r<e.lines;r++){l=f(o(),{position:"absolute",top:1+~(e.width/2)+"px",transform:e.hwaccel?"translate3d(0,0,0)":"",opacity:e.opacity,animation:i&&s(e.opacity,e.trail,a+r*e.direction,e.lines)+" "+1/e.speed+"s linear infinite"});if(e.shadow)n(l,f(d("#000","0 0 4px "+"#000"),{top:2+"px"}));n(t,n(l,d(e.color,"0 0 1px rgba(0,0,0,.1)")))}return t},opacity:function(t,e,i){if(e<t.childNodes.length)t.childNodes[e].style.opacity=i}});function c(){function t(t,e){return o("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',e)}r.addRule(".spin-vml","behavior:url(#default#VML)");p.prototype.lines=function(e,i){var o=i.length+i.width,r=2*o;function s(){return f(t("group",{coordsize:r+" "+r,coordorigin:-o+" "+-o}),{width:r,height:r})}var a=-(i.width+i.length)*2+"px",l=f(s(),{position:"absolute",top:a,left:a}),d;function u(e,r,a){n(l,n(f(s(),{rotation:360/i.lines*e+"deg",left:~~r}),n(f(t("roundrect",{arcsize:i.corners}),{width:o,height:i.width,left:i.radius,top:-i.width>>1,filter:a}),t("fill",{color:i.color,opacity:i.opacity}),t("stroke",{opacity:0}))))}if(i.shadow)for(d=1;d<=i.lines;d++)u(d,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(d=1;d<=i.lines;d++)u(d);return n(e,l)};p.prototype.opacity=function(t,e,i,o){var n=t.firstChild;o=o.shadow&&o.lines||0;if(n&&e+o<n.childNodes.length){n=n.childNodes[e+o];n=n&&n.firstChild;n=n&&n.firstChild;if(n)n.opacity=i}}}var h=f(o("group"),{behavior:"url(#default#VML)"});if(!a(h,"transform")&&h.adj)c();else i=a(h,"animation");return p});
@@ -0,0 +1,31 @@
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
+ current_page = 1;
7
+ var fetching = false
8
+
9
+
10
+ $(document).on('mousewheel DOMMouseScroll', '.translation_keys_listing', function(e)
11
+ {
12
+
13
+ if(e.originalEvent.wheelDelta < 0 &&
14
+ $(this).scrollTop() +
15
+ $(this).innerHeight()
16
+ >= $(this)[0].scrollHeight - 100 &&
17
+ !fetching)
18
+ {
19
+
20
+ fetching = true;
21
+ current_page++
22
+ $.ajax({
23
+ type: 'GET',
24
+ url: Routes.translation_center_category_more_keys_path(Category.key()) + '.js',
25
+ data: { page : current_page },
26
+ complete: (function(){ fetching = false })
27
+ });
28
+ }
29
+ })
30
+
31
+ });
@@ -0,0 +1,245 @@
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
+ editableTranslations();
7
+ editableKeyTranslations();
8
+
9
+ $(document).on('click', '.accept_translation', function(){
10
+ $.ajax({
11
+ type: 'POST',
12
+ url: Routes.translation_center_translation_accept_path($(this).attr('data-translation-id')) + '.js'
13
+ });
14
+ });
15
+
16
+ $(document).on('click', '.unaccept_translation', function(){
17
+ $.ajax({
18
+ type: 'POST',
19
+ url: Routes.translation_center_translation_unaccept_path($(this).attr('data-translation-id')) + '.js'
20
+ });
21
+ });
22
+
23
+ $(document).on('click', '.sort_by_votes', function(){
24
+ $.ajax({
25
+ type: 'GET',
26
+ url: Routes.translation_center_translation_key_translations_path($(this).attr('data-key-id')) + '.js',
27
+ data: {sort_by: 'votes'}
28
+ });
29
+ });
30
+
31
+ $(document).on('click', '.translations_tab, .sort_by_date', function(){
32
+ $.ajax({
33
+ type: 'GET',
34
+ url: Routes.translation_center_translation_key_translations_path($(this).attr('data-key-id')) + '.js'
35
+ });
36
+ });
37
+
38
+ $(document).on('mouseover', '.translations_vote',
39
+ function() {
40
+ $(this).addClass('badge-success');
41
+ });
42
+
43
+ $(document).on('mouseout', '.translations_vote',
44
+ function() {
45
+ if($(this).attr('voted') == 'false')
46
+ $(this).removeClass('badge-success');
47
+ }
48
+ );
49
+
50
+ $(document).on('click', '.translations_vote', function() {
51
+ // vote
52
+ if($(this).attr('voted') == 'false')
53
+ {
54
+ $(this).addClass('badge-success');
55
+ $(this).attr('voted', 'true')
56
+ // TODO use I18n.t
57
+ $(this).text('Unvote');
58
+ $.ajax({
59
+ type: 'POST',
60
+ url: Routes.translation_center_translation_vote_path($(this).attr('data-translation-id')) + '.js'
61
+ });
62
+
63
+
64
+ }
65
+ // unvote
66
+ else
67
+ {
68
+ $(this).removeClass('badge-success');
69
+ $(this).attr('voted', 'false')
70
+ // TODO use I18n.t
71
+ $(this).text('Vote');
72
+ $.ajax({
73
+ type: 'POST',
74
+ url: Routes.translation_center_translation_unvote_path($(this).attr('data-translation-id')) + '.js'
75
+ });
76
+ }
77
+ });
78
+
79
+ });
80
+
81
+ function moveToNextKey(key_id){
82
+ var translation_key = $('li.translation_key[data-key-id=' + key_id + ']')
83
+ var translations_listing = $('.tab-pane#' + translation_key.attr('data-key-id'));
84
+ translations_listing.removeClass('active');
85
+ translation_key.fadeOut();
86
+ var next_key = translation_key.next();
87
+ next_key.addClass('active');
88
+ next_key.effect("highlight", {}, 3000);
89
+ $('.tab-pane#' + next_key.attr('data-key-id')).addClass('active');
90
+ }
91
+
92
+ // given id of the key get the current status
93
+ function getKeyStatus(id){
94
+ var classes = $('.translation_key[data-key-id=' + id + ']').children('.translation_key_badge').attr('class');
95
+ if(classes.indexOf('badge-important') > 0)
96
+ return 'untranslated'
97
+ else if(classes.indexOf('badge-warning') > 0)
98
+ return 'pending'
99
+ else
100
+ return 'translated'
101
+
102
+ }
103
+
104
+ // decrements the filter
105
+ function decrementFilter(filter){
106
+ if(filter == 'untranslated')
107
+ decrementUntranslated();
108
+ else if(filter == 'translated')
109
+ decrementTranslated();
110
+ else
111
+ decrementPending();
112
+ decrementAll();
113
+ }
114
+
115
+ function decrementUntranslated(){
116
+ var count = parseInt($('#untranslated_keys_count').text().replace('(', '').replace(')', '')) - 1;
117
+ $('#untranslated_keys_count').text('(' + count + ')');
118
+ }
119
+
120
+ function decrementTranslated(){
121
+ var count = parseInt($('#translated_keys_count').text().replace('(', '').replace(')', '')) - 1;
122
+ $('#translated_keys_count').text('(' + count + ')');
123
+ }
124
+
125
+ function decrementPending(){
126
+ var count = parseInt($('#pending_keys_count').text().replace('(', '').replace(')', '')) - 1;
127
+ $('#pending_keys_count').text('(' + count + ')');
128
+
129
+ }
130
+
131
+ function incrementUntranslated(){
132
+ var count = parseInt($('#untranslated_keys_count').text().replace('(', '').replace(')', '')) + 1;
133
+ $('#untranslated_keys_count').text('(' + count + ')');
134
+ }
135
+
136
+ function incrementTranslated(){
137
+ var count = parseInt($('#translated_keys_count').text().replace('(', '').replace(')', '')) + 1;
138
+ $('#translated_keys_count').text('(' + count + ')');
139
+ }
140
+
141
+ function incrementPending(){
142
+ var count = parseInt($('#pending_keys_count').text().replace('(', '').replace(')', '')) + 1;
143
+ $('#pending_keys_count').text('(' + count + ')');
144
+ }
145
+
146
+ function incrementAll(){
147
+ var count = parseInt($('#all_keys_count_count').text().replace('(', '').replace(')', '')) + 1;
148
+ $('#all_keys_count_count').text('(' + count + ')');
149
+ }
150
+
151
+ function decrementAll(){
152
+ var count = parseInt($('#all_keys_count_count').text().replace('(', '').replace(')', '')) - 1;
153
+ $('#all_keys_count_count').text('(' + count + ')');
154
+ }
155
+
156
+
157
+
158
+ function editableTranslations(){
159
+
160
+ $.each($('.user_translation'), function(){
161
+ var key_id = $(this).attr('data-key-id');
162
+
163
+ $(this).editable(Routes.translation_center_translation_key_update_translation_path(key_id, {format: 'json'}), {
164
+ method: 'POST',
165
+ onblur : 'submit',
166
+ // TODO use I18n.t for translations
167
+ placeholder : 'click to add or edit your translation',
168
+ tooltip : 'click to add or edit your translation',
169
+ callback : function(data, settings) {
170
+ data = $.parseJSON(data);
171
+ $(this).text(data.value);
172
+ if(Filter.key() == 'untranslated')
173
+ {
174
+ decrementUntranslated();
175
+ // if normal user then moved to pending
176
+ if(data.status == 'pending')
177
+ incrementPending();
178
+ else
179
+ // admin then move to translated
180
+ incrementTranslated();
181
+ moveToNextKey($(this).attr('data-key-id'));
182
+ }
183
+ else if(Filter.key() == 'pending')
184
+ {
185
+ // if you are an admin and your edits are considered accepted
186
+ if(data.status == 'accepted')
187
+ {
188
+ decrementPending();
189
+ incrementTranslated();
190
+ }
191
+ moveToNextKey($(this).attr('data-key-id'));
192
+ }
193
+ else if(Filter.key() == 'all')
194
+ {
195
+ eval('increment' + capitaliseFirstLetter(data.status))()
196
+ eval('decrement' + capitaliseFirstLetter(data.key_before_status))()
197
+ // change status of translation
198
+ if(data.status == 'pending')
199
+ {
200
+ $('li.translation_key[data-key-id=' + key_id + ']').children('div').removeClass('badge-important').addClass('badge-warning');
201
+ }
202
+ else
203
+ {
204
+ $('li.translation_key[data-key-id=' + key_id + ']').children('div').removeClass('badge-important').addClass('badge-success');
205
+ }
206
+ }
207
+ }
208
+
209
+
210
+ });
211
+ $(this).text($.trim($(this).text()));
212
+ });
213
+
214
+ }
215
+
216
+ function editableKeyTranslations(){
217
+
218
+ $.each($('.key_editable'), function(){
219
+ var key_id = $(this).attr('data-key-id');
220
+
221
+ $(this).editable(Routes.translation_center_translation_key_path(key_id, {format: 'json'}), {
222
+ method: 'PUT',
223
+ onblur : 'submit',
224
+ // TODO use I18n.t for translations
225
+ tooltip : 'Click to edit translation key',
226
+ callback : function(data, settings) {
227
+ data = $.parseJSON(data);
228
+ $(this).text(data.new_value);
229
+
230
+ // if category changed then fade out the key
231
+ if(data.new_category != data.old_category)
232
+ {
233
+ moveToNextKey(data.key_id);
234
+ decrementFilter(getKeyStatus(data.key_id));
235
+ }
236
+
237
+ }
238
+
239
+
240
+ });
241
+ $(this).text($.trim($(this).text()));
242
+
243
+ });
244
+
245
+ }
@@ -0,0 +1,49 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
14
+
15
+ body { padding-top: 60px; }
16
+
17
+ .nav_text {
18
+ margin-top: 10px !important;
19
+ margin-right: 5px;
20
+ }
21
+
22
+ .navbar span {
23
+ margin-left: 5px;
24
+ }
25
+ .navbar .brand,.navbar span, .navbar .nav > li > a, .navbar a, .navbar .nav_text {
26
+ /*color: white !important;*/
27
+ }
28
+
29
+ .navbar li.dropdown ul.dropdown-menu a.language_to {
30
+ color: black !important;
31
+ }
32
+
33
+ .navbar-inner {
34
+ /*background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #009ED2), color-stop(100%, #008CBA)) !important;*/
35
+ }
36
+
37
+ .navbar .brand {
38
+ padding-left: 58px !important;
39
+ background: url(/assets/translation_center_logo.png) no-repeat 20px 7px
40
+ }
41
+
42
+ .spinner {
43
+ left: 420px !important;
44
+ top: -14px !important;
45
+ }
46
+
47
+ input#search_keys, input#translations{
48
+ width: 110px;
49
+ }