awesome_translations 0.0.58 → 0.0.59

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -1
  3. data/app/controllers/awesome_translations/groups_controller.rb +1 -0
  4. data/app/controllers/awesome_translations/handlers_controller.rb +1 -0
  5. data/app/helpers/awesome_translations/application_helper.rb +0 -1
  6. data/app/models/awesome_translations/group.rb +2 -2
  7. data/app/models/awesome_translations/translated_value.rb +4 -1
  8. data/app/models/awesome_translations/translation.rb +9 -4
  9. data/app/views/awesome_translations/duplicates/index.html.erb +2 -2
  10. data/app/views/awesome_translations/groups/show.html.erb +9 -4
  11. data/app/views/awesome_translations/handler_translations/index.html.erb +21 -6
  12. data/app/views/awesome_translations/handlers/show.html.erb +29 -6
  13. data/app/views/awesome_translations/movals/index.html.erb +2 -2
  14. data/lib/awesome_translations.rb +1 -1
  15. data/lib/awesome_translations/cache_database_generator.rb +2 -2
  16. data/lib/awesome_translations/cache_database_generator/group.rb +1 -1
  17. data/lib/awesome_translations/cache_database_generator/handler_translation.rb +2 -0
  18. data/lib/awesome_translations/config.rb +3 -3
  19. data/lib/awesome_translations/engine.rb +0 -4
  20. data/lib/awesome_translations/erb_inspector.rb +1 -0
  21. data/lib/awesome_translations/global_translator.rb +9 -23
  22. data/lib/awesome_translations/handlers.rb +1 -0
  23. data/lib/awesome_translations/handlers/file_handler.rb +1 -0
  24. data/lib/awesome_translations/handlers/model_handler.rb +1 -1
  25. data/lib/awesome_translations/handlers/validations_handler.rb +1 -1
  26. data/lib/awesome_translations/model_inspector.rb +8 -5
  27. data/lib/awesome_translations/translation_migrator.rb +1 -1
  28. data/lib/awesome_translations/version.rb +1 -1
  29. data/lib/tasks/awesome_translations_tasks.rake +1 -1
  30. data/spec/controllers/groups_controller_spec.rb +5 -5
  31. data/spec/controllers/handlers_controller_spec.rb +1 -1
  32. data/spec/dummy/Rakefile +1 -1
  33. data/spec/dummy/app/assets/config/manifest.js +3 -0
  34. data/spec/dummy/app/controllers/users_controller.rb +1 -1
  35. data/spec/dummy/app/mailers/my_mailer.rb +1 -1
  36. data/spec/dummy/app/models/application_record.rb +3 -0
  37. data/spec/dummy/app/models/role.rb +1 -1
  38. data/spec/dummy/app/models/user.rb +1 -1
  39. data/spec/dummy/bin/bundle +1 -1
  40. data/spec/dummy/bin/rails +1 -1
  41. data/spec/dummy/config/application.rb +7 -2
  42. data/spec/dummy/config/boot.rb +2 -2
  43. data/spec/dummy/config/environment.rb +1 -1
  44. data/spec/dummy/db/awesome_translations.sqlite3 +0 -0
  45. data/spec/dummy/db/development.sqlite3 +0 -0
  46. data/spec/dummy/db/test.sqlite3 +0 -0
  47. data/spec/dummy/log/development.log +79 -0
  48. data/spec/dummy/log/test.log +1910 -0
  49. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/-o/-oFcVYifzG9CN5_s1hdowmNEkOY9nMkeYSN1wi8jK9k.cache +0 -0
  50. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/0-/0-1MiAUTzmkJ19QVNrjLw3HNw2Cu4279NlmUcUv0lnU.cache +1 -0
  51. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/1R/1RUC_iIhcuw4UJeKhOqLFN8264iDG1axfV3uVyPv0wg.cache +1 -0
  52. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/2m/2mnPY9uUnBNkGHLxtFaWv5hB3oA7sY2K1ZtwQlZLnAY.cache +2 -0
  53. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/3N/3NnKgR2TsTI1qCXKZpts0uJzp2dRJcoYp3nnFU6YE4o.cache +2 -0
  54. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/5U/5U8HCshUrO4uN8GT_N4K-MtrOiG-4cWdiepxNuvIjAw.cache +1 -0
  55. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/6y/6y2qhWDpnSTpsocv2lVSclXFxpCRU78VjU0sy2FGrWc.cache +0 -0
  56. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/8f/8f4REKYOWkNfHexyAVqGXnbOP3vky_ANapWzlRMDeQ4.cache +3 -0
  57. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/8p/8pzZq0f95KJrJtOmdr_19FPTeyHX3zMnw6Epsu3T_6c.cache +1 -0
  58. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/8x/8xTH_c2XZMdMXFHSjlUQD4pTAYTNqnrTrjDURs8jlFI.cache +1 -0
  59. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/AC/ACPB0Rs6DHQU6RIjgT-BODcpFLYUC_sPb9CvJGvg6ro.cache +1 -0
  60. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/AJ/AJ3ShPZKDgRfZy8niYD_tk4u0Ur5Y6oC85d-0oXgc3w.cache +1 -0
  61. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/AU/AUklJJKwz_vqy3TUoKDyB5ounU8pAqv6-_tES3aPoZ8.cache +0 -0
  62. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/CP/CPuNl6dzr9CzS_s74a_K5yuTPy1ch0_-ehTglX1zaEE.cache +1 -0
  63. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/CV/CVBUxdOogbkuDTae7pFS7i66HyowCSP07Os91LwRmHY.cache +0 -0
  64. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Ca/CaGQBiCuFgkHQ5gw8ZnGQqO8iP1md3GcllDsmaKBFdQ.cache +2 -0
  65. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Do/Do83AoOat5W-c1g7piDGy2GMmffsY6JY0Qfuh5PY3GM.cache +2 -0
  66. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/ER/EREGJziB-yMwOXwJeDrZ6Tie8HJU33_JSMXwzy7JsG4.cache +0 -0
  67. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Fc/FcJbnT7qHcLV5Zp_u7NV_yomOI9o9yG-F00bV0Gzm_Q.cache +1 -0
  68. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Mj/MjwYGG9GkHD1fwwH2bg66EBYl3zCA_mqeDF9otey4-U.cache +3 -0
  69. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/O6/O6K_G66TEscDh-j-DIIwfAqivslF8smPlcj9dJCvrh4.cache +0 -0
  70. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/O6/O6zA2BS4Y306Mmq4fuRnINim1pUdJgZvv_GJkGYXFxw.cache +1 -0
  71. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Ql/QlbxNnG-vjEDZ8GyOJHhNZY-GeHvDiuCj8IATbE9C8w.cache +1 -0
  72. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/S5/S57ilTeMjIW4abqhMiTmEi59zjS9uSXp697eO1D1Wjo.cache +1 -0
  73. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/S8/S86Mp1PRbiyejdN42WqWkRnoIoKRl4WoqM5lKxqw1w4.cache +1 -0
  74. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Sb/Sb1Vug319YfPL2Rci1PLMLXJjeIFYcNbHb5hKOvO1eo.cache +2 -0
  75. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/TC/TCAloV783-iAe72Q34cyIRfs-xPaNfSgPcPF2dl-zYI.cache +0 -0
  76. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Xn/Xn4epb06guWXnirWNYPta7ddzOkxd1aVDzRMoXp8pjM.cache +1 -0
  77. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/aa/aaoYFMRQGOYTpfFXf34S0CVVWaAJUx6s8QsSHm476OQ.cache +1 -0
  78. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/cK/cK9VEAGHFBzTxd0ICAK2Fv9RWWgiv9I6347by_BYm1w.cache +0 -0
  79. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/gc/gcjjMGVBrPIbM3oh-VsmXt-W8kWTs2Hc0sM2r5hicgQ.cache +1 -0
  80. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/hc/hc75Wwlo1W1FF6zeSSelZ-DXn-n6YkTrvq3_yoXpydw.cache +0 -0
  81. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/iF/iFAZApKjMydtC8Y6hvIXTy-zC2cfmbTrsYlU62u8sJU.cache +1 -0
  82. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/iR/iRIYdMKKwG2D6Tnj-0pGybHLEINmWZ8211nkI700-0Y.cache +0 -0
  83. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/l2/l2s6YvBxO6tXxM01zv13Dv6jpXaksukCd31VGPl6vPI.cache +1 -0
  84. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/mX/mXfx3VRudxpXrRx1aejtNA5YHOwND3kwWUfvdXHSors.cache +2 -0
  85. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/p7/p70iWC7uyeRLwIEniw-3RltmTZ-lz45IJdePewoXyHY.cache +0 -0
  86. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/pv/pv6tV3CDkIAmLXdU8EPLlNEkXAKJPufVD4VP30o4fWo.cache +2 -0
  87. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/q6/q6BYa32YJF11eGVapO4ouNl6gayPIsARgMavlzZmoi0.cache +2 -0
  88. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/qZ/qZ6ZFXF-wqwyHA2DvJW0tnnFPW-sRmoNY7ysyNfUdi0.cache +1 -0
  89. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/rH/rH2d5ogZr608pUvHYHKRlqMZTk7BNi8Qp5nL1PLrir8.cache +0 -0
  90. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/rI/rITk_65QtUwq61bjRPAksGeJxbLUFfz-sFPnQiZPHjw.cache +3 -0
  91. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/sH/sHqNaY2cQIVvwCv9thQRcI9KaeVjzBt9-dJ8mKnCKMk.cache +0 -0
  92. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/x7/x7KkTV3ibfIEysLB_ug5bfmnn2VLV_BldukPR3EoPBk.cache +2 -0
  93. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/xk/xkvAEoJDntdxUR56voDrW44MZ8Cx6i9WXQXrLDh2A_w.cache +2 -0
  94. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/za/zaxpzmSeETtWCbb5X2jLBDtr4Ei16ZUatImF5HE6Mpo.cache +1 -0
  95. data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/zh/zhMgApDdWwFGN9H6KcXRKPtCaQtDHW91V9n3vt_EhoA.cache +1 -0
  96. data/spec/factories/group.rb +2 -2
  97. data/spec/factories/handler.rb +4 -4
  98. data/spec/factories/handler_translation.rb +5 -5
  99. data/spec/factories/translation_key.rb +1 -1
  100. data/spec/factories/translation_value.rb +3 -3
  101. data/spec/features/clean_ups_spec.rb +1 -1
  102. data/spec/features/duplicates_spec.rb +4 -4
  103. data/spec/features/movals_spec.rb +4 -4
  104. data/spec/handlers/file_handler_spec.rb +6 -6
  105. data/spec/handlers/model_handler_spec.rb +2 -2
  106. data/spec/handlers/validations_handler_spec.rb +3 -3
  107. data/spec/handlers_spec.rb +1 -1
  108. data/spec/lib/cache_database_generator_spec.rb +3 -3
  109. data/spec/lib/erb_inspector/translation_inspector_spec.rb +1 -1
  110. data/spec/lib/erb_inspector_spec.rb +5 -5
  111. data/spec/lib/model_inspector_spec.rb +4 -4
  112. data/spec/lib/translation_migrator_spec.rb +2 -2
  113. data/spec/models/awesome_translations/handler_spec.rb +1 -1
  114. data/spec/models/awesome_translations/translation_spec.rb +7 -2
  115. data/spec/spec_helper.rb +8 -6
  116. metadata +179 -93
  117. data/config/initializers/simple_form_ransack.rb +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97aa6b7fa7187a62074783131b5e97ce86c977a74a18407c02efae5bdfc80928
