Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
Checking mergeability… Don’t worry, you can still create the pull request.
  • 15 commits
  • 7 files changed
  • 0 commit comments
  • 3 contributors
View
1 Gemfile
@@ -19,4 +19,3 @@ gem "timecop", "0.3.5"
gem "cgi_multipart_eof_fix"
gem "fastthread"
gem "pry"
-
View
2 app/assets/translator/translator.js
@@ -0,0 +1,2 @@
+//=require jquery.autosize-min
+//=require iframeResizer.contentWindow
View
3 app/controllers/translator/translations_controller.rb
@@ -22,7 +22,8 @@ def index
if params[:translated] == '0'
@keys = @keys.select {|k|
- Translator.locales.any? {|locale| (begin I18n.backend.translate(locale, "#{k}") rescue nil; end).blank? }
+ Translator.locales.any? {|locale| (begin I18n.backend.translate(locale, "#{k}") rescue nil; end).blank? } ||
+ (begin I18n.backend.translate('de-DE', "#{k}") rescue nil; end) == (begin I18n.backend.translate('en-US', "#{k}") rescue nil; end)
}
end
View
3 app/views/layouts/translator.html.erb
@@ -5,7 +5,7 @@
<title>Translator</title>
<%= csrf_meta_tag %>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
- <script type="text/javascript" src="http://www.jacklmoore.com/autosize/jquery.autosize.js"></script>
+ <%= javascript_include_tag 'translator' %>
<script type="text/javascript">
/**
* Unobtrusive scripting adapter for jQuery
@@ -429,6 +429,7 @@ input.button {
color: red;
}
textarea {
+ resize: none;
width: 700px;
height: 1.2em;
}
View
1 translator.gemspec
@@ -15,4 +15,3 @@ Gem::Specification.new do |s|
s.files = Dir.glob("{app,lib,config}/**/*") + %w(LICENSE README.rdoc)
s.require_path = 'lib'
end
-
View
144 vendor/assets/javascripts/iframeResizer.contentWindow.js
@@ -0,0 +1,144 @@
+/*
+ * File: iframeSizer.contentWindow.js
+ * Desc: Include this file in any page being loaded into an iframe
+ * to force the iframe to resize to the content size.
+ * Requires: jquery.iframeSizer.js on host page.
+ * Author: David J. Bradshaw - dave@bradshaw.net
+ * Date: 2013-06-14
+ */
+
+
+(function() {
+
+ var
+ myID = '',
+ target = null,
+ height = 0,
+ width = 0,
+ base = 10,
+ logging = false,
+ msgID = '[iFrameSizer]', //Must match host page msg ID
+ firstRun = true;
+ msgIdLen= msgID.length;
+
+ try{
+
+ function addEventListener(e,func){
+ if (window.addEventListener){
+ window.addEventListener(e,func, false);
+ } else if (window.attachEvent){
+ window.attachEvent('on'+e,func);
+ }
+ }
+
+ function formatLogMsg(msg){
+ return msgID + '[' + myID + ']' + ' ' + msg;
+ }
+
+ function log(msg){
+ if (logging && window.console){
+ console.log(formatLogMsg(msg));
+ }
+ }
+
+ function warn(msg){
+ if (window.console){
+ console.warn(formatLogMsg(msg));
+ }
+ }
+
+ function receiver(event) {
+ function init(){
+ function strBool(str){
+ return 'true' === str ? true : false;
+ }
+
+ function setMargin(){
+ document.body.style.margin = bodyMargin+'px';
+ log('Body margin set to '+bodyMargin+'px');
+ }
+
+ function intiWindowListener(){
+ addEventListener('resize', function(){
+ sendSize('Window resized');
+ });
+ }
+
+ function initInterval(){
+ if ( 0 !== interval ){
+ log('setInterval: '+interval);
+ setInterval(function(){
+ sendSize('setInterval');
+ },interval);
+ }
+ }
+
+ var data = event.data.substr(msgIdLen).split(':');
+
+ myID = data[0];
+ bodyMargin = parseInt(data[1],base);
+ doWidth = strBool(data[2]);
+ logging = strBool(data[3]);
+ interval = parseInt(data[4],base);
+ publicMethods = strBool(data[5]);
+ target = event.source;
+
+ log('Initialising iframe');
+
+ setMargin();
+ intiWindowListener();
+ initInterval();
+
+ if (publicMethods){
+ setupPublicMethods();
+ }
+ }
+
+ function getOffset(dimension){
+ return parseInt(document.body['offset'+dimension],base);
+ }
+
+ function sendSize(calleeMsg){
+
+ var
+ currentHeight = getOffset('Height') + 2*bodyMargin,
+ currentWidth = getOffset('Width') + 2*bodyMargin,
+ msg;
+
+ if ((height !== currentHeight) || (doWidth && (width !== currentWidth))){
+ height = currentHeight;
+ width = currentWidth;
+ log( 'Trigger event: ' + calleeMsg );
+
+ msg = myID + ':' + height + ':' + width;
+ target.postMessage( msgID + msg, '*' );
+ log( 'Sending msg to host page (' + msg + ')' );
+ }
+ }
+
+ function setupPublicMethods(){
+ log( 'Enabling public methods' );
+ window.iFrameSizer={
+ trigger: function(){
+ sendSize('window.iFrameSizer.trigger()');
+ }
+ };
+ }
+
+
+ var bodyMargin,doWidth;
+
+ if (msgID === event.data.substr(0,msgIdLen) && firstRun){ //Check msg ID
+ firstRun = false;
+ init();
+ sendSize('Init message from host page');
+ }
+ }
+
+ addEventListener('message', receiver);
+ }
+ catch(e){
+ warn(e);
+ }
+
+ })();
View
0 ...assets/javascripts/jquery.autosize-min.js → ...assets/javascripts/jquery.autosize-min.js
File renamed without changes.

No commit comments for this range

Something went wrong with that request. Please try again.