interpret 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/.rspec +1 -0
  2. data/.travis.yml +14 -0
  3. data/README.md +2 -0
  4. data/app/controllers/interpret/base_controller.rb +10 -14
  5. data/app/controllers/interpret/missing_translations_controller.rb +41 -10
  6. data/app/controllers/interpret/search_controller.rb +15 -3
  7. data/app/controllers/interpret/tools_controller.rb +2 -2
  8. data/app/controllers/interpret/translations_controller.rb +15 -12
  9. data/app/models/interpret/ability.rb +9 -0
  10. data/app/models/interpret/translation.rb +38 -3
  11. data/app/views/interpret/missing_translations/blank.html.erb +35 -0
  12. data/app/views/interpret/missing_translations/index.html.erb +25 -14
  13. data/app/views/interpret/missing_translations/stale.html.erb +43 -0
  14. data/app/views/interpret/missing_translations/unused.html.erb +27 -0
  15. data/app/views/interpret/tools/index.html.erb +15 -25
  16. data/app/views/interpret/translations/_listing.html.erb +3 -15
  17. data/app/views/interpret/translations/index.html.erb +3 -0
  18. data/app/views/layouts/interpret.html.erb +26 -6
  19. data/config/environment.rb +0 -0
  20. data/config/routes.rb +4 -1
  21. data/interpret.gemspec +4 -1
  22. data/lib/generators/interpret/templates/migration.rb +1 -1
  23. data/lib/interpret.rb +23 -2
  24. data/lib/interpret/controller_filter.rb +0 -10
  25. data/lib/interpret/helpers.rb +2 -2
  26. data/lib/interpret/version.rb +1 -1
  27. data/public/javascripts/interpret.js +0 -3
  28. data/public/stylesheets/interpret_style.css +0 -6
  29. data/spec/integration/missing_translations_spec.rb +61 -0
  30. data/spec/integration/search_spec.rb +88 -0
  31. data/spec/integration/stale_translations_spec.rb +28 -0
  32. data/spec/integration/tools_spec.rb +86 -0
  33. data/spec/integration/translations_spec.rb +26 -0
  34. data/spec/models/translation_spec.rb +58 -25
  35. data/spec/observers/expiration_observer_spec.rb +2 -0
  36. data/spec/spec_helper.rb +3 -15
  37. data/spec/support/selenium_db_hack.rb +19 -0
  38. data/spec/support/utils.rb +89 -0
  39. data/test_app/Gemfile +1 -1
  40. data/test_app/app/controllers/application_controller.rb +2 -4
  41. data/test_app/app/models/interpret_ability.rb +7 -0
  42. data/test_app/app/models/user.rb +0 -3
  43. data/test_app/app/views/layouts/application.html.erb +4 -7
  44. data/test_app/config/initializers/interpret.rb +2 -2
  45. data/test_app/config/initializers/rack_patch.rb +13 -0
  46. data/test_app/config/locales/es.yml +1 -1
  47. data/test_app/db/migrate/20110219173536_create_users.rb +0 -2
  48. data/test_app/db/migrate/{20110219143622_interpret_create_translations.rb → 20111021100344_interpret_create_translations.rb} +1 -1
  49. data/test_app/db/schema.rb +2 -3
  50. data/test_app/db/seeds.rb +1 -1
  51. data/test_app/public/javascripts/interpret.js +0 -3
  52. data/test_app/public/stylesheets/interpret_style.css +0 -6
  53. metadata +122 -119
  54. data/spec/database_helpers.rb +0 -15
@@ -1,5 +1,2 @@
1
1
  class User < ActiveRecord::Base
2
- def admin?
3
- admin
4
- end
5
2
  end
@@ -15,10 +15,7 @@
15
15
  <p>
16
16
  <ul>
17
17
  <li>
18
- <%= link_to "Login to interpret as ADMIN", interpret_root_path(:admin => "true") %>
19
- </li>
20
- <li>
21
- <%= link_to "Login to interpret as USER", interpret_root_path(:admin => "false") %>
18
+ <%= link_to "Login to interpret", interpret_root_path %>
22
19
  </li>
23
20
  </ul>
24
21
  </p>
@@ -26,16 +23,16 @@
26
23
 
27
24
  <p>
28
25
  <% if current_user %>
29
- You are currently logged in as <%= current_user.admin? ? "an ADMIN" : "an USER" %>
26
+ You are currently logged in
30
27
  <% else %>
31
28
  You are not logged in
32
29
  <% end %>
33
30
  </p>
34
31
  <p>
35
- <% if current_user && current_user.admin? %>
32
+ <% if current_user %>
36
33
  <%= button_to Interpret.live_edit ? "Disable edition mode" : "Enable edition mode", toggle_edition_mode_path %>