4
- data.tar.gz: 15be14431991a55fcef0aade82bcff5c8952f7781f20f5853218d4a84c1389c2
3
+ metadata.gz: 630fd6805a59fe0e501a01e85fec405e0c74e969334a64183fd5e001a2a86f19
4
+ data.tar.gz: c3e9fc60d2af9574536759378db9891ba6bb6297696e79357280f1fc2feddddc
5
5
  SHA512:
6
- metadata.gz: 3200002a0574f45b587fa8839e6ab9f11fc117c8c3e6382430982467539a6bfbf9d2d18d7da52891ab44acfd9beecac706f138fedbdfcb34a75ecb0c327599ca
7
- data.tar.gz: 74d08ebb996d3f11892e6d7260d431532d1584c495195302b4bd454c9fb83954e80e8e464ba2ccc506a519a1f7f781ba3b456f7f3bf82699608dfc621e482b4e
6
+ metadata.gz: 37c3afd48491b25cebe63b263454e32845548c1aca9ddcc6a9cadbfb1a116ce8aa74899a8084ab74770ab639ed01287fb91d1ca6e9913d3ef29fba845fe53325
7
+ data.tar.gz: 7b612ecd73272de814ca2725fc10693468811ffddf6601f572da56718078b1f108ce3a7b7682ac05eafc4257a3b0a860f7eb6efa36c3c36fa304171a8f0375ff
data/Rakefile CHANGED
@@ -14,7 +14,7 @@ RDoc::Task.new(:rdoc) do |rdoc|
14
14
  rdoc.rdoc_files.include("lib/**/*.rb")
