i18n_locale_editor 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/CHANGELOG +7 -0
  2. data/README.rdoc +4 -3
  3. data/VERSION +1 -1
  4. data/app/helpers/translations_helper.rb +2 -1
  5. data/lib/i18n_locale_editor.rb +1 -20
  6. data/public/{i18n-locale-editor.js → i18n_locale_editor/i18n-locale-editor.js} +15 -4
  7. data/public/i18n_locale_editor/wymeditor/iframe/default/lbl-blockquote.png +0 -0
  8. data/public/i18n_locale_editor/wymeditor/iframe/default/lbl-h1.png +0 -0
  9. data/public/i18n_locale_editor/wymeditor/iframe/default/lbl-h2.png +0 -0
  10. data/public/i18n_locale_editor/wymeditor/iframe/default/lbl-h3.png +0 -0
  11. data/public/i18n_locale_editor/wymeditor/iframe/default/lbl-h4.png +0 -0
  12. data/public/i18n_locale_editor/wymeditor/iframe/default/lbl-h5.png +0 -0
  13. data/public/i18n_locale_editor/wymeditor/iframe/default/lbl-h6.png +0 -0
  14. data/public/i18n_locale_editor/wymeditor/iframe/default/lbl-p.png +0 -0
  15. data/public/i18n_locale_editor/wymeditor/iframe/default/lbl-pre.png +0 -0
  16. data/public/i18n_locale_editor/wymeditor/iframe/default/wymiframe.css +90 -0
  17. data/public/i18n_locale_editor/wymeditor/iframe/default/wymiframe.html +26 -0
  18. data/public/i18n_locale_editor/wymeditor/jquery.wymeditor.js +4688 -0
  19. data/public/i18n_locale_editor/wymeditor/jquery.wymeditor.min.js +1 -0
  20. data/public/i18n_locale_editor/wymeditor/jquery.wymeditor.pack.js +1 -0
  21. data/public/i18n_locale_editor/wymeditor/lang/bg.js +45 -0
  22. data/public/i18n_locale_editor/wymeditor/lang/ca.js +45 -0
  23. data/public/i18n_locale_editor/wymeditor/lang/cs.js +45 -0
  24. data/public/i18n_locale_editor/wymeditor/lang/cy.js +45 -0
  25. data/public/i18n_locale_editor/wymeditor/lang/de.js +45 -0
  26. data/public/i18n_locale_editor/wymeditor/lang/en.js +45 -0
  27. data/public/i18n_locale_editor/wymeditor/lang/es.js +45 -0
  28. data/public/i18n_locale_editor/wymeditor/lang/fa.js +46 -0
  29. data/public/i18n_locale_editor/wymeditor/lang/fi.js +44 -0
  30. data/public/i18n_locale_editor/wymeditor/lang/fr.js +45 -0
  31. data/public/i18n_locale_editor/wymeditor/lang/gl.js +45 -0
  32. data/public/i18n_locale_editor/wymeditor/lang/he.js +45 -0
  33. data/public/i18n_locale_editor/wymeditor/lang/hr.js +45 -0
  34. data/public/i18n_locale_editor/wymeditor/lang/hu.js +45 -0
  35. data/public/i18n_locale_editor/wymeditor/lang/it.js +45 -0
  36. data/public/i18n_locale_editor/wymeditor/lang/nb.js +45 -0
  37. data/public/i18n_locale_editor/wymeditor/lang/nl.js +45 -0
  38. data/public/i18n_locale_editor/wymeditor/lang/nn.js +45 -0
  39. data/public/i18n_locale_editor/wymeditor/lang/pl.js +45 -0
  40. data/public/i18n_locale_editor/wymeditor/lang/pt-br.js +45 -0
  41. data/public/i18n_locale_editor/wymeditor/lang/pt.js +45 -0
  42. data/public/i18n_locale_editor/wymeditor/lang/ru.js +45 -0
  43. data/public/i18n_locale_editor/wymeditor/lang/sv.js +45 -0
  44. data/public/i18n_locale_editor/wymeditor/lang/tr.js +45 -0
  45. data/public/i18n_locale_editor/wymeditor/lang/zh_cn.js +47 -0
  46. data/public/i18n_locale_editor/wymeditor/plugins/embed/jquery.wymeditor.embed.js +52 -0
  47. data/public/i18n_locale_editor/wymeditor/plugins/fullscreen/icon_fullscreen.gif +0 -0
  48. data/public/i18n_locale_editor/wymeditor/plugins/fullscreen/jquery.wymeditor.fullscreen.js +127 -0
  49. data/public/i18n_locale_editor/wymeditor/plugins/hovertools/jquery.wymeditor.hovertools.js +57 -0
  50. data/public/i18n_locale_editor/wymeditor/plugins/resizable/jquery.wymeditor.resizable.js +91 -0
  51. data/public/i18n_locale_editor/wymeditor/plugins/resizable/readme.txt +124 -0
  52. data/public/i18n_locale_editor/wymeditor/plugins/tidy/README +19 -0
  53. data/public/i18n_locale_editor/wymeditor/plugins/tidy/jquery.wymeditor.tidy.js +82 -0
  54. data/public/i18n_locale_editor/wymeditor/plugins/tidy/tidy.php +36 -0
  55. data/public/i18n_locale_editor/wymeditor/plugins/tidy/wand.png +0 -0
  56. data/public/i18n_locale_editor/wymeditor/skins/compact/icons.png +0 -0
  57. data/public/i18n_locale_editor/wymeditor/skins/compact/skin.css +134 -0
  58. data/public/i18n_locale_editor/wymeditor/skins/compact/skin.js +35 -0
  59. data/public/i18n_locale_editor/wymeditor/skins/default/icons.png +0 -0
  60. data/public/i18n_locale_editor/wymeditor/skins/default/skin.css +133 -0
  61. data/public/i18n_locale_editor/wymeditor/skins/default/skin.js +40 -0
  62. data/public/i18n_locale_editor/wymeditor/skins/minimal/images/bg.header.gif +0 -0
  63. data/public/i18n_locale_editor/wymeditor/skins/minimal/images/bg.selector.silver.gif +0 -0
  64. data/public/i18n_locale_editor/wymeditor/skins/minimal/images/bg.wymeditor.png +0 -0
  65. data/public/i18n_locale_editor/wymeditor/skins/minimal/images/icons.silver.gif +0 -0
  66. data/public/i18n_locale_editor/wymeditor/skins/minimal/skin.css +131 -0
  67. data/public/i18n_locale_editor/wymeditor/skins/minimal/skin.js +30 -0
  68. data/public/i18n_locale_editor/wymeditor/skins/silver/COPYING +674 -0
  69. data/public/i18n_locale_editor/wymeditor/skins/silver/README +27 -0
  70. data/public/i18n_locale_editor/wymeditor/skins/silver/images/bg.header.gif +0 -0
  71. data/public/i18n_locale_editor/wymeditor/skins/silver/images/bg.selector.silver.gif +0 -0
  72. data/public/i18n_locale_editor/wymeditor/skins/silver/images/bg.wymeditor.png +0 -0
  73. data/public/i18n_locale_editor/wymeditor/skins/silver/images/icons.silver.gif +0 -0
  74. data/public/i18n_locale_editor/wymeditor/skins/silver/skin.css +297 -0
  75. data/public/i18n_locale_editor/wymeditor/skins/silver/skin.js +61 -0
  76. data/public/i18n_locale_editor/wymeditor/skins/twopanels/icons.png +0 -0
  77. data/public/i18n_locale_editor/wymeditor/skins/twopanels/skin.css +134 -0
  78. data/public/i18n_locale_editor/wymeditor/skins/twopanels/skin.js +39 -0
  79. data/public/i18n_locale_editor/wymeditor/skins/wymeditor_icon.png +0 -0
  80. data/rails/init.rb +5 -5
  81. metadata +79 -5