37
34
  <% else %>
38
- Log in as an ADMIN to use the live edition features!
35
+ Log in to use the live edition features!
39
36
  <% end %>
40
37
  </p>
41
38
 
@@ -1,8 +1,8 @@
1
1
  Interpret.configure do |config|
2
2
  config.registered_envs << :development
3
3
  config.parent_controller = "application_controller"
4
- config.current_user = "current_user"
5
- config.admin = "admin?"
6
4
  config.layout = "backoffice"
7
5
  config.scope = "(:locale)"
6
+ config.ability = "interpret_ability"
7
+ config.black_list = ["blacklist.*", "missings.black"]
8
8
  end
@@ -0,0 +1,13 @@
1
+ # Patch to avoid undesired warnings
2
+ # https://github.com/jnicklas/capybara/issues/87
3
+ # TODO: REMOVE THIS WHEN USING RAILS 3.1
4
+ module Rack
5
+ module Utils
6
+ def escape(s)
7
+ CGI.escape(s.to_s)
8
+ end
9
+ def unescape(s)
10
+ CGI.unescape(s)
11
+ end
12
+ end
13
+ end
@@ -1,4 +1,4 @@
1
1
  es:
2
2
  printer: Para imprimir
3
3
  comments: Comentarios
4
- read_more: Leer mas
4
+ read_more: Leer más
@@ -1,8 +1,6 @@
1
1
  class CreateUsers < ActiveRecord::Migration
2
2
  def self.up
3
3
  create_table :users do |t|
4
- t.boolean :admin, :default => false, :null => false
5
-
6
4
  t.timestamps
7
5
  end
8
6
  end
@@ -6,7 +6,7 @@ class InterpretCreateTranslations < ActiveRecord::Migration
6
6
  t.text :value
7
7
  t.text :interpolations
8
8
  t.boolean :is_proc, :default => false
9
- t.boolean :protected, :default => false
9
+ t.boolean :stale, :default => false
10
10
  end
11
11
  end
12
12
 
@@ -10,7 +10,7 @@
10
10
  #
11
11
  # It's strongly recommended to check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema.define(:version => 20110219173536) do
13
+ ActiveRecord::Schema.define(:version => 20111021100344) do
14
14
 
15
15
  create_table "translations", :force => true do |t|
16
16
  t.string "locale"
@@ -18,11 +18,10 @@ ActiveRecord::Schema.define(:version => 20110219173536) do
18
18
  t.text "value"
19
19
  t.text "interpolations"
20
20
  t.boolean "is_proc", :default => false
21
- t.boolean "protected", :default => false
21
+ t.boolean "stale", :default => false
22
22
  end
23
23
 
24
24
  create_table "users", :force => true do |t|
25
- t.boolean "admin", :default => false, :null => false
26
25
  t.datetime "created_at"
27
26
  t.datetime "updated_at"
28
27
  end
data/test_app/db/seeds.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  puts "Creating users..."
2
2
  User.delete_all
3
3
  User.create :id => 1
4
- User.create :id => 2, :admin => true
4
+ User.create :id => 2
@@ -1,7 +1,4 @@
1
1
  $(document).ready(function() {
2
- $("#interpret_container .protection_input").click(function() {
3
- $(this).parent().toggleClass("protected");
4
- });
5
2
  /* Activating Best In Place */
6
3
  $("#interpret_container .best_in_place").best_in_place()
7
4
  });
@@ -382,12 +382,6 @@ html body * dd.clear
382
382
  cursor: pointer;
383
383
  }
384
384
 
385
- #interpret_container tr.protected {
386
- border: 2px dashed red;
387
- background-color: #FFEDED;
388
- }
389
-
390
-
391
385
  #interpret_container tr:hover {
392
386
  background-color: #DDD;
393
387
  -moz-transition: background .4s linear;
metadata CHANGED
@@ -1,142 +1,136 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: interpret
3
- version: !ruby/object:Gem::Version
4
- hash: 23
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 0
10
- version: 0.2.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Roger Campos
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-10-07 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2011-11-10 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rails
22
- prerelease: false
23
- version_requirements: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &71732850 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 1
29
- segments:
30
- - 3
31
- - 0
32
- - 3
20
+ - !ruby/object:Gem::Version
33
21
  version: 3.0.3
34
22
  type: :runtime
35
- requirement: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: i18n
38
23
  prerelease: false
39
- version_requirements: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *71732850
25
+ - !ruby/object:Gem::Dependency
26
+ name: i18n
27
+ requirement: &71732500 !ruby/object:Gem::Requirement
40
28
  none: false
41
- requirements:
29
+ requirements:
42
30
  - - ~>
43
- - !ruby/object:Gem::Version
44
- hash: 11
45
- segments:
46
- - 0
47
- - 5
48
- - 0
31
+ - !ruby/object:Gem::Version
49
32
  version: 0.5.0
