ish_models 0.0.33.129 → 0.0.33.130
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/lib/gameui/map.rb +9 -1
- data/lib/ish_models/user_profile.rb +7 -1
- data/lib/newsitem.rb +4 -3
- data/lib/photo.rb +9 -9
- 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: 8c34bbd347229cb392198bb194abc4c7d2902cb478aaac34b43b89c2014ab2d3
|
4
|
+
data.tar.gz: 83c55591061a4ed85905e50f3aaf6fdcae9eed57d25fb4f0f36dd1cbe4d16bbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2e9dc8ad1cd2f1236963b23d8c957c586e9b6736c8477001e393d4cff2fe9033c420752a5ce73e0ff3b18fe8881c647aa15ca447a9b899f3e3fd062aacb588b
|
7
|
+
data.tar.gz: e4337aed790fc7190cf0341dc158443d459b4aa0b85580594971362d38bef285fa8a6b9cae97e175a0d5f344964bc01a84778c34a042bb67bc364bde586f886e
|
data/lib/gameui/map.rb
CHANGED
@@ -4,10 +4,14 @@ class ::Gameui::Map
|
|
4
4
|
include Mongoid::Timestamps
|
5
5
|
|
6
6
|
has_many :markers, :class_name => '::Gameui::Marker', inverse_of: :map
|
7
|
+
has_many :newsitems, inverse_of: :map
|
7
8
|
|
8
9
|
field :slug
|
9
10
|
validates :slug, uniqueness: true, presence: true
|
10
11
|
field :parent_slug
|
12
|
+
def name
|
13
|
+
slug
|
14
|
+
end
|
11
15
|
|
12
16
|
field :w, type: Integer
|
13
17
|
validates :w, presence: true
|
@@ -26,5 +30,9 @@ class ::Gameui::Map
|
|
26
30
|
field :ordering_type, type: String, default: 'custom' # timestamp, alphabetic, custom
|
27
31
|
validates :ordering_type, presence: true
|
28
32
|
|
29
|
-
|
33
|
+
def self.list conditions = { is_trash: false }
|
34
|
+
out = self.order_by( created_at: :desc )
|
35
|
+
[['', nil]] + out.map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
|
36
|
+
end
|
37
|
+
|
30
38
|
end
|
@@ -39,6 +39,9 @@ class IshModels::UserProfile
|
|
39
39
|
has_and_belongs_to_many :friendeds, :class_name => 'IshModels::UserProfile', :inverse_of => :friends
|
40
40
|
|
41
41
|
field :n_unlocks, type: Integer, default: 0
|
42
|
+
def n_coins
|
43
|
+
n_unlocks
|
44
|
+
end
|
42
45
|
|
43
46
|
#
|
44
47
|
# preferences
|
@@ -72,7 +75,10 @@ class IshModels::UserProfile
|
|
72
75
|
field :n_stars, type: Integer, default: 0
|
73
76
|
has_many :premium_purchases, :class_name => '::Gameui::PremiumPurchase'
|
74
77
|
def has_premium_purchase item
|
75
|
-
item.premium_purchases.where(
|
78
|
+
item.premium_purchases.where( user_profile_id: self.id ).exists?
|
79
|
+
end
|
80
|
+
def premium_purchases
|
81
|
+
::Gameui::PremiumPurchase.where( user_profile_id: self.id )
|
76
82
|
end
|
77
83
|
|
78
84
|
end
|
data/lib/newsitem.rb
CHANGED
@@ -7,7 +7,8 @@ class Newsitem
|
|
7
7
|
belongs_to :city, :optional => true
|
8
8
|
belongs_to :report, :optional => true
|
9
9
|
belongs_to :user_profile, class_name: 'IshModels::UserProfile', optional: true
|
10
|
-
|
10
|
+
belongs_to :map, class_name: '::Gameui::Map', optional: true
|
11
|
+
|
11
12
|
belongs_to :gallery, :optional => true
|
12
13
|
def gallery
|
13
14
|
self.gallery_id ? Gallery.unscoped.find( self.gallery_id ) : nil
|
@@ -43,7 +44,7 @@ class Newsitem
|
|
43
44
|
unless item[:report_id].blank?
|
44
45
|
n.report = Report.find item[:report_id]
|
45
46
|
end
|
46
|
-
|
47
|
+
|
47
48
|
unless item[:gallery_id].blank?
|
48
49
|
n.gallery = Gallery.find item[:gallery_id]
|
49
50
|
end
|
@@ -52,5 +53,5 @@ class Newsitem
|
|
52
53
|
|
53
54
|
return n
|
54
55
|
end
|
55
|
-
|
56
|
+
|
56
57
|
end
|
data/lib/photo.rb
CHANGED
@@ -10,37 +10,36 @@ class Photo
|
|
10
10
|
# field :username, :type => String
|
11
11
|
|
12
12
|
has_and_belongs_to_many :viewers, :class_name => 'User', :inverse_of => :viewable_photos
|
13
|
-
|
13
|
+
|
14
14
|
belongs_to :user_profile, :class_name => 'IshModels::UserProfile', :optional => true
|
15
15
|
def user; user_profile; end
|
16
16
|
belongs_to :profile_city, :class_name => 'City', :inverse_of => :profile_photo, :optional => true
|
17
17
|
belongs_to :profile_venue, :class_name => 'Venue', :inverse_of => :profile_photo, :optional => true
|
18
18
|
belongs_to :profile_event, :class_name => 'Event', :inverse_of => :profile_photo, :optional => true
|
19
|
-
|
19
|
+
|
20
20
|
belongs_to :report, :optional => true
|
21
21
|
belongs_to :venue, :optional => true
|
22
22
|
belongs_to :event, :optional => true
|
23
23
|
belongs_to :feature, :optional => true
|
24
24
|
belongs_to :gallery, :optional => true
|
25
25
|
belongs_to :newsitem, :optional => true
|
26
|
-
|
26
|
+
|
27
27
|
field :name, :type => String
|
28
28
|
field :descr, :type => String
|
29
29
|
field :weight, :type => Integer, :default => 10
|
30
|
-
|
30
|
+
|
31
31
|
field :is_public, :type => Boolean, :default => true
|
32
32
|
|
33
33
|
# @TODO: nuke this boolean _vp_ 20170515
|
34
34
|
field :is_trash, :type => Boolean, :default => false
|
35
35
|
default_scope ->{ where({ :is_trash => false }) }
|
36
36
|
|
37
|
-
has_mongoid_attached_file :photo,
|
37
|
+
has_mongoid_attached_file :photo,
|
38
38
|
:styles => {
|
39
39
|
:mini => '20x20#',
|
40
40
|
:thumb => "100x100#",
|
41
41
|
:thumb2 => "200x200#",
|
42
42
|
:s169 => "640x360#",
|
43
|
-
# :s43 => "640x480#",
|
44
43
|
:small => "400x400>",
|
45
44
|
:large => '950x650>',
|
46
45
|
},
|
@@ -48,14 +47,15 @@ class Photo
|
|
48
47
|
:s3_credentials => ::S3_CREDENTIALS,
|
49
48
|
:path => "photos/:style/:id/:filename",
|
50
49
|
:s3_protocol => 'https',
|
51
|
-
:validate_media_type => false
|
52
|
-
|
50
|
+
:validate_media_type => false,
|
51
|
+
s3_region: ::S3_CREDENTIALS[:region]
|
52
|
+
|
53
53
|
def self.n_per_manager_gallery
|
54
54
|
25
|
55
55
|
end
|
56
56
|
|
57
57
|
validates_attachment_content_type :photo, :content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif", 'application/octet-stream' ]
|
58
|
-
|
58
|
+
|
59
59
|
end
|
60
60
|
|
61
61
|
|