tolk 4.0.1 → 4.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1fca3085bb13c35ef269e555c2314fd69334ef0b0b143f3a8ed3cae827737346
4
- data.tar.gz: a4a41860859f8801124a0a7cf5a081aac3c4a59011099a15131de0e7d5a5a75d
3
+ metadata.gz: 0efb83ba668b7ce45dd8416a130ca95005466ca091664aed126905ba70e07031
4
+ data.tar.gz: 50bd892173a79fcf5f520600308a2726a0c724e89c7c6ec04f8938bbaae5d084
5
5
  SHA512:
6
- metadata.gz: 3fcddfa3b3ffe130191c3586a018a52fa6e42bc83aa3e75d8166956bf86e6c8f68e46657b0c878b02f32c6b8289f9dc97bbd1d79d8e883cf1224157d0572dd99
7
- data.tar.gz: 2b788d4317956d34ae913b027252cf94e3a7e80ef77de46ec32ebe91fed2b378547e955bcc0f53f983f4b5006de10fd285b5b53ef565f46e1c3cdd55a00cd645
6
+ metadata.gz: ab3b4d111fc73221f2c8e911e0c5fb7cdfe9a3fdb74d3de4dda3b750761b0e7fc2395358855eb18e76da8911f37351fc5298638a986229835518d436154030cb
7
+ data.tar.gz: bf73bddbb7e574ef04041cee9375e4db0d460680a891b0fc2b24fbbd3bdf84b643afbadb8dd793543d051c65396ccf5b483f1250fb258aea084d2110d61966d1
@@ -107,7 +107,9 @@ module Tolk
107
107
  phrases = phrases.where('tolk_phrases.id NOT IN (?)', existing_ids) if existing_ids.present?
108
108
 
109
109
  result = phrases.public_send(pagination_method, page)
110
- if Rails.version =~ /^4\.0/
110
+ if Gem::Version.new(Rails.version) >= Gem::Version.new('7')
111
+ ActiveRecord::Associations::Preloader.new(records: result, associations: :translations).call
112
+ elsif Rails.version =~ /^4\.0/
111
113
  ActiveRecord::Associations::Preloader.new result, :translations
112
114
  else
113
115
  ActiveRecord::Associations::Preloader.new().preload(result, :translations)
@@ -143,7 +145,9 @@ module Tolk
143
145
  # phrases = phrases.scoped(:conditions => ['tolk_phrases.id NOT IN (?) AND tolk_phrases.id IN(?)', existing_ids, found_translations_ids]) if existing_ids.present?
144
146
  phrases = phrases.where(['tolk_phrases.id NOT IN (?) AND tolk_phrases.id IN(?)', existing_ids, found_translations_ids]) if existing_ids.present?
145
147
  result = phrases.public_send(pagination_method, page)
146
- if Rails.version =~ /^4\.0/
148
+ if Gem::Version.new(Rails.version) >= Gem::Version.new('7')
149
+ ActiveRecord::Associations::Preloader.new(records: result, associations: :translations).call
150
+ elsif Rails.version =~ /^4\.0/
147
151
  ActiveRecord::Associations::Preloader.new result, :translations
148
152
  else
149
153
  ActiveRecord::Associations::Preloader.new().preload(result, :translations)
@@ -153,14 +157,14 @@ module Tolk
153
157
  end
154
158
 
155
159
  def to_hash
156
- data = translations.joins(:phrase).order("tolk_phrases.key ASC").pluck("tolk_phrases.key, text").
157
- each_with_object(Hash.new(0)) do |translation, locale|
158
- if translation[0].include?(".")
159
- locale.deep_merge!(unsquish(translation[0], translation[1]))
160
- else
161
- locale[translation[0]] = translation[1]
160
+ data = translations.includes(:phrase).references(:phrases).order(phrases.arel_table[:key]).
161
+ each_with_object({}) do |translation, locale|
162
+ if translation.phrase.key.include?(".")
163
+ locale.deep_merge!(unsquish(translation.phrase.key, translation.value))
164
+ else
165
+ locale[translation.phrase.key] = translation.value
166
+ end
162
167
  end
163
- end
164
168
  { name => data }
165
169
  end
166
170
 
