ish_models 0.0.33.170 → 0.0.33.173
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 +37 -18
- data/lib/gameui/marker.rb +1 -1
- 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: 20bd871ec7315d71ec6071376bc4dcffedb1910a21998a08e734ba426dbc8326
|
4
|
+
data.tar.gz: 245cec4e7835f4929fad40aa513036aed8f825890c01941a708dd05353b0897f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77a2e7a7ec0a3025fb3e6ff0a08653dd28d4b7eff00000231a96d717eb88b875610796b82eb7438b8513c6bd3ce4e39f04a3c2171ccfaee165f1b28725b426af
|
7
|
+
data.tar.gz: 2bd5285789c8cdc07e398834a83cc586c45c0eb8a7c79c5320e2d21d835eabc7620fa5e48b1c8a7dc3d424c83507c4d23c93b82765cabb3de7bf3b3b8b49d303
|
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,20 +8,26 @@ 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
|
19
23
|
|
20
|
-
|
24
|
+
has_many :newsitems, inverse_of: :map, order: :created_at.desc
|
21
25
|
|
26
|
+
# @TODO: remove field, replace with relation. _vp_ 2022-09-13
|
27
|
+
field :parent_slug
|
22
28
|
belongs_to :parent, class_name: '::Gameui::Map', inverse_of: :childs, optional: true
|
23
29
|
has_many :childs, class_name: '::Gameui::Map', inverse_of: :parent
|
30
|
+
|
24
31
|
has_one :image, class_name: '::Ish::ImageAsset', inverse_of: :location
|
25
32
|
belongs_to :creator_profile, class_name: '::Ish::UserProfile', inverse_of: :my_maps
|
26
33
|
|
@@ -33,15 +40,12 @@ class ::Gameui::Map
|
|
33
40
|
|
34
41
|
field :version, type: String, default: '0.0.0'
|
35
42
|
|
36
|
-
## @TODO:
|
43
|
+
## @TODO: or self, right? and refactor this, seems N+1. _vp_ 2022-09-13
|
37
44
|
field :map_slug
|
38
45
|
def map
|
39
46
|
::Gameui::Map.where( slug: map_slug ).first
|
40
47
|
end
|
41
48
|
|
42
|
-
field :name
|
43
|
-
field :description
|
44
|
-
|
45
49
|
RATED_OPTIONS = [ 'pg-13', 'r', 'nc-17' ]
|
46
50
|
field :rated, default: 'pg-13' # 'r', 'nc-17'
|
47
51
|
|
@@ -54,15 +58,21 @@ class ::Gameui::Map
|
|
54
58
|
# @deprecated, dont use!
|
55
59
|
field :img_path
|
56
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.
|
57
72
|
field :w, type: Integer
|
58
73
|
validates :w, presence: true
|
59
74
|
field :h, type: Integer
|
60
75
|
validates :h, presence: true
|
61
|
-
|
62
|
-
## @TODO: abstract this into a module
|
63
|
-
field :x, :type => Float
|
64
|
-
field :y, :type => Float
|
65
|
-
|
66
76
|
# @TODO: this is shared between map and marker, move to a concern.
|
67
77
|
before_validation :compute_w_h
|
68
78
|
def compute_w_h
|
@@ -100,6 +110,10 @@ class ::Gameui::Map
|
|
100
110
|
out.reverse
|
101
111
|
end
|
102
112
|
|
113
|
+
##
|
114
|
+
## @TODO: move the export func, below, to a module. _vp_ 2022-09-20
|
115
|
+
##
|
116
|
+
|
103
117
|
def empty_export
|
104
118
|
return {
|
105
119
|
galleries: {},
|
@@ -124,9 +138,7 @@ class ::Gameui::Map
|
|
124
138
|
videos: [],
|
125
139
|
}
|
126
140
|
end
|
127
|
-
|
128
|
-
Map.new.export_key_to_class
|
129
|
-
end
|
141
|
+
|
130
142
|
def export_key_to_class
|
131
143
|
return {
|
132
144
|
galleries: 'Gallery',
|
@@ -149,6 +161,9 @@ class ::Gameui::Map
|
|
149
161
|
# 'videos' => 'Video',
|
150
162
|
}.with_indifferent_access
|
151
163
|
end
|
164
|
+
def self.export_key_to_class
|
165
|
+
Map.new.export_key_to_class
|
166
|
+
end
|
152
167
|
|
153
168
|
def export_fields
|
154
169
|
%w|
|
@@ -227,6 +242,10 @@ class ::Gameui::Map
|
|
227
242
|
export_object
|
228
243
|
end
|
229
244
|
|
245
|
+
## endExport
|
246
|
+
|
247
|
+
field :newsitems_page_size, default: 25
|
248
|
+
|
230
249
|
end
|
231
250
|
|
232
251
|
Location = ::Gameui::Map
|
data/lib/gameui/marker.rb
CHANGED
@@ -58,7 +58,7 @@ class ::Gameui::Marker
|
|
58
58
|
|
59
59
|
belongs_to :map, class_name: '::Gameui::Map', inverse_of: :markers
|
60
60
|
|
61
|
-
belongs_to :destination, class_name: '::Gameui::Map', inverse_of: :from_markers
|
61
|
+
belongs_to :destination, class_name: '::Gameui::Map', inverse_of: :from_markers, optional: true
|
62
62
|
|
63
63
|
belongs_to :creator_profile, class_name: 'Ish::UserProfile', inverse_of: :my_markers
|
64
64
|
|
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' })
|