interpret 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. data/README.md +488 -0
  2. data/app/controllers/interpret/search_controller.rb +3 -1
  3. data/app/controllers/interpret/tools_controller.rb +2 -1
  4. data/app/controllers/interpret/translations_controller.rb +16 -7
  5. data/app/models/interpret/expiration_observer.rb +29 -0
  6. data/app/models/interpret/translation.rb +9 -20
  7. data/app/views/interpret/tools/index.html.erb +16 -23
  8. data/app/views/interpret/translations/_listing.html.erb +1 -1
  9. data/app/views/interpret/translations/live_edit.html.erb +11 -0
  10. data/app/views/layouts/interpret.html.erb +6 -1
  11. data/app/views/layouts/interpret_base.html.erb +1 -1
  12. data/config/routes.rb +4 -0
  13. data/interpret.gemspec +0 -1
  14. data/lib/generators/interpret/setup_generator.rb +2 -1
  15. data/lib/interpret/controller_filter.rb +22 -0
  16. data/lib/interpret/engine.rb +17 -6
  17. data/lib/interpret/helpers.rb +39 -0
  18. data/lib/interpret/version.rb +1 -1
  19. data/lib/interpret.rb +4 -1
  20. data/lib/tasks/interpret.rake +4 -2
  21. data/public/javascripts/facebox-1.3/closelabel.png +0 -0
  22. data/public/javascripts/facebox-1.3/facebox.css +80 -0
  23. data/public/javascripts/facebox-1.3/facebox.js +309 -0
  24. data/public/javascripts/facebox-1.3/loading.gif +0 -0
  25. data/public/stylesheets/interpret_live_edit_style.css +38 -0
  26. data/public/stylesheets/interpret_style.css +18 -0
  27. data/spec/models/translation_spec.rb +33 -22
  28. data/spec/observers/expiration_observer_spec.rb +17 -0
  29. data/spec/spec_helper.rb +0 -1
  30. data/test_app/Gemfile +4 -2
  31. data/test_app/app/controllers/application_controller.rb +17 -1
  32. data/test_app/app/controllers/pages_controller.rb +0 -1
  33. data/test_app/app/models/my_sweeper.rb +5 -0
  34. data/test_app/app/views/layouts/application.html.erb +115 -5
  35. data/test_app/app/views/layouts/backoffice.html.erb +27 -0
  36. data/test_app/app/views/pages/archives.html.erb +3 -0
  37. data/test_app/app/views/pages/contact.html.erb +3 -0
  38. data/test_app/app/views/pages/index.html.erb +56 -0
  39. data/test_app/app/views/pages/links.html.erb +10 -0
  40. data/test_app/app/views/pages/resources.html.erb +5 -0
  41. data/test_app/config/application.rb +2 -2
  42. data/test_app/config/environments/production.rb +0 -5
  43. data/test_app/config/initializers/interpret.rb +3 -3
  44. data/test_app/config/locales/en.yml +55 -0
  45. data/test_app/config/locales/es.yml +3 -47
  46. data/test_app/config/routes.rb +8 -1
  47. data/test_app/public/images/a1.gif +0 -0
  48. data/test_app/public/images/a10.jpg +0 -0
  49. data/test_app/public/images/a16.gif +0 -0
  50. data/test_app/public/images/a18.gif +0 -0
  51. data/test_app/public/images/a22.gif +0 -0
  52. data/test_app/public/images/a26.gif +0 -0
  53. data/test_app/public/images/a33.gif +0 -0
  54. data/test_app/public/images/a36.gif +0 -0
  55. data/test_app/public/images/a38.gif +0 -0
  56. data/test_app/public/images/a41.gif +0 -0
  57. data/test_app/public/images/a47.gif +0 -0
  58. data/test_app/public/images/a50.gif +0 -0
  59. data/test_app/public/images/a8.gif +0 -0
  60. data/test_app/public/images/abg.gif +0 -0
  61. data/test_app/public/images/pic1.jpg +0 -0
  62. data/test_app/public/images/pic2.jpg +0 -0
  63. data/test_app/public/images/spacer.gif +0 -0
  64. data/test_app/public/images/upbg.gif +0 -0
  65. data/test_app/public/javascripts/facebox-1.3/closelabel.png +0 -0
  66. data/test_app/public/javascripts/facebox-1.3/facebox.css +80 -0
  67. data/test_app/public/javascripts/facebox-1.3/facebox.js +309 -0
  68. data/test_app/public/javascripts/facebox-1.3/loading.gif +0 -0
  69. data/test_app/public/stylesheets/default.css +361 -0
  70. data/test_app/public/stylesheets/interpret_live_edit_style.css +38 -0
  71. data/test_app/public/stylesheets/interpret_style.css +18 -0
  72. data/test_app/public/stylesheets/private.css +0 -0
  73. metadata +96 -29
  74. data/app/sweepers/interpret/base_sweeper.rb +0 -18
  75. data/app/sweepers/interpret/translation_sweeper.rb +0 -11
  76. data/public/javascripts/jquery.purr.js +0 -180
  77. data/test_app/app/sweepers/page_sweeper.rb +0 -12
  78. data/test_app/app/views/pages/contact.html.haml +0 -8
  79. data/test_app/app/views/pages/index.html.haml +0 -10
  80. data/test_app/config/locales/ca.yml +0 -6
  81. data/test_app/public/javascripts/jquery.purr.js +0 -180
