weeler 0.0.3 → 0.0.4

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 (66) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/CHANGELOG.md +68 -0
  4. data/README.md +1 -0
  5. data/app/.DS_Store +0 -0
  6. data/app/assets/.DS_Store +0 -0
  7. data/app/assets/javascripts/.DS_Store +0 -0
  8. data/app/assets/javascripts/weeler/.DS_Store +0 -0
  9. data/app/assets/javascripts/weeler/app/index.js +0 -0
  10. data/app/assets/javascripts/weeler/init.js.coffee +8 -0
  11. data/app/assets/javascripts/weeler/vendor/.DS_Store +0 -0
  12. data/app/assets/javascripts/weeler/vendor/bootstrap.file-input.js +122 -0
  13. data/app/assets/javascripts/weeler/{bootstrap.js → vendor/bootstrap.js} +0 -0
  14. data/app/assets/javascripts/weeler/{bootstrap.rowlink.js → vendor/bootstrap.rowlink.js} +0 -0
  15. data/app/assets/javascripts/weeler/{bootstrap.switch.js → vendor/bootstrap.switch.js} +0 -0
  16. data/app/assets/javascripts/weeler/{jquery.pnotify.js → vendor/jquery.pnotify.js} +0 -0
  17. data/app/assets/stylesheets/.DS_Store +0 -0
  18. data/app/assets/stylesheets/weeler/.DS_Store +0 -0
  19. data/app/assets/stylesheets/weeler/app/index.css +0 -0
  20. data/app/assets/stylesheets/weeler/init.css.erb +5 -0
  21. data/app/assets/stylesheets/weeler/{style.css.scss.erb → style.css.scss} +11 -0
  22. data/app/assets/stylesheets/weeler/{bootstrap.css → vendor/bootstrap.css} +0 -0
  23. data/app/assets/stylesheets/weeler/{bootstrap.min.css → vendor/bootstrap.min.css} +0 -0
  24. data/app/assets/stylesheets/weeler/{bootstrap.rowlink.css → vendor/bootstrap.rowlink.css} +0 -0
  25. data/app/assets/stylesheets/weeler/{bootstrap.spinner.css → vendor/bootstrap.spinner.css} +0 -0
  26. data/app/assets/stylesheets/weeler/{bootstrap.switch.css → vendor/bootstrap.switch.css} +0 -0
  27. data/app/assets/stylesheets/weeler/{jquery.pnotify.css → vendor/jquery.pnotify.css} +0 -0
  28. data/app/controllers/weeler/translations_controller.rb +5 -78
  29. data/app/views/layouts/weeler/base.html.erb +27 -73
  30. data/app/views/weeler/shared/_flash.html.erb +17 -0
  31. data/app/views/weeler/shared/_footer.html.erb +3 -0
  32. data/app/views/weeler/shared/_header_navbar.html.erb +18 -0
  33. data/app/views/weeler/shared/_side_navbar.html.erb +14 -0
  34. data/app/views/weeler/translations/index.html.erb +2 -5
  35. data/lib/.DS_Store +0 -0
  36. data/lib/generators/weeler/install_generator.rb +15 -6
  37. data/lib/generators/weeler/templates/controllers/weeler/example_controller.rb.example +7 -0
  38. data/lib/generators/weeler/templates/views/weeler/example/index.html.erb +0 -0
  39. data/lib/i18n/backend/weeler/exporter/active_record.rb +37 -0
  40. data/lib/i18n/backend/weeler/exporter/active_record_relation.rb +38 -0
  41. data/lib/i18n/backend/weeler/exporter.rb +18 -0
  42. data/lib/i18n/backend/weeler/importer.rb +85 -0
  43. data/lib/i18n/backend/weeler.rb +4 -0
  44. data/lib/weeler/.DS_Store +0 -0
  45. data/lib/weeler/route_mapper.rb +1 -1
  46. data/lib/weeler/version.rb +1 -1
  47. data/rspec.html +176 -98
  48. data/spec/.DS_Store +0 -0
  49. data/spec/controllers/translations_controller_spec.rb +8 -3
  50. data/spec/dummy/db/test.sqlite3 +0 -0
  51. data/spec/dummy/log/test.log +49556 -0
  52. data/spec/fixtures/.DS_Store +0 -0
  53. data/spec/fixtures/test.xlsx +0 -0
  54. data/spec/spec_helper.rb +0 -1
  55. data/spec/weeler/.DS_Store +0 -0
  56. data/spec/weeler/i18n/.DS_Store +0 -0
  57. data/spec/weeler/i18n/backend/.DS_Store +0 -0
  58. data/spec/weeler/i18n/backend/weeler/exporter_spec.rb +72 -0
  59. data/spec/weeler/i18n/backend/weeler/importer_spec.rb +47 -0
  60. data/spec/weeler/{i18n_backend_weeler_spec.rb → i18n/backend/weeler_spec.rb} +9 -9
  61. data/spec/weeler/{i18n_humanize_missing_translations_spec.rb → i18n/humanize_missing_translations_spec.rb} +0 -0
  62. metadata +46 -21
  63. data/app/assets/javascripts/weeler/bootstrap-fileupload.js +0 -169
  64. data/app/assets/javascripts/weeler.js.coffee +0 -8
  65. data/app/assets/stylesheets/weeler/bootstrap-fileupload.css +0 -132
  66. data/app/assets/stylesheets/weeler.css +0 -9
