alchemy-json_api 0.14.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00a9cfebbdb1f42b95a9b199bb23b5690ba65ff21b14a95e260beff9dafe1d1e
4
- data.tar.gz: 0ce06ce3e137b56e40f5c8c08d895eb5f2eca7cc0936ed07c07cc2d6352530e5
3
+ metadata.gz: 369f587874aab63134861d26c9b1babfc0d0ba7d25a981bd2a977bf00d847b48
4
+ data.tar.gz: 3e3e10d5862df03767a538fe785b17d67d88a1e02151fa0a6b67b45370876960
5
5
  SHA512:
6
- metadata.gz: 87723e7055f3968a0a1d75b6d133e2fc0a3a8efeb5b61e222771e91c673e9313052a3e154280a01c2beaa9f49144c90da9ecb6d05282987943ea2e9d06b0de7b
7
- data.tar.gz: c2694da5d297f1acbbb16ed9a59858e5c84504091d430e82019e77aaae14549cb9b6e4d59ceee0a38b03e37f98162ea4881d2518e387b074cdd02e3c38bf8a1b
6
+ metadata.gz: 7f7b3074e7c9e446e22c12f8f8fffe64a2548ede87af8a22515efe53edc9060e2446d8cf9e2bd4511941158920e55e9cce5478b876fe4e9438d2d63d60df8cb6
7
+ data.tar.gz: c68a930b025975095291d0cf53d8f7cbba2a65e309ac4a0d24ef2db5966b4bc157cc35f199c2f69c3c2e8503de20517f19594a6ef3afac12f82eb124373ee170
@@ -18,7 +18,19 @@ module Alchemy
18
18
 
19
19
  with_options if: proc { |essence| essence.picture.present? } do
20
20
  attribute :image_dimensions do |essence|
21
- essence.sizes_from_string(essence.render_size)
21
+ sizes = essence.content.settings[:size]&.split("x", 2)&.map(&:to_i) || [
22
+ essence.image_file_width,
23
+ essence.image_file_height,
24
+ ]
25
+
26
+ ratio = essence.image_file_width.to_f / essence.image_file_height
27
+ width = sizes[0].zero? ? sizes[1] * ratio : sizes[0]
28
+ height = sizes[1].zero? ? sizes[0] / ratio : sizes[1]
29
+
30
+ {
31
+ width: width,
32
+ height: height,
33
+ }
22
34
  end
23
35
 
24
36
  attribute :image_name do |essence|
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Alchemy
3
3
  module JsonApi
4
- VERSION = "0.14.0"
4
+ VERSION = "0.15.0"
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy-json_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Meyerhoff
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-27 00:00:00.000000000 Z
11
+ date: 2021-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: alchemy_cms
@@ -156,7 +156,7 @@ homepage: https://github.com/AlchemyCMS/alchemy-json_api
156
156
  licenses:
157
157
  - MIT
158
158
  metadata: {}
159
- post_install_message:
159
+ post_install_message:
160
160
  rdoc_options: []
161
161
  require_paths:
162
162
  - lib
@@ -171,8 +171,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
171
  - !ruby/object:Gem::Version
172
172
  version: '0'
173
173
  requirements: []
174
- rubygems_version: 3.1.6
175
- signing_key:
174
+ rubygems_version: 3.1.4
175
+ signing_key:
176
176
  specification_version: 4
177
177
  summary: A JSONAPI compliant API for AlchemyCMS
178
178
  test_files: []