File without changes
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: interpret
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.1.4
4
+ hash: 17
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 5
10
+ version: 0.1.5
6
11
  platform: ruby
7
12
  authors:
8
13
  - Roger Campos
@@ -10,7 +15,7 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2011-02-21 00:00:00 +01:00
18
+ date: 2011-04-03 00:00:00 +02:00
14
19
  default_executable:
15
20
  dependencies:
16
21
  - !ruby/object:Gem::Dependency
@@ -21,6 +26,11 @@ dependencies:
21
26
  requirements:
22
27
  - - ~>
23
28
  - !ruby/object:Gem::Version
29
+ hash: 1
30
+ segments:
31
+ - 3
32
+ - 0
33
+ - 3
24
34
  version: 3.0.3
25
35
  type: :runtime
26
36
  version_requirements: *id001
@@ -32,6 +42,11 @@ dependencies:
32
42
  requirements:
33
43
  - - ~>
34
44
  - !ruby/object:Gem::Version
45
+ hash: 11
46
+ segments:
47
+ - 0
48
+ - 5
49
+ - 0
35
50
  version: 0.5.0
36
51
  type: :runtime
37
52
  version_requirements: *id002
@@ -43,6 +58,9 @@ dependencies:
43
58
  requirements:
44
59
  - - ">="
45
60
  - !ruby/object:Gem::Version
61
+ hash: 3
62
+ segments:
63
+ - 0
46
64
  version: "0"
47
65
  type: :runtime
48
66
  version_requirements: *id003
@@ -54,53 +72,61 @@ dependencies:
54
72
  requirements:
55
73
  - - ">="
56
74
  - !ruby/object:Gem::Version
75
+ hash: 103
76
+ segments:
77
+ - 0
78
+ - 30
79
+ - 0
57
80
  version: 0.30.0
58
81
  type: :runtime
59
82
  version_requirements: *id004
60
- - !ruby/object:Gem::Dependency
61
- name: will_paginate
62
- prerelease: false
63
- requirement: &id005 !ruby/object:Gem::Requirement
64
- none: false
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: 3.0.pre2
69
- type: :runtime
70
- version_requirements: *id005
71
83
  - !ruby/object:Gem::Dependency
72
84
  name: best_in_place
73
85
  prerelease: false
74
- requirement: &id006 !ruby/object:Gem::Requirement
86
+ requirement: &id005 !ruby/object:Gem::Requirement
75
87
  none: false
76
88
  requirements:
77
89
  - - ">="
78
90
  - !ruby/object:Gem::Version
91
+ hash: 21
92
+ segments:
93
+ - 0
94
+ - 1
95
+ - 7
79
96
  version: 0.1.7
80
97
  type: :runtime