50
33
  type: :runtime
51
- requirement: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: i18n-active_record
54
34
  prerelease: false
55
- version_requirements: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *71732500
36
+ - !ruby/object:Gem::Dependency
37
+ name: i18n-active_record
38
+ requirement: &71732230 !ruby/object:Gem::Requirement
56
39
  none: false
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- hash: 3
61
- segments:
62
- - 0
63
- version: "0"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
64
44
  type: :runtime
65
- requirement: *id003
66
- - !ruby/object:Gem::Dependency
67
- name: ya2yaml
68
45
  prerelease: false
69
- version_requirements: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *71732230
47
+ - !ruby/object:Gem::Dependency
48
+ name: ya2yaml
49
+ requirement: &71731790 !ruby/object:Gem::Requirement
70
50
  none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- hash: 103
75
- segments:
76
- - 0
77
- - 30
78
- - 0
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
79
54
  version: 0.30.0
80
55
  type: :runtime
81
- requirement: *id004
82
- - !ruby/object:Gem::Dependency
83
- name: best_in_place
84
56
  prerelease: false
85
- version_requirements: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *71731790
58
+ - !ruby/object:Gem::Dependency
59
+ name: best_in_place
60
+ requirement: &71731430 !ruby/object:Gem::Requirement
86
61
  none: false
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- hash: 21
91
- segments:
92
- - 0
93
- - 1
94
- - 7
95
- version: 0.1.7
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: 0.2.2
96
66
  type: :runtime
97
- requirement: *id005
98
- - !ruby/object:Gem::Dependency
99
- name: lazyhash
100
67
  prerelease: false
101
- version_requirements: &id006 !ruby/object:Gem::Requirement
68
+ version_requirements: *71731430
69
+ - !ruby/object:Gem::Dependency
70
+ name: lazyhash
71
+ requirement: &71747460 !ruby/object:Gem::Requirement
102
72
  none: false
103
- requirements:
104
- - - ">="
105
- - !ruby/object:Gem::Version
106
- hash: 25
107
- segments:
108
- - 0
109
- - 1
110
- - 1
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
111
76
  version: 0.1.1
112
77
  type: :runtime
113
- requirement: *id006
114
- - !ruby/object:Gem::Dependency
78
+ prerelease: false
79
+ version_requirements: *71747460
80
+ - !ruby/object:Gem::Dependency
81
+ name: cancan
82
+ requirement: &71747090 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ~>
86
+ - !ruby/object:Gem::Version
87
+ version: 1.6.0
88
+ type: :runtime
89
+ prerelease: false
90
+ version_requirements: *71747090
91
+ - !ruby/object:Gem::Dependency
115
92
  name: rspec-rails
93
+ requirement: &71746800 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ~>
97
+ - !ruby/object:Gem::Version
98
+ version: '2.5'
99
+ type: :development
116
100
  prerelease: false
117
- version_requirements: &id007 !ruby/object:Gem::Requirement
101
+ version_requirements: *71746800
102
+ - !ruby/object:Gem::Dependency
103
+ name: capybara
104
+ requirement: &71746350 !ruby/object:Gem::Requirement
118
105
  none: false
119
- requirements:
106
+ requirements:
120
107
  - - ~>
121
- - !ruby/object:Gem::Version
122
- hash: 9
123
- segments:
124
- - 2
125
- - 5
126
- version: "2.5"
108
+ - !ruby/object:Gem::Version
109
+ version: 1.0.1
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: *71746350
113
+ - !ruby/object:Gem::Dependency
114
+ name: launchy
115
+ requirement: &71746080 !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
127
121
  type: :development
128
- requirement: *id007
122
+ prerelease: false
123
+ version_requirements: *71746080
129
124
  description: Manage your app translations with an i18n active_record backend
130
- email:
125
+ email:
131
126
  - roger@itnig.net
132
127
  executables: []
133
-
134
128
  extensions: []
135
-
136
129
  extra_rdoc_files: []
137
-
138
- files:
130
+ files:
139
131
  - .gitignore
132
+ - .rspec
133
+ - .travis.yml
140
134
  - Gemfile
141
135
  - README.md
142
136
  - Rakefile
@@ -145,9 +139,13 @@ files:
145
139
  - app/controllers/interpret/search_controller.rb
146
140
  - app/controllers/interpret/tools_controller.rb
147
141
  - app/controllers/interpret/translations_controller.rb
142
+ - app/models/interpret/ability.rb
148
143
  - app/models/interpret/expiration_observer.rb
149
144
  - app/models/interpret/translation.rb
145
+ - app/views/interpret/missing_translations/blank.html.erb
150
146
  - app/views/interpret/missing_translations/index.html.erb