15
15
  end
16
16
 
17
- APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
17
+ APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
18
18
  load "rails/tasks/engine.rake"
19
19
 
20
20
 
@@ -14,6 +14,7 @@ class AwesomeTranslations::GroupsController < AwesomeTranslations::ApplicationCo
14
14
  @group.handler_translations.each do |translation|
15
15
  values = values_from_translation(translation)
16
16
  next unless values
17
+
17
18
  save_values(translation, values)
18
19
  end
19
20
 
@@ -16,6 +16,7 @@ class AwesomeTranslations::HandlersController < AwesomeTranslations::Application
16
16
  generator = AwesomeTranslations::CacheDatabaseGenerator.current
17
17
  generator.update_handlers do |handler_model|
18
18
  next unless handler_model.identifier == @handler.identifier
19
+
19
20
  generator.update_groups_for_handler(handler_model)
20
21
  end
21
22
 
@@ -2,7 +2,6 @@ require "baza_models"
2
2
 
3
3
  module ::AwesomeTranslations::ApplicationHelper
4
4
  include BazaModels::Helpers::RansackerHelper
5
- include SimpleFormRansackHelper
6
5
 
7
6
  def flash_message_class(type)
8
7
  type = type.to_s
@@ -1,7 +1,7 @@
1
1
  class AwesomeTranslations::Group
