tramway-core 1.17.7.2 → 1.17.8
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 +4 -4
- data/app/models/tramway/core/application_record.rb +9 -0
- data/app/uploaders/photo_uploader.rb +14 -17
- data/lib/tramway/core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eeac1ff8281b7c5e6dd665fbe2916cd3f2bc917d90a203ac361729c305016711
|
4
|
+
data.tar.gz: ef749f395fb09fccba8acc35a842a1f390ae62274d345c108966aa1ea1f024b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86ce9b156c732ecdab742176ffe56af75c2fbc80f3d84bad3c50ac6c30491d0ff190118b6a64b58f732f17f673ffb060c9eff70bb7cd28589bd2be0cd082bf3b
|
7
|
+
data.tar.gz: ed9043ffbe86655297870364278f43e54680bdfbc34f860827189e0f365c8268b032ec6936dcefe3cbf2491dc56d66bf672700c08d9f565c58e5d1a4f4f6e43f
|
@@ -42,6 +42,15 @@ class Tramway::Core::ApplicationRecord < ActiveRecord::Base
|
|
42
42
|
def search_by(*attributes, **associations)
|
43
43
|
pg_search_scope :full_text_search, against: attributes, associated_against: associations
|
44
44
|
end
|
45
|
+
|
46
|
+
def uploader(attribute_name, uploader_name, **options)
|
47
|
+
mount_uploader attribute_name, "#{uploader_name.to_s.camelize}Uploader".constantize
|
48
|
+
@versions = options[:versions] if uploader_name == :photo
|
49
|
+
end
|
50
|
+
|
51
|
+
def photo_versions
|
52
|
+
@versions
|
53
|
+
end
|
45
54
|
end
|
46
55
|
|
47
56
|
# FIXME: detect inhertited locales
|
@@ -20,29 +20,14 @@ class PhotoUploader < ApplicationUploader
|
|
20
20
|
super && width.present? && height.present?
|
21
21
|
end
|
22
22
|
|
23
|
-
version :medium do
|
23
|
+
version :medium, if: :medium_version_is_needed? do
|
24
24
|
process resize_to_fill: [400, 400]
|
25
25
|
end
|
26
26
|
|
27
|
-
version :small do
|
27
|
+
version :small, if: :small_version_is_needed? do
|
28
28
|
process resize_to_fill: [100, 100]
|
29
29
|
end
|
30
30
|
|
31
|
-
# FIXME: move to tramway-landing uploader
|
32
|
-
version :card do
|
33
|
-
process resize_to_fill: [400, 400, 'North']
|
34
|
-
end
|
35
|
-
|
36
|
-
# FIXME: move to tramway-landing uploader
|
37
|
-
version :horizontal do
|
38
|
-
process resize_to_fill: [800, 350, 'North']
|
39
|
-
end
|
40
|
-
|
41
|
-
# FIXME: move to tramway-landing uploader
|
42
|
-
version :mini do
|
43
|
-
process resize_to_limit: [300, nil]
|
44
|
-
end
|
45
|
-
|
46
31
|
attr_reader :width, :height
|
47
32
|
|
48
33
|
before :cache, :capture_size
|
@@ -58,4 +43,16 @@ class PhotoUploader < ApplicationUploader
|
|
58
43
|
@width, @height = `identify -format "%wx %h" #{file.path}`.split(/x/).map(&:to_i)
|
59
44
|
end
|
60
45
|
end
|
46
|
+
|
47
|
+
def medium_version_is_needed?(_new_file)
|
48
|
+
version_is_needed? :medium
|
49
|
+
end
|
50
|
+
|
51
|
+
def small_version_is_needed?(_new_file)
|
52
|
+
version_is_needed? :small
|
53
|
+
end
|
54
|
+
|
55
|
+
def version_is_needed?(version)
|
56
|
+
model.class.photo_versions.include? version
|
57
|
+
end
|
61
58
|
end
|
data/lib/tramway/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tramway-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.17.
|
4
|
+
version: 1.17.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-04-
|
12
|
+
date: 2020-04-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: audited
|