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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ae41306d1c2d1a86acdc705f296feae8ba6cb9d31dcef4c1794cabaa69d8b2c
4
- data.tar.gz: 1d34eb80dc069bb504a62a08ee25da17c92cebb5805399ff570954c8bd163c3e
3
+ metadata.gz: 7e600845398a0cd10bcd4683dfd01a7f3793ba4b1dc9e086df508d1845fc8127
4
+ data.tar.gz: a8f500decf7e7f67716cdcf3e53231239bedb36e3ee8098a0a27063ef80068f9
5
5
  SHA512:
6
- metadata.gz: 46d410929c0405cffbd123b8b376a3629fc748e75df699b56bd94d70b9576c22c09358e64c32f3bfea59fc6b1bd7ed471cb70af2c9c4cd60170b75599df4a0d6
7
- data.tar.gz: 5b7280694b1ba7790c33e70e1f0c8555733f6d2912e7af2bdaba73516adfe6417e1594384ca84896cf1d7b6ea3f9cdd1dcf419188f38dd19f0fc69ce1f20a37c
6
+ metadata.gz: a5649ea010caf2ecba1b71bfdd800f4674320a5c36ac95c7aab2f0b9266d19eedfbb37ed3a91785c9e4bc8a80c4aeccc848e3709018d81c3bc427ddee740dbde
7
+ data.tar.gz: 8a7e153a876fe7f28c411c056e838f08e204f1d4647add4a72c68718474b8dc971af71105d7cd455bb4934b43a62560f752e29da1ac4d8f1f12475718f074cf0
@@ -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, :is_trash => false }).order_by({ :created_at => :desc })
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 = { :is_trash => false }
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
@@ -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 is_public is_trash
57
+ name descr weight
62
58
 
63
59
  photo_file_name photo_content_type photo_file_size photo_updated_at photo_fingerprint
64
60
  |
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wco_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.52
4
+ version: 3.1.0.53
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev