wco_models 3.1.0.52 → 3.1.0.53
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/wco/gallery.rb +7 -12
- data/app/models/wco/photo.rb +1 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e600845398a0cd10bcd4683dfd01a7f3793ba4b1dc9e086df508d1845fc8127
|
4
|
+
data.tar.gz: a8f500decf7e7f67716cdcf3e53231239bedb36e3ee8098a0a27063ef80068f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5649ea010caf2ecba1b71bfdd800f4674320a5c36ac95c7aab2f0b9266d19eedfbb37ed3a91785c9e4bc8a80c4aeccc848e3709018d81c3bc427ddee740dbde
|
7
|
+
data.tar.gz: 8a7e153a876fe7f28c411c056e838f08e204f1d4647add4a72c68718474b8dc971af71105d7cd455bb4934b43a62560f752e29da1ac4d8f1f12475718f074cf0
|
data/app/models/wco/gallery.rb
CHANGED
@@ -7,23 +7,24 @@ class Wco::Gallery
|
|
7
7
|
include Wco::Utils
|
8
8
|
store_in collection: 'galleries'
|
9
9
|
|
10
|
-
PER_PAGE = 6
|
11
10
|
|
12
11
|
field :name
|
13
12
|
validates :name, :uniqueness => true
|
14
13
|
index({ :name => -1 }) ## 2023-09-23 removed uniqueness
|
15
14
|
|
15
|
+
field :slug
|
16
|
+
index({ :slug => -1 }, { :unique => true })
|
17
|
+
validates :slug, presence: true, uniqueness: true
|
18
|
+
before_validation :set_slug, :on => :create
|
19
|
+
|
16
20
|
field :subhead
|
17
21
|
field :descr, :as => :description
|
18
22
|
|
19
23
|
field :is_public, type: Boolean, default: false
|
20
24
|
# has_and_belongs_to_many :shared_profiles, :class_name => 'Wco::Profile', :inverse_of => :shared_galleries
|
21
25
|
|
22
|
-
field :is_trash, type: Boolean, default: false
|
23
|
-
field :is_done, type: Boolean, default: false
|
24
|
-
|
25
26
|
def published
|
26
|
-
where({ :is_public => true
|
27
|
+
where({ :is_public => true }).order_by({ :created_at => :desc })
|
27
28
|
end
|
28
29
|
|
29
30
|
field :x, :type => Float
|
@@ -31,15 +32,9 @@ class Wco::Gallery
|
|
31
32
|
field :z, :type => Float
|
32
33
|
|
33
34
|
field :lang, :default => 'en'
|
34
|
-
# field :username
|
35
|
-
# field :lead_id, type: :integer
|
36
35
|
|
37
|
-
field :slug
|
38
|
-
index({ :slug => -1 }, { :unique => true })
|
39
|
-
validates :slug, presence: true, uniqueness: true
|
40
|
-
before_validation :set_slug, :on => :create
|
41
36
|
|
42
|
-
def self.list conditions = {
|
37
|
+
def self.list conditions = {}
|
43
38
|
out = self.unscoped.where( conditions ).order_by( :created_at => :desc )
|
44
39
|
[['', nil]] + out.map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
|
45
40
|
end
|
data/app/models/wco/photo.rb
CHANGED
@@ -51,14 +51,10 @@ class Wco::Photo
|
|
51
51
|
s3_region: ::S3_CREDENTIALS[:region]
|
52
52
|
validates_attachment_content_type :photo, :content_type => ["image/webp", "image/jpg", "image/jpeg", "image/png", "image/gif", 'application/octet-stream' ]
|
53
53
|
|
54
|
-
def self.n_per_manager_gallery
|
55
|
-
25
|
56
|
-
end
|
57
|
-
|
58
54
|
def export_fields
|
59
55
|
%w|
|
60
56
|
gallery_id
|
61
|
-
name descr weight
|
57
|
+
name descr weight
|
62
58
|
|
63
59
|
photo_file_name photo_content_type photo_file_size photo_updated_at photo_fingerprint
|
64
60
|
|
|