@@ -186,7 +190,9 @@ module Tolk
186
190
  def translations_with_html
187
191
  translations = self.translations.all(:conditions => "tolk_translations.text LIKE '%>%' AND
188
192
  tolk_translations.text LIKE '%<%' AND tolk_phrases.key NOT LIKE '%_html'", :joins => :phrase)
189
- if Rails.version =~ /^4\.0/
193
+ if Gem::Version.new(Rails.version) >= Gem::Version.new('7')
194
+ ActiveRecord::Associations::Preloader.new(records: result, associations: :translations).call
195
+ elsif Rails.version =~ /^4\.0/
190
196
  ActiveRecord::Associations::Preloader.new translations, :phrase
191
197
  else
192
198
  ActiveRecord::Associations::Preloader.new().preload(translations, :phrase)
@@ -230,7 +236,9 @@ module Tolk
230
236
  phrase.translation = phrase.translations.for(self)
231
237
  end
232
238
 
233
- if Rails.version =~ /^4\.0/
239
+ if Gem::Version.new(Rails.version) >= Gem::Version.new('7')
240
+ ActiveRecord::Associations::Preloader.new(records: result, associations: :translations).call
241
+ elsif Rails.version =~ /^4\.0/
234
242
  ActiveRecord::Associations::Preloader.new result, :translations
235
243
  else
236
244
  ActiveRecord::Associations::Preloader.new().preload(result, :translations)
File without changes
File without changes
File without changes
@@ -79,7 +79,7 @@
79
79
  </div>
80
80
  <% else %>
81
81
  <div class="empty-state">
82
- <%= render 'tolk/blank_canva.svg' %>
82
+ <%= render 'tolk/blank_canva' %>
83
83
  <p class="empty-state__msg">
84
84
  There aren't any completed translations for this locale.
85
85
  </p>
@@ -32,7 +32,7 @@
32
32
  </ul>
33
33
  <% else %>
34
34
  <div class="empty-state">
35
- <%= render 'tolk/empty.svg' %>
35
+ <%= render 'tolk/empty' %>
36
36
  <p class="empty-state__msg">
37
37
  No locales yet, add one:
38
38
  </p>
@@ -64,7 +64,7 @@
64
64
  </div>
65
65
  <% else %>
66
66
  <div class="empty-state">
67
- <%= render 'tolk/houra.svg' %>
67
+ <%= render 'tolk/houra' %>
68
68
  <p class="empty-state__msg">
69
69
  <% if @locale.has_updated_translations? %>
70
70
  There aren't any missing phrases that need translation.
@@ -60,7 +60,7 @@
60
60
  </div>
61
61
  <% else %>
62
62
  <div class="empty-state">
63
- <%= render 'tolk/no_data.svg' %>
63
+ <%= render 'tolk/no_data' %>
64
64
  <p class="empty-state__msg">
65
65
  No search results.
66
66
  </p>
@@ -20,7 +20,7 @@ module Tolk
20
20
  will_paginate collection, options
21
21
  else
22
22
  # Otherwise use Kaminari
23
- paginate collection, options
23
+ paginate collection, **options
24
24
  end
25
25
  end
26
26
  end
data/lib/tolk/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tolk
2
- VERSION = "4.0.1"
2
+ VERSION = "4.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tolk
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2020-11-04 00:00:00.000000000 Z
15
+ date: 2022-03-28 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rails
@@ -29,47 +29,47 @@ dependencies:
29
29
  - !ruby/object:Gem::Version
30
30
  version: '5.0'
31
31
  - !ruby/object:Gem::Dependency
32
- name: safe_yaml
32
+ name: sprockets-rails
33
33
  requirement: !ruby/object:Gem::Requirement
34
34
  requirements:
35
- - - ">="
35
+ - - "~>"
36
36
  - !ruby/object:Gem::Version
37
- version: 0.8.6
37
+ version: '3.4'
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  requirements:
42
- - - ">="
42
+ - - "~>"
43
43
  - !ruby/object:Gem::Version
44
- version: 0.8.6
44
+ version: '3.4'
45
45
  - !ruby/object:Gem::Dependency
46
- name: sassc
46
+ name: safe_yaml
47
47
  requirement: !ruby/object:Gem::Requirement
48
48
  requirements:
49
49
  - - ">="
50
50
  - !ruby/object:Gem::Version
51
- version: '0'
51
+ version: 0.8.6
52
52
  type: :runtime
53
53
  prerelease: false
54
54
  version_requirements: !ruby/object:Gem::Requirement
55
55
  requirements:
56
56
  - - ">="
57
57
  - !ruby/object:Gem::Version
58
- version: '0'
58
+ version: 0.8.6
59
59
  - !ruby/object:Gem::Dependency
60
- name: capybara
60
+ name: sassc
61
61
  requirement: !ruby/object:Gem::Requirement
62
62
  requirements:
63
- - - "~>"
63
+ - - ">="
64
64
  - !ruby/object:Gem::Version
65
- version: '2.14'
66
- type: :development
65
+ version: '0'
66
+ type: :runtime
67
67
  prerelease: false
68
68
  version_requirements: !ruby/object:Gem::Requirement
69
69
  requirements:
70
- - - "~>"
70
+ - - ">="
71
71
  - !ruby/object:Gem::Version
72
- version: '2.14'
72
+ version: '0'
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: sqlite3
75
75
  requirement: !ruby/object:Gem::Requirement
@@ -105,7 +105,7 @@ dependencies:
105
105
  - !ruby/object:Gem::Version
106
106
  version: '1.0'
107
107
  - !ruby/object:Gem::Dependency
108
- name: poltergeist
108
+ name: will_paginate
109
109
  requirement: !ruby/object:Gem::Requirement
110
110
  requirements:
111
111
  - - ">="
@@ -119,7 +119,21 @@ dependencies:
119
119
  - !ruby/object:Gem::Version
120
120
  version: '0'
121
121
  - !ruby/object:Gem::Dependency
122
- name: will_paginate
122
+ name: capybara
123
+ requirement: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - "~>"
126
+ - !ruby/object:Gem::Version
127
+ version: '3.14'
128
+ type: :development
129
+ prerelease: false
130
+ version_requirements: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - "~>"
133
+ - !ruby/object:Gem::Version
134
+ version: '3.14'
135
+ - !ruby/object:Gem::Dependency
136
+ name: cuprite
123
137
  requirement: !ruby/object:Gem::Requirement
124
138
  requirements:
125
139
  - - ">="
@@ -132,6 +146,20 @@ dependencies:
132
146
  - - ">="
133
147
  - !ruby/object:Gem::Version
134
148
  version: '0'
149
+ - !ruby/object:Gem::Dependency
150
+ name: puma
151
+ requirement: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - "~>"
154
+ - !ruby/object:Gem::Version
155
+ version: '5.5'
156
+ type: :development
157
+ prerelease: false
158
+ version_requirements: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - "~>"
161
+ - !ruby/object:Gem::Version
162
+ version: '5.5'
135
163
  description: Tolk is a web interface for doing i18n translations packaged as an engine
136
164
  for Rails applications.
137
165
  email: david@loudthinking.com
@@ -157,11 +185,11 @@ files:
157
185
  - app/models/tolk/phrase.rb
158
186
  - app/models/tolk/translation.rb
159
187
  - app/views/layouts/tolk/application.html.erb
160
- - app/views/tolk/_blank_canva.svg
161
- - app/views/tolk/_empty.svg
162
- - app/views/tolk/_houra.svg
188
+ - app/views/tolk/_blank_canva.html.erb
189
+ - app/views/tolk/_empty.html.erb
190
+ - app/views/tolk/_houra.html.erb
163
191
  - app/views/tolk/_nav.html.erb
164
- - app/views/tolk/_no_data.svg
192
+ - app/views/tolk/_no_data.html.erb
165
193
  - app/views/tolk/locales/all.html.erb
166
194
  - app/views/tolk/locales/index.html.erb
167
195
  - app/views/tolk/locales/show.atom.builder
@@ -204,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
204
232
  - !ruby/object:Gem::Version
205
233
  version: '0'
206
234
  requirements: []
207
- rubygems_version: 3.1.4
235
+ rubygems_version: 3.3.4
208
236
  signing_key:
209
237
  specification_version: 4
210
238
  summary: Rails engine providing web interface for managing i18n yaml files