147
+ - app/views/interpret/missing_translations/stale.html.erb
148
+ - app/views/interpret/missing_translations/unused.html.erb
151
149
  - app/views/interpret/search/_blank_search.html.erb
152
150
  - app/views/interpret/search/_filled_search.html.erb
153
151
  - app/views/interpret/search/index.html.erb
@@ -158,6 +156,7 @@ files:
158
156
  - app/views/interpret/translations/new.html.erb
159
157
  - app/views/layouts/interpret.html.erb
160
158
  - app/views/layouts/interpret_base.html.erb
159
+ - config/environment.rb
161
160
  - config/routes.rb
162
161
  - interpret.gemspec
163
162
  - lib/generators/interpret/migration_generator.rb
@@ -179,10 +178,16 @@ files:
179
178
  - public/stylesheets/folder.png
180
179
  - public/stylesheets/interpret_live_edit_style.css
181
180
  - public/stylesheets/interpret_style.css
182
- - spec/database_helpers.rb
181
+ - spec/integration/missing_translations_spec.rb
182
+ - spec/integration/search_spec.rb
183
+ - spec/integration/stale_translations_spec.rb
184
+ - spec/integration/tools_spec.rb
185
+ - spec/integration/translations_spec.rb
183
186
  - spec/models/translation_spec.rb
184
187
  - spec/observers/expiration_observer_spec.rb
185
188
  - spec/spec_helper.rb
189
+ - spec/support/selenium_db_hack.rb
190
+ - spec/support/utils.rb
186
191
  - test_app/Capfile
187
192
  - test_app/Gemfile
188
193
  - test_app/README
@@ -190,6 +195,7 @@ files:
190
195
  - test_app/app/controllers/application_controller.rb
191
196
  - test_app/app/controllers/pages_controller.rb
192
197
  - test_app/app/helpers/application_helper.rb
198
+ - test_app/app/models/interpret_ability.rb
193
199
  - test_app/app/models/my_sweeper.rb
194
200
  - test_app/app/models/user.rb
195
201
  - test_app/app/views/layouts/application.html.erb
@@ -212,13 +218,14 @@ files:
212
218
  - test_app/config/initializers/inflections.rb
213
219
  - test_app/config/initializers/interpret.rb
214
220
  - test_app/config/initializers/mime_types.rb
221
+ - test_app/config/initializers/rack_patch.rb
215
222
  - test_app/config/initializers/secret_token.rb
216
223
  - test_app/config/initializers/session_store.rb
217
224
  - test_app/config/locales/en.yml
218
225
  - test_app/config/locales/es.yml
219
226
  - test_app/config/routes.rb
220
- - test_app/db/migrate/20110219143622_interpret_create_translations.rb
221
227
  - test_app/db/migrate/20110219173536_create_users.rb
228
+ - test_app/db/migrate/20111021100344_interpret_create_translations.rb
222
229
  - test_app/db/schema.rb
223
230
  - test_app/db/seeds.rb
224
231
  - test_app/lib/lazy_hash.rb
@@ -265,36 +272,32 @@ files:
265
272
  - test_app/vendor/plugins/.gitkeep
266
273
  homepage: https://github.com/rogercampos/interpret
267
274
  licenses: []
268
-
269
275
  post_install_message:
270
276
  rdoc_options: []
271
-
272
- require_paths:
277
+ require_paths:
273
278
  - lib
274
- required_ruby_version: !ruby/object:Gem::Requirement
279
+ required_ruby_version: !ruby/object:Gem::Requirement
275
280
  none: false
276
- requirements:
277
- - - ">="
278
- - !ruby/object:Gem::Version
279
- hash: 3
280
- segments:
281
+ requirements:
282
+ - - ! '>='
283
+ - !ruby/object:Gem::Version
284
+ version: '0'
285
+ segments:
281
286
  - 0
282
- version: "0"
283
- required_rubygems_version: !ruby/object:Gem::Requirement
287
+ hash: 791596943
288
+ required_rubygems_version: !ruby/object:Gem::Requirement
284
289
  none: false
285
- requirements:
286
- - - ">="
287
- - !ruby/object:Gem::Version
288
- hash: 3
289
- segments:
290
+ requirements:
291
+ - - ! '>='
292
+ - !ruby/object:Gem::Version
293
+ version: '0'
294
+ segments:
290
295
  - 0
291
- version: "0"
296
+ hash: 791596943
292
297
  requirements: []
293
-
294
298
  rubyforge_project: interpret
295
- rubygems_version: 1.8.6
299
+ rubygems_version: 1.8.10
296
300
  signing_key:
297
301
  specification_version: 3
298
302
  summary: Manage your app translations with an i18n active_record backend
299
303
  test_files: []
300
-