tolk 4.1.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: aa3e3637012d66b5b6cff958c18cda0db63548646e78b9c85c7521d9b6cf376a
4
- data.tar.gz: ca4f20139cdd4a9af95fa316f5c1b663afceac4af1a313c493a9dde2ea4e7a26
3
+ metadata.gz: 0efb83ba668b7ce45dd8416a130ca95005466ca091664aed126905ba70e07031
4
+ data.tar.gz: 50bd892173a79fcf5f520600308a2726a0c724e89c7c6ec04f8938bbaae5d084
5
5
  SHA512:
6
- metadata.gz: 44f35db53e0209edfb14a35bbe394df5db895bc0c7131c4a885a7a5d1718c81a8baf33fdda3d3943e04817e9a2009b44ed011da8d266101213aa3f04dd98c39f
7
- data.tar.gz: bb7b84a1ee6ee5b9541954efae240e7e2167f326f6ec506e3be7bfd5f0a3b61f2f4bec81c0116775ae9fbc2b9e35f693f22520518ec941a132926fae13787d39
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)
@@ -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>
data/lib/tolk/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tolk
2
- VERSION = "4.1.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.1.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: 2022-01-06 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
@@ -185,11 +185,11 @@ files:
185
185
  - app/models/tolk/phrase.rb
186
186
  - app/models/tolk/translation.rb
187
187
  - app/views/layouts/tolk/application.html.erb
188
- - app/views/tolk/_blank_canva.svg
189
- - app/views/tolk/_empty.svg
190
- - 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
191
191
  - app/views/tolk/_nav.html.erb
192
- - app/views/tolk/_no_data.svg
192
+ - app/views/tolk/_no_data.html.erb
193
193
  - app/views/tolk/locales/all.html.erb
194
194
  - app/views/tolk/locales/index.html.erb
195
195
  - app/views/tolk/locales/show.atom.builder