81
- version_requirements: *id006
98
+ version_requirements: *id005
82
99
  - !ruby/object:Gem::Dependency
83
100
  name: lazyhash
84
101
  prerelease: false
85
- requirement: &id007 !ruby/object:Gem::Requirement
102
+ requirement: &id006 !ruby/object:Gem::Requirement
86
103
  none: false
87
104
  requirements:
88
105
  - - ">="
89
106
  - !ruby/object:Gem::Version
107
+ hash: 25
108
+ segments:
109
+ - 0
110
+ - 1
111
+ - 1
90
112
  version: 0.1.1
91
113
  type: :runtime
92
- version_requirements: *id007
114
+ version_requirements: *id006
93
115
  - !ruby/object:Gem::Dependency
94
116
  name: rspec-rails
95
117
  prerelease: false
96
- requirement: &id008 !ruby/object:Gem::Requirement
118
+ requirement: &id007 !ruby/object:Gem::Requirement
97
119
  none: false
98
120
  requirements:
99
121
  - - ~>
100
122
  - !ruby/object:Gem::Version
123
+ hash: 9
124
+ segments:
125
+ - 2
126
+ - 5
101
127
  version: "2.5"
102
128
  type: :development
103
- version_requirements: *id008
129
+ version_requirements: *id007
104
130
  description: Manage your app translations with an i18n active_record backend
105
131
  email:
106
132
  - roger@itnig.net
@@ -113,19 +139,20 @@ extra_rdoc_files: []
113
139
  files:
114
140
  - .gitignore
115
141
  - Gemfile
142
+ - README.md
116
143
  - Rakefile
117
144
  - app/controllers/interpret/base_controller.rb
118
145
  - app/controllers/interpret/search_controller.rb
119
146
  - app/controllers/interpret/tools_controller.rb
120
147
  - app/controllers/interpret/translations_controller.rb
148
+ - app/models/interpret/expiration_observer.rb
121
149
  - app/models/interpret/translation.rb
122
- - app/sweepers/interpret/base_sweeper.rb
123
- - app/sweepers/interpret/translation_sweeper.rb
124
150
  - app/views/interpret/search/index.html.erb
125
151
  - app/views/interpret/search/perform.html.erb
126
152
  - app/views/interpret/tools/index.html.erb
127
153
  - app/views/interpret/translations/_listing.html.erb
128
154
  - app/views/interpret/translations/index.html.erb
155
+ - app/views/interpret/translations/live_edit.html.erb
129
156
  - app/views/interpret/translations/new.html.erb
130
157
  - app/views/layouts/interpret.html.erb
131
158
  - app/views/layouts/interpret_base.html.erb
@@ -136,17 +163,23 @@ files:
136
163
  - lib/generators/interpret/templates/migration.rb
137
164
  - lib/interpret.rb
138
165
  - lib/interpret/capistrano.rb
166
+ - lib/interpret/controller_filter.rb
139
167
  - lib/interpret/engine.rb
140
168
  - lib/interpret/helpers.rb
141
169
  - lib/interpret/logger.rb
142
170
  - lib/interpret/version.rb
143
171
  - lib/tasks/interpret.rake
172
+ - public/javascripts/facebox-1.3/closelabel.png
173
+ - public/javascripts/facebox-1.3/facebox.css
174
+ - public/javascripts/facebox-1.3/facebox.js
175
+ - public/javascripts/facebox-1.3/loading.gif
144
176
  - public/javascripts/interpret.js
145
- - public/javascripts/jquery.purr.js
146
177
  - public/stylesheets/folder.png
178
+ - public/stylesheets/interpret_live_edit_style.css
147
179
  - public/stylesheets/interpret_style.css
148
180
  - spec/database_helpers.rb
149
181
  - spec/models/translation_spec.rb
182
+ - spec/observers/expiration_observer_spec.rb
150
183
  - spec/spec_helper.rb
151
184
  - test_app/Capfile
152
185
  - test_app/Gemfile
@@ -155,11 +188,15 @@ files:
155
188
  - test_app/app/controllers/application_controller.rb
156
189
  - test_app/app/controllers/pages_controller.rb