data/CHANGELOG ADDED
@@ -0,0 +1,7 @@
1
+ 0.0.2
2
+ - fixed issue #1
3
+ - added wymeditor support
4
+
5
+
6
+ 0.0.1
7
+ - proof of concept
data/README.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = Rails i18n locale editor
2
2
 
3
- Proof of concept for live locale editor fo Ruby on Rails
3
+ Proof of concept of live locale editor for Ruby on Rails
4
4
 
5
5
 
6
6
  == Features
@@ -43,9 +43,9 @@ start server with environment variable:
43
43
  * auto copy js asset and include by gem version in init.rb
44
44
  * when open in editor is requested, add locale from key to be shown on index if it is not set in session yet
45
45
  * when open in editor is requeseed and "show only missing" is enabled, check if the requested key is in the result set, if not cancel the fileter and retry
46
- * it will copy javascript assets to RAILS_ROOT/public/javascripts/ on every init, find some better way
46
+ * it will copy javascript assets to RAILS_ROOT/public/i18n_locale_editor on every init, find some better and unobtrusive way
47
47
  * raise if not vaild html accepted as transalation
48
- * show key name as title in modal window
48
+ * show key name in modal window
49
49
  * move all javascript functions to i18n namespace to prevent colision
50
50
  * make hash_tools as inherited class ExtendedHash from Hash (eradicate monkey patching)
51
51
  * extract translation controller name, model name, routing nammespace to some config and make it dynamic