2
2
  attr_reader :handler, :id, :data
3
3
 
4
- def self.find_by_handler_and_id(handler, id)
4
+ def self.find_by(handler:, id:)
5
5
  handler.groups.each do |group|
6
6
  return group if group.id == id.to_s
7
7
  end
@@ -13,7 +13,7 @@ class AwesomeTranslations::Group
13
13
  @handler = args.fetch(:handler)
14
14
  @id = args.fetch(:id)
15
15
  @data = args[:data] || {}
16
- raise "Invalid ID: #{@id}" unless @id.present?
16
+ raise "Invalid ID: #{@id}" if @id.blank?
17
17
  end
18
18
 
19
19
  def translations(args = {})
@@ -17,17 +17,20 @@ class AwesomeTranslations::TranslatedValue
17
17
  alias inspect to_s
18
18
 
19
19
  def array_translation?
20
- return true if @key =~ /\[(\d+)\]\Z/
20
+ return true if /\[(\d+)\]\Z/.match?(@key)
21
+
21
22
  false
22
23
  end
23
24
 
24
25
  def array_key
25
26
  return unless (match = @key.match(/\A(.+)\[(\d+)\]\Z/))
27
+
26
28
  match[1]
27
29
  end
28
30
 
29
31
  def array_no
30
32
  return unless (match = @key.match(/\A(.+)\[(\d+)\]\Z/))