157
190
  - test_app/app/helpers/application_helper.rb
191
+ - test_app/app/models/my_sweeper.rb
158
192
  - test_app/app/models/user.rb
159
- - test_app/app/sweepers/page_sweeper.rb
160
193
  - test_app/app/views/layouts/application.html.erb
161
- - test_app/app/views/pages/contact.html.haml
162
- - test_app/app/views/pages/index.html.haml
194
+ - test_app/app/views/layouts/backoffice.html.erb
195
+ - test_app/app/views/pages/archives.html.erb
196
+ - test_app/app/views/pages/contact.html.erb
197
+ - test_app/app/views/pages/index.html.erb
198
+ - test_app/app/views/pages/links.html.erb
199
+ - test_app/app/views/pages/resources.html.erb
163
200
  - test_app/config.ru
164
201
  - test_app/config/application.rb
165
202
  - test_app/config/boot.rb
@@ -175,7 +212,7 @@ files:
175
212
  - test_app/config/initializers/mime_types.rb
176
213
  - test_app/config/initializers/secret_token.rb
177
214
  - test_app/config/initializers/session_store.rb
178
- - test_app/config/locales/ca.yml
215
+ - test_app/config/locales/en.yml
179
216
  - test_app/config/locales/es.yml
180
217
  - test_app/config/routes.rb
181
218
  - test_app/db/migrate/20110219143622_interpret_create_translations.rb
@@ -189,15 +226,39 @@ files:
189
226
  - test_app/public/422.html
190
227
  - test_app/public/500.html
191
228
  - test_app/public/favicon.ico
229
+ - test_app/public/images/a1.gif
230
+ - test_app/public/images/a10.jpg
231
+ - test_app/public/images/a16.gif
232
+ - test_app/public/images/a18.gif
233
+ - test_app/public/images/a22.gif
234
+ - test_app/public/images/a26.gif
235
+ - test_app/public/images/a33.gif
236
+ - test_app/public/images/a36.gif
237
+ - test_app/public/images/a38.gif
238
+ - test_app/public/images/a41.gif
239
+ - test_app/public/images/a47.gif
240
+ - test_app/public/images/a50.gif
241
+ - test_app/public/images/a8.gif
242
+ - test_app/public/images/abg.gif
243
+ - test_app/public/images/pic1.jpg
244
+ - test_app/public/images/pic2.jpg
245
+ - test_app/public/images/spacer.gif
246
+ - test_app/public/images/upbg.gif
192
247
  - test_app/public/javascripts/application.js
193
248
  - test_app/public/javascripts/best_in_place.js
249
+ - test_app/public/javascripts/facebox-1.3/closelabel.png
250
+ - test_app/public/javascripts/facebox-1.3/facebox.css
251
+ - test_app/public/javascripts/facebox-1.3/facebox.js
252
+ - test_app/public/javascripts/facebox-1.3/loading.gif
194
253
  - test_app/public/javascripts/interpret.js
195
- - test_app/public/javascripts/jquery.purr.js
196
254
  - test_app/public/javascripts/rails.js
197
255
  - test_app/public/robots.txt
198
256
  - test_app/public/stylesheets/.gitkeep
257
+ - test_app/public/stylesheets/default.css
199
258
  - test_app/public/stylesheets/folder.png
259
+ - test_app/public/stylesheets/interpret_live_edit_style.css
200
260
  - test_app/public/stylesheets/interpret_style.css
261
+ - test_app/public/stylesheets/private.css
201
262
  - test_app/script/rails
202
263
  - test_app/vendor/plugins/.gitkeep
203
264
  has_rdoc: true
@@ -214,17 +275,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
214
275
  requirements:
215
276
  - - ">="
216
277
  - !ruby/object:Gem::Version
278
+ hash: 3
279
+ segments:
280
+ - 0
217
281
  version: "0"
218
282
  required_rubygems_version: !ruby/object:Gem::Requirement
219
283
  none: false
220
284
  requirements:
221
285
  - - ">="
222
286
  - !ruby/object:Gem::Version