@@ -53,6 +53,7 @@ start server with environment variable:
53
53
  * possibility to load another translations in modal
54
54
  * toggle wym editor in modal (cool)
55
55
  * change localization key from id to rel in span I18n monkey patch
56
+ * git, subversion support for tracking changes
56
57
  * escape path for eval in hash_tools.rb (!!!)
57
58
  * translation workflow design
58
59
  * translation key is held in span id="en.translation.key". check if the 'id' attribute can contain dots
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -33,7 +33,8 @@ module TranslationsHelper
33
33
  if(typeof($j) === 'undefined'){
34
34
  $j = jQuery.noConflict();
35
35
  }
36
- i18n_lazy_load_js('/javascripts/i18n-locale-editor.js')
36
+ i18n_lazy_load_js('/i18n_locale_editor/i18n-locale-editor.js')
37
+ //i18n_lazy_load_js('/i18n_locale_editor/wymeditor/jquery.wymeditor.pack.js')
37
38
  clearInterval(interval);
38
39
  }
39
40
  },100)
@@ -1,20 +1 @@
1
- require 'hash_tools'
2
- require 'translate_monkey_patch'
3
- require 'ftools'
4
-
5
- if ENV['I18N_EDITOR']== "true"
6
- src = File.join(directory,'public',"i18n-locale-editor.js")
7
- dst = File.join(RAILS_ROOT,'public', 'javascripts')
8
- File.copy(src,dst)
9
- end
10
-
11
- %w{ models controllers helpers }.each do |dir|
12
- path = File.join(directory, 'app',dir)
13
- $LOAD_PATH << path
14
- ActiveSupport::Dependencies.load_paths << path
15
- ActiveSupport::Dependencies.load_once_paths.delete(path)
16
- end
17
-
18
- require File.join(directory, "app", "helpers", "translations_helper.rb")
19
- ActionView::Base.send :include, TranslationsHelper;
20
-
1
+ require '../rails/init.rb'
@@ -24,7 +24,7 @@ function attach_callbacks() {
24
24
 
25
25
  function detach_callbacks() {
26
26
  $j('.i18n-translation').unbind('click.i18n_selector').unbind('mouseover.i18n_selector').unbind('mouseout.i18n_selector');
27
- $j('#i18n-button').css('background-color', 'blue');
27
+ $j('#i18n-button').css('background-color', '#111');
28
28
  blue_button();
29
29
  }
30
30
 
@@ -56,10 +56,21 @@ function fill_modal(element){
56
56
  <form onsubmit="i18n_send_form();return false;">\
57
57
  <textarea name="i8n-form-value" id="i18n-form-value">'+element.html()+'</textarea>\
58
58
  </form>\
59
- <div><a href="#" onclick="i18n_send_form();return false;">commit change</a></div\
60
- <div><a href="'+url+'#'+ element.attr('id') +'" target="_blank">open in editor</a></div>\
59
+ <div><a href="#" id="i18n-commit">commit change</a></div\
60
+ <div><a href="#" id="i18n-toggle-wymeditor" style="display: none">toggle wymeditor</a></div\
61
+ <div><a href="'+url+'#'+ element.attr('id') +'" target="_blank">open in translation editor</a></div>\
61
62
  '
62
- $j('#18n-modal-content').html(content)
63
+ $j('#18n-modal-content').html(content);
64
+
65
+ //$j('#i18n-toggle-wymeditor').click(function(){
66
+ // $j('#i18n-form-value').wymeditor({
67
+ // updateSelector: "#i18n-commit"
68
+ // });
69
+ //})
70
+
71
+ $j('#i18n-commit').click(function(){
72
+ i18n_send_form();
73
+ })
63
74
  }
64
75
 
65
76
  function i18n_send_form(){
@@ -0,0 +1,90 @@
1
+ /*
2
+ * WYMeditor : what you see is What You Mean web-based editor
3
+ * Copyright (c) 2005 - 2009 Jean-Francois Hovinne, http://www.wymeditor.org/
4
+ * Dual licensed under the MIT (MIT-license.txt)
5
+ * and GPL (GPL-license.txt) licenses.
6
+ *
7
+ * For further information visit:
8
+ * http://www.wymeditor.org/
9
+ *
10
+ * File Name:
11
+ * wymeditor.css
12
+ * Main editor css file.
13
+ * See the documentation for more info.
14
+ *
15
+ * File Authors:
16
+ * Jean-Francois Hovinne (jf.hovinne a-t wymeditor dotorg)
17
+ * Daniel Reszka (d.reszka a-t wymeditor dotorg)
18
+ */
19
+
20
+ /* VISUAL FEEDBACK */
21
+
22
+ /* basic */
23
+ body { background: #e1e8f1;}
24
+
25
+ /* make HTML blocs visible */
26
+ p,
27
+ h1,
28
+ h2,
29
+ h3,
30
+ h4,
31
+ h5,
32
+ h6,
33
+ ul,
34
+ ol,
35
+ table,
36
+ blockquote,
37
+ pre { background: #FFFFFF no-repeat 2px 2px;
38
+ padding:8px 5px 5px;
39
+ margin:10px; }
40
+ td { background: #F0F4F8; }
41
+ th { background: #ffffcc; }
42
+ ul,
43
+ ol { border-left:20px solid #B9C4D0; padding:0px 5px; }
44
+ caption { background: #E4E4B0; padding: 5px; font-weight: bold; }
45
+ table { font-size: 12px; width: 500px; }
46
+ td { width: 25%; }
47
+ blockquote { margin-left: 30px; }
48
+ pre { background-color:transparent; border: 1px solid white; }
49
+
50
+ /* Gecko min height fix */
51
+ p { min-height: 1em; } /*min-height is needed under Firefox, because empty parargraphs */
52
+ *+html p { min-height: auto; } /* but we have to remove it under IE7 because it triggers the 'haslayout' mode */
53
+ td { height: 1.6em; }
54
+
55
+ /* labels */
56
+ p { background-image: url(lbl-p.png); }
57
+ h1 { background-image: url(lbl-h1.png); }
58
+ h2 { background-image: url(lbl-h2.png); }
59
+ h3 { background-image: url(lbl-h3.png); }
60
+ h4 { background-image: url(lbl-h4.png); }
61
+ h5 { background-image: url(lbl-h5.png); }
62
+ h6 { background-image: url(lbl-h6.png); }
63
+ blockquote{ background-image: url(lbl-blockquote.png); }
64
+ pre { background-image: url(lbl-pre.png); }
65
+
66
+ /* specific HTML elements */
67
+ caption { text-align: left; }
68
+ img { margin-right: 5px;
69
+ border-style: solid;
70
+ border-color: gray;
71
+ border-width: 0; }
72
+ a img { border-width: 1px; border-color: blue; }
73
+ acronym { border: 1px solid gray; }
74
+ span { background-color: #eef; }
75
+
76
+ /* visual feedback for non-valid nesting of elements*/
77
+ h1 h1, h1 h2, h1 h3, h1 h4, h1 h5, h1 h6, h1 p, h1 pre, h1 address,
78
+ h2 h1, h2 h2, h2 h3, h2 h4, h2 h5, h2 h6, h2 p, h2 pre, h2 address,
79
+ h3 h1, h3 h2, h3 h3, h3 h4, h3 h5, h3 h6, h3 p, h3 pre, h3 address,
80
+ h4 h1, h4 h2, h4 h3, h4 h4, h4 h5, h4 h6, h4 p, h4 pre, h4 address,
81
+ h5 h1, h5 h2, h5 h3, h5 h4, h5 h5, h5 h6, h5 p, h5 pre, h5 address,
82
+ h6 h1, h6 h2, h6 h3, h6 h4, h6 h4, h6 h6, h6 p, h6 pre, h6 address,
83
+ p h1, p h2, p h3, p h4, p h5, p h6, p pre, p address,
84
+ pre h1, pre h2, pre h3, pre h4, pre h5, pre h6, pre p, pre pre, pre address,
85
+ address h1, address h2, address h3, address h4, address h5, address h6,
86
+ address p, address pre, address address
87
+ { background-color: #ff9999 !important;
88
+ border: 1px solid red !important;
89
+ font-size: 12px !important;
90
+ font-weight: normal; }
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <!--
3
+ * WYMeditor : what you see is What You Mean web-based editor
4
+ * Copyright (c) 2005 - 2009 Jean-Francois Hovinne, http://www.wymeditor.org/
5
+ * Dual licensed under the MIT (MIT-license.txt)
6
+ * and GPL (GPL-license.txt) licenses.
7
+ *
8
+ * For further information visit:
9
+ * http://www.wymeditor.org/
10
+ *
11
+ * File Name:
12
+ * wymiframe.html
13
+ * Iframe used by designMode.
14
+ * See the documentation for more info.
15
+ *
16
+ * File Authors:
17
+ * Jean-Francois Hovinne (jf.hovinne a-t wymeditor dotorg)
18
+ -->
19
+ <html>
20
+ <head>
21
+ <title>WYMeditor iframe</title>
22
+ <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
23
+ <link rel="stylesheet" type="text/css" media="screen" href="wymiframe.css" />
24
+ </head>
25
+ <body class="wym_iframe"></body>
26
+ </html>