33
+
31
34
  match[2].to_i
32
35
  end
33
36
 
@@ -11,7 +11,7 @@ class AwesomeTranslations::Translation
11
11
  @key_show = data[:key_show]
12
12
  @default = data[:default]
13
13
 
14
- raise "Dir wasn't valid: '#{@dir}'." unless @dir.present?
14
+ raise "Dir wasn't valid: '#{@dir}'." if @dir.blank?
15
15
  end
16
16
 
17
17
  def last_key
@@ -23,17 +23,20 @@ class AwesomeTranslations::Translation
23
23
  end
24
24
 
25
25
  def array_translation?
26
- return true if @key =~ /\[(\d+)\]\Z/
26
+ return true if /\[(\d+)\]\Z/.match?(@key)
27
+
27
28
  false
28
29
  end
29
30
 
30
31
  def array_key
31
32
  return unless (match = @key.match(/\A(.+)\[(\d+)\]\Z/))
33
+
32
34
  match[1]
33
35
  end
34
36
 
35
37
  def array_no
36
38
  return unless (match = @key.match(/\A(.+)\[(\d+)\]\Z/))
39
+
37
40
  match[2].to_i
38
41
  end
39
42
 
@@ -65,6 +68,7 @@ class AwesomeTranslations::Translation
65
68
  def finished?
66
69
  I18n.available_locales.each do |locale|
67
70
  next if value_for?(locale)
71
+
68
72
  return false
69
73
  end
70
74
 
@@ -94,14 +98,15 @@ class AwesomeTranslations::Translation
94
98
  return nil unless value_for?(locale)
95
99
 
96
100
  if array_translation?
97
- I18n.with_locale(locale) { I18n.t(array_key)[array_no] }
101
+ I18n.with_locale(locale) { I18n.t(array_key, default: [])[array_no] }
98
102
  else
99
- I18n.with_locale(locale) { I18n.t(@key) }
103
+ I18n.with_locale(locale) { I18n.t(@key, default: nil, fallback: false) }
100
104
  end
101
105
  end
102
106
 
103
107
  def file_line_content?
104
108
  return true if @full_path && @line_no && File.exist?(@full_path)
109
+
105
110
  false
106
111
  end
107
112
 
@@ -1,6 +1,6 @@
1
1
  <% content_for(:header_title) { "Duplicates" } %>
2
2
 
3
- <%= simple_form_for :duplicates do |f| %>
3
+ <%= form_tag do %>
4
4
  <% count = 0 %>
5
5
 
6
6
  <div class="panel panel-default">
@@ -46,7 +46,7 @@
46
46
  <% if count > 0 %>
47
47
  <div class="panel panel-default">
48
48
  <div class="panel-body">
49
- <%= f.button :submit, "Delete duplicates" %>
49
+ <input class="btn btn-primary" type="submit" value="Delete duplicates" />
50
50
  </div>
51
51
  </div>
52
52
  <% end %>
@@ -14,10 +14,15 @@
14
14
  </div>
15
15
  </div>
16
16
  <div class="panel-body">
17
- <%= simple_form_for :q, method: :get do |f| %>
18
- <%= f.input :translation_key_key_cont, label: "Key contains", input_html: {value: @ransack_params[:translation_key_key_cont]}, autofocus: true %>
19
- <%= f.button :submit, "Filter", class: ["btn", "btn-primary"] %>
20
- <% end %>
17
+ <form method="get">
18
+ <div class="form-group">
19
+ <label for="q_translation_key_key_cont">
20
+ Key contains
21
+ </label>
22
+ <input class="form-control" id="q_translation_key_key_cont" name="q[translation_key_key_cont]" value="<%= params.dig(:q, :translation_key_key_cont) %>" />
23
+ </div>
24
+ <input class="btn btn-primary" type="submit" value="filter" />
25
+ </form>
21
26
  </div>
22
27
  </div>
23
28
 
@@ -7,12 +7,27 @@
7
7
  </div>
8
8
  </div>
9
9
  <div class="panel-body">
10
- <%= simple_search_form_for @ransack do |f| %>
11
- <%= f.input :translation_key_key_cont, label: "Key", autofocus: true %>
12
- <%= f.input :handler_name_cont %>
13
- <%= f.input :group_name_cont %>
14
- <%= f.button :submit, "Filter", class: ["btn", "btn-primary"] %>
15
- <% end %>
10
+ <form method="get">
11
+ <div class="form-group">
12
+ <label for="q_translation_key_key_cont">
13
+ Key contains
14
+ </label>
15
+ <input class="form-control" id="q_translation_key_key_cont" name="q[translation_key_key_cont]" value="<%= params.dig(:q, :translation_key_key_cont) %>" />
16
+ </div>
17
+ <div class="form-group">
18
+ <label for="q_handler_name_cont">
19
+ Handler name contains
20
+ </label>
21
+ <input class="form-control" id="q_handler_name_cont" name="q[handler_name_cont]" value="<%= params.dig(:q, :handler_name_cont) %>" />
22
+ </div>
23
+ <div class="form-group">
24
+ <label for="q_group_name_cont">
25
+ Group name contains
26
+ </label>
27
+ <input class="form-control" id="q_group_name_cont" name="q[group_name_cont]" value="<%= params.dig(:q, :group_name_cont) %>" />
28
+ </div>
29
+ <input class="btn btn-primary" type="submit" value="Filter" />
30
+ </form>
16
31
  </div>
17
32
  </div>
18
33
 
@@ -14,20 +14,43 @@
14
14
  </div>
15
15
  </div>
16
16
  <div class="panel-body">
17
- <%= simple_search_form_for @ransack, url: @handler do |f| %>
17
+ <form method="get">
18
18
  <div class="row">
19
19
  <div class="col-md-4">
20
- <%= f.input :name_cont, autofocus: true %>
20
+ <div class="form-group">
21
+ <label for="q_name_cont">
22
+ Name contains
23
+ </label>
24
+ <input class="form-control" id="q_name_cont" name="q[name_cont]" type="text" value="<%= params.dig(:q, :name_cont) %>" />
25
+ </div>
21
26
  </div>
22
27
  <div class="col-md-4">
23
- <%= f.input :with_translations, label: "With translations", collection: with_translations_collection %>
28
+ <div class="form-group">
29
+ <label for="q_with_translations">
30
+ With translations
31
+ </label>
32
+ <select class="form-control" id="q_with_translations" name="q[with_translations]">
33
+ <option />
34
+ <%= options_for_select(with_translations_collection, params.dig(:q, :with_translations)) %>
35
+ </select>
36
+ </div>
24
37
  </div>
25
38
  <div class="col-md-4">
26
- <%= f.input :with_missing_translations, label: "Missing translations", collection: with_missing_translations_collection %>
39
+ <div class="form-group">
40
+ <label for="q_with_missing_translations">
41
+ Missing translations
42
+ </label>
43
+
44
+ <select class="form-control" name="q[with_missing_translations]" id="q_with_missing_translations">
45
+ <option />
46
+ <%= options_for_select(with_missing_translations_collection, params.dig(:q, :with_missing_translations)) %>
47
+ </select>
48
+ </div>
27
49
  </div>
28
50
  </div>
29
- <%= f.button :submit, "Filter", class: ["btn", "btn-primary"] %>
30
- <% end %>
51
+
52
+ <input class="btn btn-primary" value="Filter" type="submit" />
53
+ </form>
31
54
  </div>
32
55
  </div>
33
56
 