@@ -0,0 +1,37 @@
1
+ module I18n
2
+ module Backend
3
+ class Weeler
4
+ module Exporter
5
+
6
+ module ActiveRecord
7
+ extend ActiveSupport::Concern
8
+
9
+ module ClassMethods
10
+
11
+ def title_row locales
12
+ row = [ 'Key' ]
13
+ locales.each do |locale|
14
+ row.push(locale.capitalize)
15
+ end
16
+ row
17
+ end
18
+
19
+ def translation_row_by_key_and_locales key, locales
20
+ row = [ key ]
21
+ locales.each do |locale|
22
+ result = Translation.locale(locale).lookup(key).load
23
+ if result.first.present?
24
+ row.push(result.first.value)
25
+ else
26
+ row.push("")
27
+ end
28
+ end
29
+ row
30
+ end
31
+ end
32
+ end
33
+
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,38 @@
1
+ module I18n
2
+ module Backend
3
+ class Weeler
4
+ module Exporter
5
+
6
+ module ActiveRecordRelation
7
+
8
+ def as_xlsx_package
9
+ # construct xlsx file
10
+ p = Axlsx::Package.new
11
+ # Numbers requires this
12
+ p.use_shared_strings = true
13
+
14
+ sheet = p.workbook.add_worksheet(name: "translations")
15
+
16
+ # All used locales and translations by params
17
+ locales = Translation.available_locales
18
+ locales = locales.select{ |l| l.present? }
19
+
20
+ sheet.add_row(Translation.title_row(locales))
21
+
22
+ included_keys = []
23
+
24
+ self.each do |translation|
25
+ unless included_keys.include? translation.key
26
+ sheet.add_row(Translation.translation_row_by_key_and_locales(translation.key, locales))
27
+ included_keys << translation.key
28
+ end
29
+ end
30
+ return p
31
+ end
32
+
33
+ end
34
+
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,18 @@
1
+ begin
2
+ require 'axlsx'
3
+ require 'i18n/backend/weeler/exporter/active_record'
4
+ require 'i18n/backend/weeler/exporter/active_record_relation'
5
+ rescue LoadError => e
6
+ puts "can't use Exporter because: #{e.message}"
7
+ end
8
+
9
+ module I18n
10
+ module Backend
11
+ class Weeler
12
+
13
+ Translation.send(:include, Exporter::ActiveRecord)
14
+ ActiveRecord::Relation::ActiveRecord_Relation_I18n_Backend_Weeler_Translation.send(:include, Exporter::ActiveRecordRelation)
15
+
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,85 @@
1
+ begin
2
+ require 'roo'
3
+ rescue LoadError => e
4
+ puts "can't use Exporter because: #{e.message}"
5
+ end
6
+
7
+ module I18n
8
+ module Backend
9
+ class Weeler
10
+
11
+ module Importer
12
+
13
+ extend ActiveSupport::Concern
14
+
15
+ module ClassMethods
16
+
17
+
18
+
19
+ def import path
20
+
21
+ xls = Roo::Excelx.new(path, file_warning: :ignore)
22
+
23
+ xls.each_with_pagename do |name, sheet|
24
+
25
+ # Lookup locales
26
+ locales = locales_from_xlsx_sheet_row(sheet.row(1))
27
+
28
+ # Lookup values
29
+ (2..sheet.last_row).each do |row_no|
30
+
31
+ store_translations_from_xlsx_row(sheet.row(row_no), locales)
32
+
33
+ end # rows
34
+
35
+ end # sheets
36
+
37
+ end # import
38
+
39
+ private
40
+
41
+ def locales_from_xlsx_sheet_row row
42
+ locales = []
43
+ row.each_with_index do |cell, i|
44
+ if i > 0
45
+ locales.push(cell.downcase)
46
+ end
47
+ end
48
+ locales
49
+ end
50
+
51
+ def store_translations_from_xlsx_row row, locales
52
+ locale = nil
53
+ key = nil
54
+ value = nil
55
+
56
+ row.each_with_index do |cell, i|
57
+ if i == 0
58
+ key = cell
59
+ else
60
+ locale = locales[ i - 1 ]
61
+ store_translation_from_xlsx_cell locale, key, cell
62
+ end
63
+ end
64
+ end
65
+
66
+ def store_translation_from_xlsx_cell locale, key, cell
67
+ value = cell.nil? ? '' : cell
68
+ # value = cell
69
+
70
+ if locale.present? && key.present?
71
+ translation = Translation.find_or_initialize_by locale: locale, key: key
72
+ if translation.value != value
73
+ translation.value = value
74
+ translation.save
75
+ end
76
+ end
77
+ end
78
+
79
+ end
80
+ end
81
+
82
+ Translation.send(:include, Importer)
83
+ end
84
+ end
85
+ end
@@ -1,5 +1,7 @@
1
1
  require 'i18n/backend/base'
