ish_models 0.0.33.131 → 0.0.33.135

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: 6af77beacdc645fcf83ca862c625d2f689279acfe94cc40cc83527f4836578ed
4
- data.tar.gz: 5860e90c3029f55d92ab8ff703e21fb5fe2d9bc1d355c68fe1e06be3cc8788c3
3
+ metadata.gz: 6c5a6043e8144f6fae57963f58a0880eb171044ae3bbc62d36ae013c0db3be04
4
+ data.tar.gz: e3414aeaba21e5273054e14d8bf037ec798418c1a97a894e5861d8811ef2d224
5
5
  SHA512:
6
- metadata.gz: e88f2506f075b91fd496ce353358123486f9c968abb9e8837e89ef864846b2f054615732222ed4156578c012ab612df31b42d80219c14957f8167c48ad40d386
7
- data.tar.gz: f0482b89daa1a5c15569a780ab80f74f07a7504b08cdd13b8844ef4a9a03b0a3927b7e4b5c300e6f19468b6c2f1006e961f041b8eb174a798850faf59593eedf
6
+ metadata.gz: b2154545c111a45447bfa2bd1421e65afe4b68b17368fedf0de098e4cace9ea03cc9db25e3c0e7cd9f8b380a270fe7ce75b0544d8fa66d233ca4800e19046ee2
7
+ data.tar.gz: 99a571b6c35ed885e7b204dc922f5289451d0d4dc3d01ce1dd6f03a970dddf9b1c297d815353853c85c319c0ca60f0c22bff36ca37d3ef60a20476a926c6c16a
data/lib/gallery.rb CHANGED
@@ -39,6 +39,9 @@ class Gallery
39
39
 
40
40
  field :galleryname
41
41
  index({ :galleryname => -1 }, { :unique => true })
42
+ def slug
43
+ galleryname
44
+ end
42
45
  embeds_many :gallery_names, :class_name => '::Ish::GalleryName'
43
46
  def self.find_by_slug slug
44
47
  ::Gallery.where( galleryname: slug ).first
data/lib/gameui/map.rb CHANGED
@@ -12,18 +12,33 @@ 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
18
+
19
+ field :map_slug
20
+ def map
21
+ ::Gameui::Map.where( slug: map_slug ).first
22
+ end
15
23
 
16
24
  field :name
25
+ field :description
26
+
27
+ # @deprecated, dont use!
28
+ field :img_path
17
29
 
18
30
  field :w, type: Integer
19
31
  validates :w, presence: true
20
-
21
32
  field :h, type: Integer
22
33
  validates :h, presence: true
23
34
 
24
- field :description
25
-
26
- 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
27
42
 
28
43
  ORDERING_TYPE_ALPHABETIC = 'alphabetic'
29
44
  ORDERING_TYPE_CUSTOM = 'custom'
@@ -34,7 +49,7 @@ class ::Gameui::Map
34
49
 
35
50
  def self.list conditions = { is_trash: false }
36
51
  out = self.order_by( created_at: :desc )
37
- [['', 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 ] }
38
53
  end
39
54
 
40
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'
data/lib/venue.rb CHANGED
@@ -2,15 +2,17 @@ class Venue
2
2
  include ::Mongoid::Document
3
3
  include ::Mongoid::Timestamps
4
4
 
5
+ field :address
6
+
5
7
  field :name, :type => String
6
8
  validates :name, :uniqueness => true, :allow_nil => false
7
9
 
8
10
  field :name_seo, :type => String
9
11
  validates :name_seo, :uniqueness => true, :allow_nil => false
10
-
12
+
11
13
  field :subhead
12
14
  field :descr
13
-
15
+
14
16
  field :is_trash, :type => Boolean, :default => false
15
17
  scope :fresh, ->{ where({ :is_trash => false }) }
16
18
  scope :trash, ->{ where({ :is_trash => true }) }
data/lib/video.rb CHANGED
@@ -53,7 +53,8 @@ class Video
53
53
  :path => "videos/:style/:id/:filename",
54
54
  :s3_protocol => 'https',
55
55
  :s3_permissions => 'public-read',
56
- :validate_media_type => false
56
+ :validate_media_type => false,
57
+ s3_region: ::S3_CREDENTIALS[:region]
57
58
  validates_attachment_content_type :video, content_type: /\Avideo\/.*\Z/
58
59
 
59
60
  has_mongoid_attached_file :thumb,
@@ -70,7 +71,8 @@ class Video
70
71
  :s3_credentials => ::S3_CREDENTIALS,
71
72
  :path => "videos/:style/:id/thumb_:filename",
72
73
  :s3_protocol => 'https',
73
- :validate_media_type => false
74
+ :validate_media_type => false,
75
+ s3_region: ::S3_CREDENTIALS[:region]
74
76
  validates_attachment_content_type :thumb, :content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif", 'application/octet-stream' ]
75
77
 
76
78
  set_callback :update, :after do |doc|
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.131
4
+ version: 0.0.33.135
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