@@ -1,6 +1,6 @@
1
1
  <% content_for(:header_title) { "Movals" } %>
2
2
 
3
- <%= simple_form_for :movals do |f| %>
3
+ <%= form_tag do %>
4
4
  <% count = 0 %>
5
5
 
6
6
  <div class="panel panel-default">
@@ -46,7 +46,7 @@
46
46
  <% if count > 0 %>
47
47
  <div class="panel panel-default">
48
48
  <div class="panel-body">
49
- <%= f.button :submit, "Move" %>
49
+ <input class="btn btn-primary" type="submit" value="Move" />
50
50
  </div>
51
51
  </div>
52
52
  <% end %>
@@ -11,6 +11,6 @@ module AwesomeTranslations
11
11
  end
12
12
 
13
13
  def self.load_object_extensions
14
- ::Object.__send__(:include, AwesomeTranslations::ObjectExtensions)
14
+ ::Object.include AwesomeTranslations::ObjectExtensions
15
15
  end
16
16
  end
@@ -74,7 +74,7 @@ class AwesomeTranslations::CacheDatabaseGenerator
74
74
  end
75
75
 
76
76
  def cache_yml_translations
77
- cache_translations_in_dir(Rails.root.join("config", "locales"))
77
+ cache_translations_in_dir(Rails.root.join("config/locales"))
78
78
  end
79
79
 
80
80
  def cache_handler_translations
@@ -86,7 +86,7 @@ class AwesomeTranslations::CacheDatabaseGenerator
86
86
  end
87
87
 
88
88
  def self.database_path
89
- @database_path ||= Rails.root.join("db", "awesome_translations.sqlite3").to_s
89
+ @database_path ||= Rails.root.join("db/awesome_translations.sqlite3").to_s
90
90
  end
91
91
 
92
92
  def database_path
@@ -13,7 +13,7 @@ class AwesomeTranslations::CacheDatabaseGenerator::Group < BazaModels::Model
13
13
  end
14
14
 
15
15
  def at_group
16
- @at_group ||= AwesomeTranslations::Group.find_by_handler_and_id(at_handler, identifier)
16
+ @at_group ||= AwesomeTranslations::Group.find_by(handler: at_handler, id: identifier)
17
17
  end
18
18
 
19
19
  def to_param
@@ -34,11 +34,13 @@ class AwesomeTranslations::CacheDatabaseGenerator::HandlerTranslation < BazaMode
34
34
 
35
35
  def array_key
36
36
  return unless (match = key.match(/\A(.+)\[(\d+)\]\Z/))
37
+
37
38
  match[1]
38
39
  end
39
40
 
40
41
  def array_no
41
42
  return unless (match = key.match(/\A(.+)\[(\d+)\]\Z/))
43
+
42
44
  match[2].to_i
43
45
  end
44
46
  end
@@ -4,10 +4,10 @@ class AwesomeTranslations::Config
4
4
  def initialize