2
2
  require 'i18n/backend/weeler/translation'
3
+ require 'i18n/backend/weeler/exporter'
4
+ require 'i18n/backend/weeler/importer'
3
5
 
4
6
  module I18n
5
7
  module Backend
@@ -8,6 +10,8 @@ module I18n
8
10
 
9
11
  autoload :StoreProcs, 'i18n/backend/weeler/store_procs'
10
12
  autoload :Translation, 'i18n/backend/weeler/translation'
13
+ autoload :Exporter, 'i18n/backend/weeler/exporter'
14
+ autoload :Importer, 'i18n/backend/weeler/importer'
11
15
 
12
16
  module Implementation
13
17
  include Base, Flatten
data/lib/weeler/.DS_Store CHANGED
Binary file
@@ -15,7 +15,7 @@ module Weeler::RouteMapper
15
15
  mount_translations_controller
16
16
 
17
17
  root :to => "home#index"
18
- get "/about" => "home#about"
18
+ get "/home/about"
19
19
 
20
20
  yield if block_given?
21
21
  end
@@ -1,3 +1,3 @@
1
1
  module Weeler
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/rspec.html CHANGED
@@ -281,174 +281,252 @@ a {
281
281
  <div class="results">
282
282
  <div id="div_group_1" class="example_group passed">
283
283
  <dl style="margin-left: 0px;">
284
- <dt id="example_group_1" class="passed">I18n::Backend::Weeler</dt>
284
+ <dt id="example_group_1" class="passed">I18n::Backend::Weeler::Importer</dt>
285
285
  </dl>
286
286
  </div>
287
287
  <div id="div_group_2" class="example_group passed">
288
288
  <dl style="margin-left: 15px;">
289
- <dt id="example_group_2" class="passed">groups</dt>
290
- <script type="text/javascript">moveProgressBar('3.1');</script>
291
- <dd class="example passed"><span class="passed_spec_name">returns 2 groups</span><span class='duration'>0.06468s</span></dd>
292
- <script type="text/javascript">moveProgressBar('6.2');</script>
293
- <dd class="example passed"><span class="passed_spec_name">returns ordered list</span><span class='duration'>0.00307s</span></dd>
289
+ <dt id="example_group_2" class="passed">import</dt>
294
290
  </dl>
295
291
  </div>
296
292
  <div id="div_group_3" class="example_group passed">
297
- <dl style="margin-left: 15px;">
298
- <dt id="example_group_3" class="passed">#value</dt>
299
- <script type="text/javascript">moveProgressBar('9.3');</script>
300
- <dd class="example passed"><span class="passed_spec_name">returns boolean if translation boolean</span><span class='duration'>0.01267s</span></dd>
293
+ <dl style="margin-left: 30px;">
294
+ <dt id="example_group_3" class="passed">empty db</dt>
295
+ <script type="text/javascript">moveProgressBar('2.1');</script>
296
+ <dd class="example passed"><span class="passed_spec_name">returns nil if value is not file</span><span class='duration'>0.58697s</span></dd>
297
+ <script type="text/javascript">moveProgressBar('4.3');</script>
298
+ <dd class="example passed"><span class="passed_spec_name">returns value if value is in file</span><span class='duration'>0.19564s</span></dd>
299
+ <script type="text/javascript">moveProgressBar('6.5');</script>
300
+ <dd class="example passed"><span class="passed_spec_name">translation stores all translation in each locale</span><span class='duration'>0.16968s</span></dd>
301
301
  </dl>
302
302
  </div>
303
303
  <div id="div_group_4" class="example_group passed">
304
- <dl style="margin-left: 15px;">
305
- <dt id="example_group_4" class="passed">#lookup</dt>
306
- <script type="text/javascript">moveProgressBar('12.5');</script>
307
- <dd class="example passed"><span class="passed_spec_name">returns translation</span><span class='duration'>0.01081s</span></dd>
304
+ <dl style="margin-left: 30px;">
305
+ <dt id="example_group_4" class="passed">full db</dt>
306
+ <script type="text/javascript">moveProgressBar('8.6');</script>
307
+ <dd class="example passed"><span class="passed_spec_name">file import overrides value</span><span class='duration'>0.88694s</span></dd>
308
308
  </dl>
309
309
  </div>
310
310
  <div id="div_group_5" class="example_group passed">
311
- <dl style="margin-left: 30px;">
312
- <dt id="example_group_5" class="passed">missing translations</dt>
313
- <script type="text/javascript">moveProgressBar('15.6');</script>
314
- <dd class="example passed"><span class="passed_spec_name">creates no stub for base key in pluralization</span><span class='duration'>0.02498s</span></dd>
315
- <script type="text/javascript">moveProgressBar('18.7');</script>
316
- <dd class="example passed"><span class="passed_spec_name">creates one stub per pluralization</span><span class='duration'>0.01646s</span></dd>
317
- <script type="text/javascript">moveProgressBar('21.8');</script>
318
- <dd class="example passed"><span class="passed_spec_name">lookup persists interpolation keys when looked up directly</span><span class='duration'>0.01091s</span></dd>
319
- <script type="text/javascript">moveProgressBar('25.0');</script>
320
- <dd class="example passed"><span class="passed_spec_name">creates a stub when a custom separator is used and the key contains the flatten separator (a dot character)</span><span class='duration'>0.01956s</span></dd>
321
- <script type="text/javascript">moveProgressBar('28.1');</script>
322
- <dd class="example passed"><span class="passed_spec_name">lookup does not persist the key twice</span><span class='duration'>0.03272s</span></dd>
323
- <script type="text/javascript">moveProgressBar('31.2');</script>
324
- <dd class="example passed"><span class="passed_spec_name">creates a stub when a custom separator is used</span><span class='duration'>0.01748s</span></dd>
325
- <script type="text/javascript">moveProgressBar('34.3');</script>
326
- <dd class="example passed"><span class="passed_spec_name">persists the key</span><span class='duration'>0.01090s</span></dd>
327
- <script type="text/javascript">moveProgressBar('37.5');</script>
328
- <dd class="example passed"><span class="passed_spec_name">creates a stub per pluralization when a custom separator is used</span><span class='duration'>0.01778s</span></dd>
311
+ <dl style="margin-left: 0px;">
312
+ <dt id="example_group_5" class="passed">I18n::Backend::Weeler</dt>
329
313
  </dl>
330
314
  </div>
331
315
  <div id="div_group_6" class="example_group passed">
332
316
  <dl style="margin-left: 15px;">
333
- <dt id="example_group_6" class="passed">#store_translations</dt>
334
- <script type="text/javascript">moveProgressBar('40.6');</script>
335
- <dd class="example passed"><span class="passed_spec_name">finds one locale</span><span class='duration'>0.00380s</span></dd>
336
- <script type="text/javascript">moveProgressBar('43.7');</script>
337
- <dd class="example passed"><span class="passed_spec_name">finds all existing locales if theres is translations in other locale</span><span class='duration'>0.01015s</span></dd>
317
+ <dt id="example_group_6" class="passed">#lookup</dt>
318
+ <script type="text/javascript">moveProgressBar('10.8');</script>
319
+ <dd class="example passed"><span class="passed_spec_name">show warning</span><span class='duration'>0.00376s</span></dd>
338
320
  </dl>
339
321
  </div>
340
322
  <div id="div_group_7" class="example_group passed">
341
323
  <dl style="margin-left: 15px;">
342
324
  <dt id="example_group_7" class="passed">#store_translations</dt>
343
- <script type="text/javascript">moveProgressBar('46.8');</script>
344
- <dd class="example passed"><span class="passed_spec_name">can store translations with keys that are translations containing special chars</span><span class='duration'>0.01052s</span></dd>
345
- <script type="text/javascript">moveProgressBar('50.0');</script>
346
- <dd class="example passed"><span class="passed_spec_name">store_translations does not allow ambiguous keys (2)</span><span class='duration'>0.02366s</span></dd>
347
- <script type="text/javascript">moveProgressBar('53.1');</script>
348
- <dd class="example passed"><span class="passed_spec_name">store_translations does not allow ambiguous keys (1)</span><span class='duration'>0.02659s</span></dd>
325
+ <script type="text/javascript">moveProgressBar('13.0');</script>
326
+ <dd class="example passed"><span class="passed_spec_name">can store translations with keys that are translations containing special chars</span><span class='duration'>0.01046s</span></dd>
327
+ <script type="text/javascript">moveProgressBar('15.2');</script>
328
+ <dd class="example passed"><span class="passed_spec_name">store_translations does not allow ambiguous keys (2)</span><span class='duration'>0.02359s</span></dd>
329
+ <script type="text/javascript">moveProgressBar('17.3');</script>
330
+ <dd class="example passed"><span class="passed_spec_name">store_translations does not allow ambiguous keys (1)</span><span class='duration'>0.10016s</span></dd>
349
331
  </dl>
350
332
  </div>
351
333
  <div id="div_group_8" class="example_group passed">
352
334
  <dl style="margin-left: 15px;">
353
- <dt id="example_group_8" class="passed">#interpolations</dt>
354
- <script type="text/javascript">moveProgressBar('56.2');</script>
355
- <dd class="example passed"><span class="passed_spec_name">can persist</span><span class='duration'>0.00857s</span></dd>
335
+ <dt id="example_group_8" class="passed">groups</dt>
336
+ <script type="text/javascript">moveProgressBar('19.5');</script>
337
+ <dd class="example passed"><span class="passed_spec_name">returns 2 groups</span><span class='duration'>0.00429s</span></dd>
338
+ <script type="text/javascript">moveProgressBar('21.7');</script>
339
+ <dd class="example passed"><span class="passed_spec_name">returns ordered list</span><span class='duration'>0.00294s</span></dd>
356
340
  </dl>
357
341
  </div>
358
342
  <div id="div_group_9" class="example_group passed">
359
- <dl style="margin-left: 0px;">
360
- <dt id="example_group_9" class="passed">#&lt;ActionDispatch::Routing::RouteSet:0x007f977d133320&gt;</dt>
343
+ <dl style="margin-left: 15px;">
344
+ <dt id="example_group_9" class="passed">#store_translations</dt>
345
+ <script type="text/javascript">moveProgressBar('23.9');</script>
346
+ <dd class="example passed"><span class="passed_spec_name">finds one locale</span><span class='duration'>0.02427s</span></dd>
347
+ <script type="text/javascript">moveProgressBar('26.0');</script>
348
+ <dd class="example passed"><span class="passed_spec_name">finds all existing locales if theres is translations in other locale</span><span class='duration'>0.01160s</span></dd>
361
349
  </dl>
362
350
  </div>
363
351
  <div id="div_group_10" class="example_group passed">
364
352
  <dl style="margin-left: 15px;">
365
- <dt id="example_group_10" class="passed">#weeler_resources</dt>
366
- <script type="text/javascript">moveProgressBar('59.3');</script>
367
- <dd class="example passed"><span class="passed_spec_name">mounts resource show route</span><span class='duration'>0.02922s</span></dd>
368
- <script type="text/javascript">moveProgressBar('62.5');</script>
369
- <dd class="example passed"><span class="passed_spec_name">mounts resource edit route</span><span class='duration'>0.02304s</span></dd>
370
- <script type="text/javascript">moveProgressBar('65.6');</script>
371
- <dd class="example passed"><span class="passed_spec_name">mounts resource new route</span><span class='duration'>0.02662s</span></dd>
372
- <script type="text/javascript">moveProgressBar('68.7');</script>
373
- <dd class="example passed"><span class="passed_spec_name">mounts resource destroy route</span><span class='duration'>0.02793s</span></dd>
374
- <script type="text/javascript">moveProgressBar('71.8');</script>
375
- <dd class="example passed"><span class="passed_spec_name">mounts resource create route</span><span class='duration'>0.02488s</span></dd>
376
- <script type="text/javascript">moveProgressBar('75.0');</script>
377
- <dd class="example passed"><span class="passed_spec_name">mounts resource update route</span><span class='duration'>0.02870s</span></dd>
378
- <script type="text/javascript">moveProgressBar('78.1');</script>
379
- <dd class="example passed"><span class="passed_spec_name">mounts resources index route</span><span class='duration'>0.02287s</span></dd>
353
+ <dt id="example_group_10" class="passed">#interpolations</dt>
354
+ <script type="text/javascript">moveProgressBar('28.2');</script>
355
+ <dd class="example passed"><span class="passed_spec_name">can persist</span><span class='duration'>0.00893s</span></dd>
380
356
  </dl>
381
357
  </div>
382
358
  <div id="div_group_11" class="example_group passed">
383
- <dl style="margin-left: 30px;">
384
- <dt id="example_group_11" class="passed">when destroy route is skiped within with only: option</dt>
385
- <script type="text/javascript">moveProgressBar('81.2');</script>
386
- <dd class="example passed"><span class="passed_spec_name">does not mount destroy confirm route</span><span class='duration'>0.08283s</span></dd>
359
+ <dl style="margin-left: 15px;">
360
+ <dt id="example_group_11" class="passed">#value</dt>
361
+ <script type="text/javascript">moveProgressBar('30.4');</script>
362
+ <dd class="example passed"><span class="passed_spec_name">returns boolean if translation boolean</span><span class='duration'>0.01134s</span></dd>
363
+ <script type="text/javascript">moveProgressBar('32.6');</script>
364
+ <dd class="example passed"><span class="passed_spec_name">runs kernel if translation is_proc</span><span class='duration'>0.00962s</span></dd>
387
365
  </dl>
388
366
  </div>
389
367
  <div id="div_group_12" class="example_group passed">
390
- <dl style="margin-left: 30px;">
391
- <dt id="example_group_12" class="passed">when custom block given</dt>
392
- <script type="text/javascript">moveProgressBar('84.3');</script>
393
- <dd class="example passed"><span class="passed_spec_name">calls it within resources method</span><span class='duration'>0.03564s</span></dd>
368
+ <dl style="margin-left: 15px;">
369
+ <dt id="example_group_12" class="passed">#lookup</dt>
370
+ <script type="text/javascript">moveProgressBar('34.7');</script>
371
+ <dd class="example passed"><span class="passed_spec_name">returns translation</span><span class='duration'>0.00948s</span></dd>
394
372
  </dl>
395
373
  </div>
396
374
  <div id="div_group_13" class="example_group passed">
397
- <dl style="margin-left: 15px;">
398
- <dt id="example_group_13" class="passed">#add_menu_item</dt>
399
- <script type="text/javascript">moveProgressBar('87.5');</script>
400
- <dd class="example passed"><span class="passed_spec_name">adds resource to weeler menu item</span><span class='duration'>0.02361s</span></dd>
375
+ <dl style="margin-left: 30px;">
376
+ <dt id="example_group_13" class="passed">missing translations</dt>
377
+ <script type="text/javascript">moveProgressBar('36.9');</script>
378
+ <dd class="example passed"><span class="passed_spec_name">creates no stub for base key in pluralization</span><span class='duration'>0.01710s</span></dd>
379
+ <script type="text/javascript">moveProgressBar('39.1');</script>
380
+ <dd class="example passed"><span class="passed_spec_name">creates a stub per pluralization when a custom separator is used</span><span class='duration'>0.02004s</span></dd>
381
+ <script type="text/javascript">moveProgressBar('41.3');</script>
382
+ <dd class="example passed"><span class="passed_spec_name">creates a stub when a custom separator is used</span><span class='duration'>0.01689s</span></dd>
383
+ <script type="text/javascript">moveProgressBar('43.4');</script>
384
+ <dd class="example passed"><span class="passed_spec_name">lookup does not persist the key twice</span><span class='duration'>0.01191s</span></dd>
385
+ <script type="text/javascript">moveProgressBar('45.6');</script>
386
+ <dd class="example passed"><span class="passed_spec_name">persists the key</span><span class='duration'>0.01077s</span></dd>
387
+ <script type="text/javascript">moveProgressBar('47.8');</script>
388
+ <dd class="example passed"><span class="passed_spec_name">creates a stub when a custom separator is used and the key contains the flatten separator (a dot character)</span><span class='duration'>0.01611s</span></dd>
389
+ <script type="text/javascript">moveProgressBar('50.0');</script>
390
+ <dd class="example passed"><span class="passed_spec_name">lookup persists interpolation keys when looked up directly</span><span class='duration'>0.01022s</span></dd>
391
+ <script type="text/javascript">moveProgressBar('52.1');</script>
392
+ <dd class="example passed"><span class="passed_spec_name">creates one stub per pluralization</span><span class='duration'>0.01830s</span></dd>
401
393
  </dl>
402
394
  </div>
403
395
  <div id="div_group_14" class="example_group passed">
404
- <dl style="margin-left: 15px;">
405
- <dt id="example_group_14" class="passed">#mount Weeler::Engine</dt>
406
- <script type="text/javascript">moveProgressBar('90.6');</script>
407
- <dd class="example passed"><span class="passed_spec_name">/weeler returns home</span><span class='duration'>0.01702s</span></dd>
396
+ <dl style="margin-left: 0px;">
397
+ <dt id="example_group_14" class="passed">I18n::HumanizeMissingTranslations</dt>
408
398
  </dl>
409
399
  </div>
410
400
  <div id="div_group_15" class="example_group passed">
411
- <dl style="margin-left: 0px;">
412
- <dt id="example_group_15" class="passed">Weeler::TranslationsController</dt>
401
+ <dl style="margin-left: 15px;">
402
+ <dt id="example_group_15" class="passed">.call</dt>
413
403
  </dl>
414
404
  </div>
415
405
  <div id="div_group_16" class="example_group passed">
416
- <dl style="margin-left: 15px;">
417
- <dt id="example_group_16" class="passed">GET #index</dt>
418
- <script type="text/javascript">moveProgressBar('93.7');</script>
419
- <dd class="example passed"><span class="passed_spec_name">list translations</span><span class='duration'>0.04524s</span></dd>
406
+ <dl style="margin-left: 30px;">
407
+ <dt id="example_group_16" class="passed">when exception is I18n::MissingTranslation</dt>
408
+ <script type="text/javascript">moveProgressBar('54.3');</script>
409
+ <dd class="example passed"><span class="passed_spec_name">humanizes missing translations</span><span class='duration'>0.00862s</span></dd>
420
410
  </dl>
421
411
  </div>
422
412
  <div id="div_group_17" class="example_group passed">
423
- <dl style="margin-left: 0px;">
424
- <dt id="example_group_17" class="passed">I18n::HumanizeMissingTranslations</dt>
413
+ <dl style="margin-left: 30px;">
414
+ <dt id="example_group_17" class="passed">when exception is not I18n::MissingTranslation</dt>
415
+ <script type="text/javascript">moveProgressBar('56.5');</script>
416
+ <dd class="example passed"><span class="passed_spec_name">does not intercept it</span><span class='duration'>0.01012s</span></dd>
425
417
  </dl>
426
418
  </div>
427
419
  <div id="div_group_18" class="example_group passed">
428
- <dl style="margin-left: 15px;">
429
- <dt id="example_group_18" class="passed">.call</dt>
420
+ <dl style="margin-left: 0px;">
421
+ <dt id="example_group_18" class="passed">#&lt;ActionDispatch::Routing::RouteSet:0x007f8502f4ca98&gt;</dt>
430
422
  </dl>
431
423
  </div>
432
424
  <div id="div_group_19" class="example_group passed">
433
- <dl style="margin-left: 30px;">
434
- <dt id="example_group_19" class="passed">when exception is I18n::MissingTranslation</dt>
435
- <script type="text/javascript">moveProgressBar('96.8');</script>
436
- <dd class="example passed"><span class="passed_spec_name">humanizes missing translations</span><span class='duration'>0.00878s</span></dd>
425
+ <dl style="margin-left: 15px;">
426
+ <dt id="example_group_19" class="passed">#weeler_resources</dt>
427
+ <script type="text/javascript">moveProgressBar('58.6');</script>
428
+ <dd class="example passed"><span class="passed_spec_name">mounts resource edit route</span><span class='duration'>0.09011s</span></dd>
429
+ <script type="text/javascript">moveProgressBar('60.8');</script>
430
+ <dd class="example passed"><span class="passed_spec_name">mounts resource update route</span><span class='duration'>0.02388s</span></dd>
431
+ <script type="text/javascript">moveProgressBar('63.0');</script>
432
+ <dd class="example passed"><span class="passed_spec_name">mounts resource show route</span><span class='duration'>0.02833s</span></dd>
433
+ <script type="text/javascript">moveProgressBar('65.2');</script>
434
+ <dd class="example passed"><span class="passed_spec_name">mounts resource create route</span><span class='duration'>0.02147s</span></dd>
435
+ <script type="text/javascript">moveProgressBar('67.3');</script>
436
+ <dd class="example passed"><span class="passed_spec_name">mounts resources index route</span><span class='duration'>0.02088s</span></dd>
437
+ <script type="text/javascript">moveProgressBar('69.5');</script>
438
+ <dd class="example passed"><span class="passed_spec_name">mounts resource new route</span><span class='duration'>0.02322s</span></dd>
439
+ <script type="text/javascript">moveProgressBar('71.7');</script>
440
+ <dd class="example passed"><span class="passed_spec_name">mounts resource destroy route</span><span class='duration'>0.02233s</span></dd>
437
441
  </dl>
438
442
  </div>
439
443
  <div id="div_group_20" class="example_group passed">
440
444
  <dl style="margin-left: 30px;">
441
- <dt id="example_group_20" class="passed">when exception is not I18n::MissingTranslation</dt>
445
+ <dt id="example_group_20" class="passed">when destroy route is skiped within with only: option</dt>
446
+ <script type="text/javascript">moveProgressBar('73.9');</script>
447
+ <dd class="example passed"><span class="passed_spec_name">does not mount destroy confirm route</span><span class='duration'>0.02884s</span></dd>
448
+ </dl>
449
+ </div>
450
+ <div id="div_group_21" class="example_group passed">
451
+ <dl style="margin-left: 30px;">
452
+ <dt id="example_group_21" class="passed">when custom block given</dt>
453
+ <script type="text/javascript">moveProgressBar('76.0');</script>
454
+ <dd class="example passed"><span class="passed_spec_name">calls it within resources method</span><span class='duration'>0.03133s</span></dd>
455
+ </dl>
456
+ </div>
457
+ <div id="div_group_22" class="example_group passed">
458
+ <dl style="margin-left: 15px;">
459
+ <dt id="example_group_22" class="passed">#add_menu_item</dt>
460
+ <script type="text/javascript">moveProgressBar('78.2');</script>
461
+ <dd class="example passed"><span class="passed_spec_name">adds resource to weeler menu item</span><span class='duration'>0.01680s</span></dd>
462
+ </dl>
463
+ </div>
464
+ <div id="div_group_23" class="example_group passed">
465
+ <dl style="margin-left: 15px;">
466
+ <dt id="example_group_23" class="passed">#mount Weeler::Engine</dt>
467
+ <script type="text/javascript">moveProgressBar('80.4');</script>
468
+ <dd class="example passed"><span class="passed_spec_name">/weeler returns home</span><span class='duration'>0.02213s</span></dd>
469
+ </dl>
470
+ </div>
471
+ <div id="div_group_24" class="example_group passed">
472
+ <dl style="margin-left: 0px;">
473
+ <dt id="example_group_24" class="passed">I18n::Backend::Weeler::Exporter</dt>
474
+ </dl>
475
+ </div>
476
+ <div id="div_group_25" class="example_group passed">
477
+ <dl style="margin-left: 15px;">
478
+ <dt id="example_group_25" class="passed">as_xlsx_package</dt>
479
+ </dl>
480
+ </div>
481
+ <div id="div_group_26" class="example_group passed">
482
+ <dl style="margin-left: 30px;">
483
+ <dt id="example_group_26" class="passed">all translations</dt>
484
+ <script type="text/javascript">moveProgressBar('82.6');</script>
485
+ <dd class="example passed"><span class="passed_spec_name">should have 3 rows</span><span class='duration'>0.00417s</span></dd>
486
+ <script type="text/javascript">moveProgressBar('84.7');</script>
487
+ <dd class="example passed"><span class="passed_spec_name">other row with one translation</span><span class='duration'>0.00298s</span></dd>
488
+ <script type="text/javascript">moveProgressBar('86.9');</script>
489
+ <dd class="example passed"><span class="passed_spec_name">first row should be title</span><span class='duration'>0.00296s</span></dd>
490
+ <script type="text/javascript">moveProgressBar('89.1');</script>
491
+ <dd class="example passed"><span class="passed_spec_name">other row with two translation</span><span class='duration'>0.00406s</span></dd>
492
+ </dl>
493
+ </div>
494
+ <div id="div_group_27" class="example_group passed">
495
+ <dl style="margin-left: 30px;">
496
+ <dt id="example_group_27" class="passed">selected translations</dt>
497
+ <script type="text/javascript">moveProgressBar('91.3');</script>
498
+ <dd class="example passed"><span class="passed_spec_name">other row with one translation</span><span class='duration'>0.00464s</span></dd>
499
+ <script type="text/javascript">moveProgressBar('93.4');</script>
500
+ <dd class="example passed"><span class="passed_spec_name">first row should be title</span><span class='duration'>0.00315s</span></dd>
501
+ <script type="text/javascript">moveProgressBar('95.6');</script>
502
+ <dd class="example passed"><span class="passed_spec_name">should have 2 rows</span><span class='duration'>0.00336s</span></dd>
503
+ </dl>
504
+ </div>
505
+ <div id="div_group_28" class="example_group passed">
506
+ <dl style="margin-left: 0px;">
507
+ <dt id="example_group_28" class="passed">Weeler::TranslationsController</dt>
508
+ </dl>
509
+ </div>
510
+ <div id="div_group_29" class="example_group passed">
511
+ <dl style="margin-left: 15px;">
512
+ <dt id="example_group_29" class="passed">#create</dt>
513
+ <script type="text/javascript">moveProgressBar('97.8');</script>
514
+ <dd class="example passed"><span class="passed_spec_name">creates translation in DB</span><span class='duration'>0.06616s</span></dd>
515
+ </dl>
516
+ </div>
517
+ <div id="div_group_30" class="example_group passed">
518
+ <dl style="margin-left: 15px;">
519
+ <dt id="example_group_30" class="passed">GET #index</dt>
442
520
  <script type="text/javascript">moveProgressBar('100.0');</script>
443
- <dd class="example passed"><span class="passed_spec_name">does not intercept it</span><span class='duration'>0.01064s</span></dd>
521
+ <dd class="example passed"><span class="passed_spec_name">list translations</span><span class='duration'>0.08256s</span></dd>
444
522
  </dl>
445
523
  </div>
446
- <script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>0.79789 seconds</strong>";</script>
447
- <script type="text/javascript">document.getElementById('totals').innerHTML = "32 examples, 0 failures";</script>
524
+ <script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>2.78218 seconds</strong>";</script>
525
+ <script type="text/javascript">document.getElementById('totals').innerHTML = "46 examples, 0 failures";</script>
448
526
  </div>
449
527
  </div>
450
528
  </body>
451
529
  </html>
452
530
 
453
- Randomized with seed 37300
531
+ Randomized with seed 18495
454
532
 
data/spec/.DS_Store CHANGED
Binary file
@@ -21,9 +21,14 @@ describe Weeler::TranslationsController do
21
21
  end
22
22
 
23
23
  describe "#create" do
24
- # it "creates translation in DB" do
25
- # post :create, i18n_backend_weeler_translation: FactoryGirl.attributes_for(:translation)
26
- # end
24
+ it "creates translation in DB" do
25
+ expect(I18n.t("title", locale: :en)).to eq("Title")
26
+ I18n::Backend::Weeler::Translation.delete_all
27
+
28
+ post :create, i18n_backend_weeler_translation: FactoryGirl.attributes_for(:translation)
29
+
30
+ expect(I18n.t("title", locale: :en)).to eq("This is weeler")
31
+ end
27
32
  end
28
33
 
29
34
  describe "#update" do
Binary file