ish_models 0.0.33.172 → 0.0.33.174
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gameui/map.rb +34 -19
- data/lib/gameui/marker.rb +1 -8
- data/lib/mongoid/votable.rb +2 -1
- data/lib/newsitem.rb +1 -0
- data/lib/report.rb +4 -2
- 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: e193de4eeef224f54fcf57c898a9bc3b6a6442a3fdb92ebc39bbe631e884c760
|
4
|
+
data.tar.gz: be392236fdc22f242252992c4f473623798b1d837fb036be850f54dd6a26a32d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9e4729d7c569a6fe830403583e95552f2bf96b16d0d73601059e9680eb67ec8f526b9a5c655ebdc7f23312cd9608aafd44de088cb435f8b579ddfc2da514b7d
|
7
|
+
data.tar.gz: e74ca05bc40aa65fdf65b31b228e5410bd9be2299664261404eb4e1e98b4f6af3632cd08445d9c6e23c33b89638b15a7540270cef023972c04c8d2e0c282d229
|
data/lib/gameui/map.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
require 'ish/premium_item'
|
2
3
|
require 'ish/utils'
|
3
4
|
|
@@ -7,15 +8,20 @@ class ::Gameui::Map
|
|
7
8
|
include Ish::PremiumItem
|
8
9
|
include Ish::Utils
|
9
10
|
|
10
|
-
|
11
|
-
has_many :from_markers, :class_name => '::Gameui::Marker', inverse_of: :destination
|
11
|
+
field :name
|
12
12
|
|
13
|
-
|
13
|
+
field :slug
|
14
|
+
validates :slug, uniqueness: true, presence: true
|
14
15
|
|
16
|
+
field :description
|
17
|
+
|
18
|
+
## @TODO: probably, abstract this. _vp_ 2022-09-20
|
15
19
|
field :deleted_at, type: Time, default: nil
|
16
20
|
|
17
|
-
|
18
|
-
|
21
|
+
has_many :markers, :class_name => '::Gameui::Marker', inverse_of: :map
|
22
|
+
has_many :from_markers, :class_name => '::Gameui::Marker', inverse_of: :destination
|
23
|
+
|
24
|
+
has_many :newsitems, inverse_of: :map, order: :created_at.desc
|
19
25
|
|
20
26
|
# @TODO: remove field, replace with relation. _vp_ 2022-09-13
|
21
27
|
field :parent_slug
|
@@ -40,9 +46,6 @@ class ::Gameui::Map
|
|
40
46
|
::Gameui::Map.where( slug: map_slug ).first
|
41
47
|
end
|
42
48
|
|
43
|
-
field :name
|
44
|
-
field :description
|
45
|
-
|
46
49
|
RATED_OPTIONS = [ 'pg-13', 'r', 'nc-17' ]
|
47
50
|
field :rated, default: 'pg-13' # 'r', 'nc-17'
|
48
51
|
|
@@ -55,18 +58,21 @@ class ::Gameui::Map
|
|
55
58
|
# @deprecated, dont use!
|
56
59
|
field :img_path
|
57
60
|
|
61
|
+
## Not used! See config.map_panel_type instead.
|
62
|
+
# MAP_TYPES = [ :map_2d, :map_3d, :map_geospatial, :map_gallery, :map_toc ] ## Mostly not implemented. _vp_ 2022-09-06
|
63
|
+
# field :map_type, default: :map_2d
|
64
|
+
|
65
|
+
## Make sure to use x,y,z and w,h as appropriate.
|
66
|
+
## @TODO: abstract this into a module
|
67
|
+
field :x, type: Float
|
68
|
+
field :y, type: Float
|
69
|
+
field :z, type: Float
|
70
|
+
|
71
|
+
## Make sure to use x,y,z and w,h as appropriate.
|
58
72
|
field :w, type: Integer
|
59
73
|
validates :w, presence: true
|
60
74
|
field :h, type: Integer
|
61
75
|
validates :h, presence: true
|
62
|
-
|
63
|
-
MAP_TYPES = [ :map_2d, :map_3d, :map_geospatial, :map_gallery, :map_toc ] ## Mostly not implemented. _vp_ 2022-09-06
|
64
|
-
field :map_type, default: :map_2d
|
65
|
-
|
66
|
-
## @TODO: abstract this into a module
|
67
|
-
field :x, :type => Float
|
68
|
-
field :y, :type => Float
|
69
|
-
|
70
76
|
# @TODO: this is shared between map and marker, move to a concern.
|
71
77
|
before_validation :compute_w_h
|
72
78
|
def compute_w_h
|
@@ -104,6 +110,10 @@ class ::Gameui::Map
|
|
104
110
|
out.reverse
|
105
111
|
end
|
106
112
|
|
113
|
+
##
|
114
|
+
## @TODO: move the export func, below, to a module. _vp_ 2022-09-20
|
115
|
+
##
|
116
|
+
|
107
117
|
def empty_export
|
108
118
|
return {
|
109
119
|
galleries: {},
|
@@ -128,9 +138,7 @@ class ::Gameui::Map
|
|
128
138
|
videos: [],
|
129
139
|
}
|
130
140
|
end
|
131
|
-
|
132
|
-
Map.new.export_key_to_class
|
133
|
-
end
|
141
|
+
|
134
142
|
def export_key_to_class
|
135
143
|
return {
|
136
144
|
galleries: 'Gallery',
|
@@ -153,6 +161,9 @@ class ::Gameui::Map
|
|
153
161
|
# 'videos' => 'Video',
|
154
162
|
}.with_indifferent_access
|
155
163
|
end
|
164
|
+
def self.export_key_to_class
|
165
|
+
Map.new.export_key_to_class
|
166
|
+
end
|
156
167
|
|
157
168
|
def export_fields
|
158
169
|
%w|
|
@@ -231,6 +242,10 @@ class ::Gameui::Map
|
|
231
242
|
export_object
|
232
243
|
end
|
233
244
|
|
245
|
+
## endExport
|
246
|
+
|
247
|
+
field :newsitems_page_size, default: 25
|
248
|
+
|
234
249
|
end
|
235
250
|
|
236
251
|
Location = ::Gameui::Map
|
data/lib/gameui/marker.rb
CHANGED
@@ -8,13 +8,6 @@ class ::Gameui::Marker
|
|
8
8
|
validates_uniqueness_of :name, scope: :map_id
|
9
9
|
validates_presence_of :name
|
10
10
|
|
11
|
-
## This is not a map, I don't need a slug.
|
12
|
-
## @TODO: remove it. _vp_ 2022-06-17
|
13
|
-
field :slug
|
14
|
-
def slug
|
15
|
-
return self[:slug] || id.to_s
|
16
|
-
end
|
17
|
-
|
18
11
|
field :ordering, type: String, default: 'jjj'
|
19
12
|
|
20
13
|
ITEM_TYPE_LOCATION = '::Gameui::Map' # @TODO: this used to be gameui-location . How is this different from gameui-map ?
|
@@ -58,7 +51,7 @@ class ::Gameui::Marker
|
|
58
51
|
|
59
52
|
belongs_to :map, class_name: '::Gameui::Map', inverse_of: :markers
|
60
53
|
|
61
|
-
belongs_to :destination, class_name: '::Gameui::Map', inverse_of: :from_markers
|
54
|
+
belongs_to :destination, class_name: '::Gameui::Map', inverse_of: :from_markers, optional: true
|
62
55
|
|
63
56
|
belongs_to :creator_profile, class_name: 'Ish::UserProfile', inverse_of: :my_markers
|
64
57
|
|
data/lib/mongoid/votable.rb
CHANGED
@@ -190,7 +190,8 @@ module Mongoid
|
|
190
190
|
#
|
191
191
|
# @param [Mongoid Object, BSON::ObjectId] voter is Mongoid object the id of the voter who made the vote
|
192
192
|
def vote_value(voter)
|
193
|
-
|
193
|
+
## The last last one, voter.id not voter.id.to_s _vp_ 2022-09-19
|
194
|
+
voter_id = voter.is_a?(BSON::ObjectId) ? voter : voter.is_a?(String) ? voter : voter.id
|
194
195
|
|
195
196
|
return :up if up_voter_ids.try(:include?, voter_id)
|
196
197
|
return :down if down_voter_ids.try(:include?, voter_id)
|
data/lib/newsitem.rb
CHANGED
data/lib/report.rb
CHANGED
@@ -13,11 +13,13 @@ class Report
|
|
13
13
|
index({ :slug => 1 }, { :unique => true })
|
14
14
|
before_validation :set_slug, :on => :create
|
15
15
|
|
16
|
-
##
|
17
|
-
##
|
16
|
+
## Can be one of: default (nil), longscroll,
|
17
|
+
## wordpress e.g. https://piousbox.com/wp-json/wp/v2/posts?slug=intro
|
18
|
+
# ITEM_TYPES = %w| longscroll wordpress |
|
18
19
|
field :item_type, type: String
|
19
20
|
|
20
21
|
field :descr, :type => String
|
22
|
+
field :raw_json
|
21
23
|
|
22
24
|
field :is_trash, :type => Boolean, :default => false
|
23
25
|
index({ :is_trash => 1, :is_public => 1 }, { name: 'default_index' })
|