5
5
  @ignored_paths = [
6
6
  Rails.root.join(".git").to_s,
7
- Rails.root.join("config", "locales").to_s,
7
+ Rails.root.join("config/locales").to_s,
8
8
  Rails.root.join("log").to_s,
9
- Rails.root.join("public", "packs-test").to_s,
10
- Rails.root.join("public", "packs").to_s,
9
+ Rails.root.join("public/packs-test").to_s,
10
+ Rails.root.join("public/packs").to_s,
11
11
  Rails.root.join("node_modules").to_s,
12
12
  Rails.root.join("tmp").to_s,
13
13
  Rails.root.join("storage").to_s,
@@ -1,7 +1,3 @@
1
- require "sass-rails"
2
- require "simple_form"
3
- require "simple_form_ransack"
4
-
5
1
  module AwesomeTranslations; end
6
2
 
7
3
  class AwesomeTranslations::Engine < ::Rails::Engine
@@ -34,6 +34,7 @@ private
34
34
 
35
35
  Dir.foreach(full_path) do |file|
36
36
  next if file == "." || file == ".."
37
+
37
38
  file_path = path.clone
38
39
  file_path << "/" unless file_path.empty?
39
40
  file_path << file
@@ -1,28 +1,13 @@
1
1
  class AwesomeTranslations::GlobalTranslator
2
- RUBY_2 = RUBY_VERSION.starts_with?("2")
3
-
4
2
  def self.call_information(caller_number)
5
- if RUBY_2
6
- # This is much faster than the other solution
7
- call = caller_locations(caller_number + 2, caller_number + 2).first
8
-
9
- {
10
- method: call.label,
11
- path: call.absolute_path,
12
- line_no: call.lineno
13
- }
14
- else
15
- call = caller[caller_number + 1]
16
- file_info = call.match(/\A(.+):(\d+):in `(.+?)'/)
17
-
18
- raise "Could not get previous file name from: #{caller[0]}" if file_info[1].blank?
19
-
20
- {
21
- method: file_info[3],
22
- path: file_info[1],
23
- line_no: file_info[2]
24
- }
25
- end
3
+ # This is much faster than the other solution
4
+ call = caller_locations(caller_number + 2, caller_number + 2).first
5
+
6
+ {
7
+ method: call.label,
8
+ path: call.absolute_path,
9
+ line_no: call.lineno
10
+ }
26
11
  end
27
12
 
28
13
  def self.translate(key, args, &blk)
@@ -99,6 +84,7 @@ private
99
84
  root = engine.root.to_s
100
85
 
101
86
  next unless @_previous_file.starts_with?(root)
87
+
102
88
  @_previous_file = @_previous_file.gsub(/\A#{Regexp.escape(root)}\//, "")
103
89
  break
104
90
  end
@@ -11,6 +11,7 @@ class AwesomeTranslations::Handlers
11
11
 
12
12
  const_name_snake = "#{match[1]}_handler"
13
13
  next if const_name_snake == "base_handler"
14
+
14
15
  const_name_camel = StringCases.snake_to_camel(const_name_snake)
15
16
 
16
17
  handler = AwesomeTranslations::Handler.new(
@@ -27,6 +27,7 @@ class AwesomeTranslations::Handlers::FileHandler < AwesomeTranslations::Handlers
27
27
  file = erb_inspector.file(group.data.fetch(:root_path), group.data.fetch(:file_path))
28
28
  file.translations.each do |translation|
29
29
  next if translations_found.key?(translation.full_key)
30
+
30
31
  translations_found[translation.full_key] = true
31
32
  yielder << translation.model
32
33
  end
@@ -12,7 +12,7 @@ class AwesomeTranslations::Handlers::ModelHandler < AwesomeTranslations::Handler
12
12
 
13
13
  def translations_for_group(group)
14
14
  ArrayEnumerator.new do |yielder|
15
- model_inspector = AwesomeTranslations::ModelInspector.model_classes.find { |model_inspector| model_inspector.clazz.name == group.name }
15
+ model_inspector = AwesomeTranslations::ModelInspector.model_classes.find { |model_inspector_i| model_inspector_i.clazz.name == group.name }
16
16
  raise "No inspector by that name: #{group.name}" unless model_inspector
17
17
 
18
18
  model_names(model_inspector).each { |translation| yielder << translation }
@@ -12,7 +12,7 @@ class AwesomeTranslations::Handlers::ValidationsHandler < AwesomeTranslations::H
12
12
 
13
13
  def translations_for_group(group)
14
14
  ArrayEnumerator.new do |yielder|
15
- model_inspector = AwesomeTranslations::ModelInspector.model_classes.find { |model_inspector| model_inspector.clazz.name == group.name }
15
+ model_inspector = AwesomeTranslations::ModelInspector.model_classes.find { |model_inspector_i| model_inspector_i.clazz.name == group.name }
16
16
  raise "No inspector by that name: #{group.name}" unless model_inspector
17
17
 
18
18
  model_inspector.clazz._validators.each do |attribute_name, validators|