ish_models 0.0.33.132 → 0.0.33.133
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 +15 -5
- data/lib/gameui/map_bookmark.rb +9 -0
- data/lib/gameui/marker.rb +28 -11
- data/lib/ish/image_asset.rb +27 -0
- data/lib/ish_models/user_profile.rb +6 -0
- data/lib/ish_models.rb +2 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d50f29ed3d0a85e7d16177bd79b9fe6c3271ad17b4cb888c81c44b451a1f28d
|
4
|
+
data.tar.gz: 8ab4c58c78a5967a2096d9aacc58a0568442ea1ff3477d353cbe8a42f3ce5ded
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e53ea5ade3eaec46a41f2469c27ff60bf4feaf8e989cc1091173e16d4788e4f262150f5b84045c3d717fadd4f4fad09e982474d11fddd0b2f7bf5b1a0abeffc
|
7
|
+
data.tar.gz: 6c618c59a51c4a05dec7725cf21211bf5ce9b5f35dea634ed83f1f1db98a5252f00199096de651ae75ec1199ae36a0295d2a993fcc564c0a80c8ee3d2ba66d27
|
data/lib/gameui/map.rb
CHANGED
@@ -12,6 +12,9 @@ class ::Gameui::Map
|
|
12
12
|
field :parent_slug
|
13
13
|
belongs_to :parent, class_name: '::Gameui::Map', inverse_of: :childs, optional: true
|
14
14
|
has_many :childs, class_name: '::Gameui::Map', inverse_of: :parent
|
15
|
+
has_one :image, class_name: '::Ish::ImageAsset', inverse_of: :location
|
16
|
+
|
17
|
+
has_and_belongs_to_many :bookmarked_profiles, class_name: '::IshModels::UserProfile', inverse_of: :bookmarked_location
|
15
18
|
|
16
19
|
field :map_slug
|
17
20
|
def map
|
@@ -19,16 +22,23 @@ class ::Gameui::Map
|
|
19
22
|
end
|
20
23
|
|
21
24
|
field :name
|
25
|
+
field :description
|
26
|
+
|
27
|
+
# @deprecated, dont use!
|
28
|
+
field :img_path
|
22
29
|
|
23
30
|
field :w, type: Integer
|
24
31
|
validates :w, presence: true
|
25
|
-
|
26
32
|
field :h, type: Integer
|
27
33
|
validates :h, presence: true
|
28
34
|
|
29
|
-
|
30
|
-
|
31
|
-
|
35
|
+
# @TODO: this is shared between map and marker, move to a concern.
|
36
|
+
before_validation :compute_w_h
|
37
|
+
def compute_w_h
|
38
|
+
geo = Paperclip::Geometry.from_file(Paperclip.io_adapters.for(image.image))
|
39
|
+
self.w = geo.width
|
40
|
+
self.h = geo.height
|
41
|
+
end
|
32
42
|
|
33
43
|
ORDERING_TYPE_ALPHABETIC = 'alphabetic'
|
34
44
|
ORDERING_TYPE_CUSTOM = 'custom'
|
@@ -39,7 +49,7 @@ class ::Gameui::Map
|
|
39
49
|
|
40
50
|
def self.list conditions = { is_trash: false }
|
41
51
|
out = self.order_by( created_at: :desc )
|
42
|
-
[[
|
52
|
+
[[nil, nil]] + out.map { |item| [ item.name, item.id ] }
|
43
53
|
end
|
44
54
|
|
45
55
|
def breadcrumbs
|
data/lib/gameui/marker.rb
CHANGED
@@ -8,21 +8,37 @@ class ::Gameui::Marker
|
|
8
8
|
field :slug
|
9
9
|
validates :slug, uniqueness: true, presence: true
|
10
10
|
|
11
|
+
field :description
|
12
|
+
|
13
|
+
has_one :image, class_name: '::Ish::ImageAsset', inverse_of: :marker_image
|
14
|
+
has_one :title_image, class_name: '::Ish::ImageAsset', inverse_of: :marker_title_image
|
15
|
+
|
16
|
+
|
17
|
+
# @deprecated, don't use!
|
18
|
+
# _vp_ 2021-09-23
|
19
|
+
field :img_path
|
20
|
+
# validates :img_path, presence: true
|
21
|
+
field :title_img_path
|
22
|
+
# validates :title_img_path, presence: true
|
11
23
|
field :w, type: Integer
|
12
24
|
validates :w, presence: true
|
13
25
|
field :h, type: Integer
|
14
26
|
validates :h, presence: true
|
15
|
-
field :x, type: Integer
|
16
|
-
validates :x, presence: true
|
17
|
-
field :y, type: Integer
|
18
|
-
validates :y, presence: true
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
27
|
+
field :x, type: Integer, default: 0
|
28
|
+
# validates :x, presence: true
|
29
|
+
field :y, type: Integer, default: 0
|
30
|
+
# validates :y, presence: true
|
31
|
+
field :centerOffsetX, type: Integer, default: 0
|
32
|
+
# validates :centerXOffset, presence: true
|
33
|
+
field :centerOffsetY, type: Integer, default: 0
|
34
|
+
# validates :centerYOffset, presence: true
|
35
|
+
|
36
|
+
before_validation :compute_w_h
|
37
|
+
def compute_w_h
|
38
|
+
geo = Paperclip::Geometry.from_file(Paperclip.io_adapters.for(image.image))
|
39
|
+
self.w = geo.width
|
40
|
+
self.h = geo.height
|
41
|
+
end
|
26
42
|
|
27
43
|
field :is_active, type: Boolean, default: true
|
28
44
|
field :deleted_at, type: Time, default: nil
|
@@ -38,6 +54,7 @@ class ::Gameui::Marker
|
|
38
54
|
field :item_type, type: String
|
39
55
|
validates :item_type, presence: true
|
40
56
|
|
57
|
+
field :url
|
41
58
|
|
42
59
|
end
|
43
60
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class Ish::ImageAsset
|
2
|
+
require 'aws-sdk'
|
3
|
+
|
4
|
+
include Mongoid::Document
|
5
|
+
include Mongoid::Timestamps
|
6
|
+
include Mongoid::Paperclip
|
7
|
+
|
8
|
+
belongs_to :location, class_name: 'Gameui::Map', inverse_of: :image, optional: true
|
9
|
+
belongs_to :marker_image, class_name: 'Gameui::Map', inverse_of: :image, optional: true
|
10
|
+
belongs_to :marker_title_image, class_name: 'Gameui::Map', inverse_of: :title_image, optional: true
|
11
|
+
|
12
|
+
has_mongoid_attached_file :image,
|
13
|
+
:styles => {
|
14
|
+
:thumb => "100x100#",
|
15
|
+
},
|
16
|
+
:storage => :s3,
|
17
|
+
:s3_credentials => ::S3_CREDENTIALS,
|
18
|
+
:path => "image_assets/:style/:id/:filename",
|
19
|
+
:s3_protocol => 'https',
|
20
|
+
:validate_media_type => false,
|
21
|
+
s3_region: ::S3_CREDENTIALS[:region]
|
22
|
+
|
23
|
+
validates_attachment_content_type :image, :content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif", 'application/octet-stream' ]
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
|
@@ -10,6 +10,7 @@ class IshModels::UserProfile
|
|
10
10
|
field :email
|
11
11
|
# validates_format_of :email, :with => ::Devise::email_regexp
|
12
12
|
validates_format_of :email,:with => /\A[^@\s]+@([^@\s]+\.)+[^@\s]+\z/
|
13
|
+
validates_uniqueness_of :email
|
13
14
|
|
14
15
|
field :fb_access_token
|
15
16
|
field :fb_long_access_token
|
@@ -35,6 +36,11 @@ class IshModels::UserProfile
|
|
35
36
|
has_many :videos, :inverse_of => :user_profile
|
36
37
|
has_many :newsitems, inverse_of: :user_profile
|
37
38
|
|
39
|
+
has_and_belongs_to_many :bookmarked_locations, class_name: '::Gameui::Map', inverse_of: :bookmarked_profile
|
40
|
+
def bookmarks
|
41
|
+
bookmarked_locations
|
42
|
+
end
|
43
|
+
|
38
44
|
has_and_belongs_to_many :friends, :class_name => 'IshModels::UserProfile', :inverse_of => :friendeds
|
39
45
|
has_and_belongs_to_many :friendeds, :class_name => 'IshModels::UserProfile', :inverse_of => :friends
|
40
46
|
|
data/lib/ish_models.rb
CHANGED
@@ -30,6 +30,7 @@ require 'co_tailors/address.rb'
|
|
30
30
|
|
31
31
|
require 'gameui'
|
32
32
|
require 'gameui/map.rb'
|
33
|
+
require 'gameui/map_bookmark.rb'
|
33
34
|
require 'gameui/marker.rb'
|
34
35
|
require 'gameui/premium_purchase.rb'
|
35
36
|
|
@@ -37,6 +38,7 @@ require 'ish/ameritrade'
|
|
37
38
|
require 'ish/covered_call'
|
38
39
|
require 'ish/crawler.rb'
|
39
40
|
require 'ish/gallery_name.rb'
|
41
|
+
require 'ish/image_asset.rb'
|
40
42
|
require 'ish/input_error.rb'
|
41
43
|
require 'ish/iron_condor.rb'
|
42
44
|
require 'ish/iron_condor_watcher.rb'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ish_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.33.
|
4
|
+
version: 0.0.33.133
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- lib/gallery.rb
|
117
117
|
- lib/gameui.rb
|
118
118
|
- lib/gameui/map.rb
|
119
|
+
- lib/gameui/map_bookmark.rb
|
119
120
|
- lib/gameui/marker.rb
|
120
121
|
- lib/gameui/premium_purchase.rb
|
121
122
|
- lib/ish/alphavantage_stockwatcher.rb
|
@@ -125,6 +126,7 @@ files:
|
|
125
126
|
- lib/ish/covered_call_watcher.rb
|
126
127
|
- lib/ish/crawler.rb
|
127
128
|
- lib/ish/gallery_name.rb
|
129
|
+
- lib/ish/image_asset.rb
|
128
130
|
- lib/ish/input_error.rb
|
129
131
|
- lib/ish/invoice.rb
|
130
132
|
- lib/ish/iron_condor.rb
|