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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f281b9e5d6a0adaa051e580294f0159ccf7d6b8f94a30dc8c7c7c5ab867612f
4
- data.tar.gz: 64c0861c9545bf87e52e035a86d673513a12f9e58eaa6cbdaf17a2c4ad483fd4
3
+ metadata.gz: 2d50f29ed3d0a85e7d16177bd79b9fe6c3271ad17b4cb888c81c44b451a1f28d
4
+ data.tar.gz: 8ab4c58c78a5967a2096d9aacc58a0568442ea1ff3477d353cbe8a42f3ce5ded
5
5
  SHA512:
6
- metadata.gz: 0a76dfdda32e3e49560731381aed9158d33473739f6dc155de46b79ea11ca6d0a3f87a4c3e2f08e641aab987ac5770dcdb276edf1a6b0844c2fc5aded7b91c5a
7
- data.tar.gz: fff054a90f3161234d5c8fd6e4591dd0d0697d6ace50f40a422292517c1e6b09522c0ae2d8b3512be2126f69d54701b2f3e448090aa45824f000fe9f387cdeda
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
- field :description
30
-
31
- field :img_path
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
- [['', nil]] + out.map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
52
+ [[nil, nil]] + out.map { |item| [ item.name, item.id ] }
43
53
  end
44
54
 
45
55
  def breadcrumbs
@@ -0,0 +1,9 @@
1
+
2
+ class ::Gameui::MapBookmark
3
+ include Mongoid::Document
4
+ include Mongoid::Timestamps
5
+
6
+ belongs_to :profile, class_name: 'IshModels::UserProfile'
7
+ belongs_to :location, class_name: '::Gameui::Map'
8
+
9
+ end
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
- field :img_path
21
- validates :img_path, presence: true
22
- field :title_img_path
23
- validates :title_img_path, presence: true
24
-
25
- field :description
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.132
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