287
+ hash: 3
288
+ segments:
289
+ - 0
223
290
  version: "0"
224
291
  requirements: []
225
292
 
226
293
  rubyforge_project: interpret
227
- rubygems_version: 1.5.2
294
+ rubygems_version: 1.3.7
228
295
  signing_key:
229
296
  specification_version: 3
230
297
  summary: Manage your app translations with an i18n active_record backend
@@ -1,18 +0,0 @@
1
- class Interpret::BaseSweeper < ActionController::Caching::Sweeper
2
- observe Interpret::Translation
3
-
4
- def after_update(translation)
5
- expire_cache(translation)
6
- end
7
-
8
- def after_create(translation)
9
- expire_cache(translation)
10
- end
11
-
12
- protected
13
-
14
- # Implement user's custom expire logic
15
- def expire_cache(translation)
16
- end
17
- end
18
-
@@ -1,11 +0,0 @@
1
- class Interpret::TranslationSweeper < ActionController::Caching::Sweeper
2
- observe Interpret::Translation
3
-
4
- def after_update(translation)
5
- Interpret.backend.reload! if Interpret.backend
6
- end
7
-
8
- def after_create(translation)
9
- Interpret.backend.reload! if Interpret.backend
10
- end
11
- end
@@ -1,180 +0,0 @@
1
- /**
2
- * jquery.purr.js
3
- * Copyright (c) 2008 Net Perspective (net-perspective.com)
4
- * Licensed under the MIT License (http://www.opensource.org/licenses/mit-license.php)
5
- *
6
- * @author R.A. Ray
7
- * @projectDescription jQuery plugin for dynamically displaying unobtrusive messages in the browser. Mimics the behavior of the MacOS program "Growl."
8
- * @version 0.1.0
9
- *
10
- * @requires jquery.js (tested with 1.2.6)
11
- *
12
- * @param fadeInSpeed int - Duration of fade in animation in miliseconds
13
- * default: 500
14
- * @param fadeOutSpeed int - Duration of fade out animationin miliseconds
15
- default: 500
16
- * @param removeTimer int - Timeout, in miliseconds, before notice is removed once it is the top non-sticky notice in the list
17
- default: 4000
18
- * @param isSticky bool - Whether the notice should fade out on its own or wait to be manually closed
19
- default: false
20
- * @param usingTransparentPNG bool - Whether or not the notice is using transparent .png images in its styling
21
- default: false
22
- */
23
-
24
- ( function( $ ) {
25
-
26
- $.purr = function ( notice, options )
27
- {
28
- // Convert notice to a jQuery object
29
- notice = $( notice );
30
-
31
- // Add a class to denote the notice as not sticky
32
- if ( !options.isSticky )
33
- {
34
- notice.addClass( 'not-sticky' );
35
- };
36
-
37
- // Get the container element from the page
38
- var cont = document.getElementById( 'purr-container' );
39
-
40
- // If the container doesn't yet exist, we need to create it
41
- if ( !cont )
42
- {
43
- cont = '<div id="purr-container"></div>';
44
- }
45
-
46
- // Convert cont to a jQuery object
47
- cont = $( cont );
48
-
49
- // Add the container to the page
50
- $( 'body' ).append( cont );
51
-
52
- notify();
53
-
54
- function notify ()
55
- {
56
- // Set up the close button
57
- var close = document.createElement( 'a' );
58
- $( close ).attr(
59
- {
60
- className: 'close',
61
- href: '#close',
62
- innerHTML: 'Close'
63
- }
64
- )
65
- .appendTo( notice )
66
- .click( function ()
67
- {
68
- removeNotice();
69
-
70
- return false;
71
- }
72
- );
73
-
74
- // Add the notice to the page and keep it hidden initially
75
- notice.appendTo( cont )
76
- .hide();
77
-
78
- if ( jQuery.browser.msie && options.usingTransparentPNG )
79
- {
80
- // IE7 and earlier can't handle the combination of opacity and transparent pngs, so if we're using transparent pngs in our
81
- // notice style, we'll just skip the fading in.
82
- notice.show();
83
- }
84
- else
85
- {
86
- //Fade in the notice we just added
87
- notice.fadeIn( options.fadeInSpeed );
88
- }
89
-
90
- // Set up the removal interval for the added notice if that notice is not a sticky
91
- if ( !options.isSticky )
92
- {
93
- var topSpotInt = setInterval( function ()
94
- {
95
- // Check to see if our notice is the first non-sticky notice in the list
96
- if ( notice.prevAll( '.not-sticky' ).length == 0 )
97
- {
98
- // Stop checking once the condition is met
99
- clearInterval( topSpotInt );
100
-
101
- // Call the close action after the timeout set in options
102
- setTimeout( function ()
103
- {
104
- removeNotice();
105
- }, options.removeTimer
106
- );
107
- }
108
- }, 200 );
109
- }
110
- }
111
-
112
- function removeNotice ()
113
- {
114
- // IE7 and earlier can't handle the combination of opacity and transparent pngs, so if we're using transparent pngs in our
115
- // notice style, we'll just skip the fading out.
116
- if ( jQuery.browser.msie && options.usingTransparentPNG )
117
- {
118
- notice.css( { opacity: 0 } )
119
- .animate(
120
- {
121
- height: '0px'
122
- },
123
- {
124
- duration: options.fadeOutSpeed,
125
- complete: function ()
126
- {
127
- notice.remove();
128
- }
129
- }
130
- );
131
- }
132
- else
133
- {
134
- // Fade the object out before reducing its height to produce the sliding effect
135
- notice.animate(
136
- {
137
- opacity: '0'
138
- },
139
- {
140
- duration: options.fadeOutSpeed,
141
- complete: function ()
142
- {
143
- notice.animate(
144
- {
145
- height: '0px'
146
- },
147
- {
148
- duration: options.fadeOutSpeed,
149
- complete: function ()
150
- {
151
- notice.remove();
152
- }
153
- }
154
- );
155
- }
156
- }
157
- );
158
- }
159
- };
160
- };
161
-
162
- $.fn.purr = function ( options )
163
- {
164
- options = options || {};
165
- options.fadeInSpeed = options.fadeInSpeed || 500;
166
- options.fadeOutSpeed = options.fadeOutSpeed || 500;
167
- options.removeTimer = options.removeTimer || 4000;
168
- options.isSticky = options.isSticky || false;
169
- options.usingTransparentPNG = options.usingTransparentPNG || false;
170
-
171
- this.each( function()
172
- {
173
- new $.purr( this, options );
174
- }
175
- );
176
-
177
- return this;
178
- };
179
- })( jQuery );
180
-
@@ -1,12 +0,0 @@
1
- class PageSweeper < Interpret::BaseSweeper
2
- def expire_cache(translation)
3
- # Because we inherit from a base_sweeper which is inside Interpret
4
- # namespace, we have to specify "/pages" as controller, otherwise Rails
5
- # will try to find the inexistent controller "interpret/pages"
6
- #
7
- # You can also use the 'translation' object passed as an argument to do a
8
- # smarter expiration logic. For instance, maybe you want to check translation.key
9
- # to find out which action inside which controller expire.
10
- expire_page :controller => "/pages", :action => "index"
11
- end
12
- end
@@ -1,8 +0,0 @@
1
- %h1= t ".header1"
2
- %p= t ".line1"
3
- %h1= t ".header2"
4
- %p= t ".line2"
5
- %h1= t ".header3"
6
- %p= t ".line3"
7
- %p= t ".line4_html"
8
-
@@ -1,10 +0,0 @@
1
- %h1= t ".header1"
2
- %p= t ".line1"
3
- %h1= t ".header2"
4
- %p= t ".line2"
5
- %h1= t ".header3"
6
- %p= t ".line3"
7
- %p= t ".line4_html"
8
-
9
- = link_to "Login to interpret as admin", interpret_root_path(:admin => "true")
10
- = link_to "Login to interpret as user", interpret_root_path(:admin => "false")
@@ -1,6 +0,0 @@
1
- ca:
2
- home: Inicio
3
- contact: Contacto
4
-
5
- new_key: Ola en català
6
-