ish_models 0.0.33.132 → 0.0.33.136
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/city.rb +1 -1
- data/lib/feature.rb +17 -23
- data/lib/gallery.rb +3 -0
- data/lib/gameui/map.rb +22 -6
- 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/utils.rb +25 -0
- data/lib/ish_models/user_profile.rb +6 -0
- data/lib/ish_models.rb +8 -5
- data/lib/newsitem.rb +4 -0
- data/lib/report.rb +25 -24
- data/lib/site.rb +4 -5
- data/lib/tag.rb +6 -10
- data/lib/venue.rb +11 -10
- data/lib/video.rb +4 -2
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 172ea3b5881a62b2d1c4ef8bed4360782c6f9676eaa39c1be7e9febab7e8937b
|
4
|
+
data.tar.gz: ba242d1b5cc551a2257a0c2183413f1a9cebd5448cc570629761cb69e9e99863
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c849a3a2b774e4290e10e28b83561f11d85eb0ed316acc2118ad8ff6188d2d7c902b7bab1e0e192f4010a6ab9f1bafafec3ecaaecf47029084c9fcce43da2c34
|
7
|
+
data.tar.gz: 5c8641248d523733c55643e8fe3ee95c4aa75cd4b7257684b60d4d48735e1a68187015abd7dbbda3558964f6c97c090a12fba4de3deab8081e952501bcec3e1d
|
data/lib/city.rb
CHANGED
@@ -36,7 +36,7 @@ class City
|
|
36
36
|
has_one :profile_photo, :class_name => 'Photo', :inverse_of => :profile_city
|
37
37
|
has_one :guide, :class_name => '::IshModels::UserProfile', :inverse_of => :guide_city
|
38
38
|
|
39
|
-
|
39
|
+
has_many :features
|
40
40
|
|
41
41
|
field :calendar_frame, :type => String
|
42
42
|
field :is_active, type: Boolean, default: true
|
data/lib/feature.rb
CHANGED
@@ -1,31 +1,25 @@
|
|
1
1
|
|
2
|
-
class Feature
|
3
|
-
|
2
|
+
class Feature
|
4
3
|
include Mongoid::Document
|
5
4
|
include Mongoid::Timestamps
|
6
5
|
|
7
|
-
field :name
|
8
|
-
field :subhead
|
6
|
+
field :name
|
7
|
+
field :subhead
|
9
8
|
|
10
|
-
field :image_path
|
11
|
-
field :link_path
|
12
|
-
field :partial_name
|
13
|
-
field :inner_html
|
14
|
-
field :weight,
|
15
|
-
|
16
|
-
belongs_to :photo, :optional => true
|
17
|
-
belongs_to :report, :optional => true
|
18
|
-
belongs_to :gallery, :optional => true
|
19
|
-
belongs_to :video, :optional => true
|
20
|
-
# has_one :photo
|
21
|
-
# has_one :report
|
22
|
-
# has_one :gallery
|
23
|
-
# has_one :video
|
9
|
+
field :image_path
|
10
|
+
field :link_path
|
11
|
+
field :partial_name
|
12
|
+
field :inner_html
|
13
|
+
field :weight, type: Integer, default: 10
|
24
14
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
15
|
+
belongs_to :city, optional: true
|
16
|
+
belongs_to :gallery, optional: true
|
17
|
+
belongs_to :photo, optional: true
|
18
|
+
belongs_to :report, optional: true
|
19
|
+
belongs_to :site, optional: true
|
20
|
+
belongs_to :tag, optional: true
|
21
|
+
belongs_to :video, optional: true
|
22
|
+
belongs_to :venue, optional: true
|
29
23
|
|
30
24
|
def self.all
|
31
25
|
self.order_by( :created_at => :desc )
|
@@ -34,5 +28,5 @@ class Feature
|
|
34
28
|
def self.n_features
|
35
29
|
4
|
36
30
|
end
|
37
|
-
|
31
|
+
|
38
32
|
end
|
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
@@ -4,7 +4,7 @@ class ::Gameui::Map
|
|
4
4
|
include Mongoid::Timestamps
|
5
5
|
|
6
6
|
has_many :markers, :class_name => '::Gameui::Marker', inverse_of: :map
|
7
|
-
has_many :newsitems, inverse_of: :map
|
7
|
+
has_many :newsitems, inverse_of: :map, order: :created_at.desc
|
8
8
|
|
9
9
|
field :slug
|
10
10
|
validates :slug, uniqueness: true, presence: true
|
@@ -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,29 @@ class ::Gameui::Map
|
|
19
22
|
end
|
20
23
|
|
21
24
|
field :name
|
25
|
+
field :description
|
26
|
+
|
27
|
+
## Possible keys: description, map, markers, newsitems,
|
28
|
+
field :labels, type: Object, default: {}
|
29
|
+
## Possible keys:
|
30
|
+
## config.description.collapsible
|
31
|
+
field :config, type: Object, default: {}
|
32
|
+
|
33
|
+
# @deprecated, dont use!
|
34
|
+
field :img_path
|
22
35
|
|
23
36
|
field :w, type: Integer
|
24
37
|
validates :w, presence: true
|
25
|
-
|
26
38
|
field :h, type: Integer
|
27
39
|
validates :h, presence: true
|
28
40
|
|
29
|
-
|
30
|
-
|
31
|
-
|
41
|
+
# @TODO: this is shared between map and marker, move to a concern.
|
42
|
+
before_validation :compute_w_h
|
43
|
+
def compute_w_h
|
44
|
+
geo = Paperclip::Geometry.from_file(Paperclip.io_adapters.for(image.image))
|
45
|
+
self.w = geo.width
|
46
|
+
self.h = geo.height
|
47
|
+
end
|
32
48
|
|
33
49
|
ORDERING_TYPE_ALPHABETIC = 'alphabetic'
|
34
50
|
ORDERING_TYPE_CUSTOM = 'custom'
|
@@ -39,7 +55,7 @@ class ::Gameui::Map
|
|
39
55
|
|
40
56
|
def self.list conditions = { is_trash: false }
|
41
57
|
out = self.order_by( created_at: :desc )
|
42
|
-
[[
|
58
|
+
[[nil, nil]] + out.map { |item| [ item.name, item.id ] }
|
43
59
|
end
|
44
60
|
|
45
61
|
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
|
+
|
data/lib/ish/utils.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
module Ish::Utils
|
3
|
+
|
4
|
+
private
|
5
|
+
|
6
|
+
def set_slug
|
7
|
+
return if slug
|
8
|
+
new_slug = name.downcase.gsub(/[^a-z0-9\s]/i, '').gsub(' ', '-')
|
9
|
+
if self.class.where( slug: new_slug ).first
|
10
|
+
loop do
|
11
|
+
if new_slug[new_slug.length-1].to_i != 0
|
12
|
+
# inrement last digit
|
13
|
+
last_digit = new_slug[new_slug.length-1].to_i
|
14
|
+
new_slug = "#{new_slug[0...new_slug.length-1]}#{last_digit+1}"
|
15
|
+
else
|
16
|
+
# add '-1' to the end
|
17
|
+
new_slug = "#{new_slug}-1"
|
18
|
+
end
|
19
|
+
break if !self.class.where( slug: new_slug ).first
|
20
|
+
end
|
21
|
+
end
|
22
|
+
self.slug = new_slug
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -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,25 +30,28 @@ 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
|
+
# require 'ish/alphavantage_stockwatcher.rb'
|
36
38
|
require 'ish/ameritrade'
|
39
|
+
require 'ish/campaign.rb'
|
37
40
|
require 'ish/covered_call'
|
38
41
|
require 'ish/crawler.rb'
|
39
42
|
require 'ish/gallery_name.rb'
|
43
|
+
require 'ish/image_asset.rb'
|
40
44
|
require 'ish/input_error.rb'
|
45
|
+
require 'ish/invoice.rb'
|
41
46
|
require 'ish/iron_condor.rb'
|
42
47
|
require 'ish/iron_condor_watcher.rb'
|
48
|
+
require 'ish/issue.rb'
|
49
|
+
require 'ish/lead.rb'
|
43
50
|
require 'ish/payment.rb'
|
44
51
|
require 'ish/stock_action.rb'
|
45
52
|
require 'ish/stock_option.rb'
|
46
53
|
require 'ish/stock_watch.rb'
|
47
|
-
|
48
|
-
require 'ish/invoice.rb'
|
49
|
-
require 'ish/lead.rb'
|
50
|
-
require 'ish/campaign.rb'
|
51
|
-
require 'ish/issue.rb'
|
54
|
+
require 'ish/utils.rb'
|
52
55
|
require 'ish/yahoo_stockwatcher.rb'
|
53
56
|
|
54
57
|
# obsolete, use `ish` namespace now
|
data/lib/newsitem.rb
CHANGED
data/lib/report.rb
CHANGED
@@ -1,20 +1,24 @@
|
|
1
1
|
class Report
|
2
2
|
include ::Mongoid::Document
|
3
3
|
include ::Mongoid::Timestamps
|
4
|
+
include Ish::Utils
|
4
5
|
|
5
6
|
field :name, :type => String
|
6
7
|
validates :name, :presence => true
|
7
8
|
# index({ :name => 1 }, { :unique => true })
|
8
9
|
index({ :name => 1, :is_trash => 1 })
|
9
10
|
|
10
|
-
field :
|
11
|
-
validates :
|
12
|
-
index({ :
|
11
|
+
field :slug
|
12
|
+
validates :slug, :uniqueness => true, :presence => true
|
13
|
+
index({ :slug => 1 }, { :unique => true })
|
13
14
|
|
14
|
-
|
15
|
+
## Can be one of: default (nil), longscroll
|
16
|
+
field :item_type, type: String
|
17
|
+
|
18
|
+
field :descr, :type => String
|
15
19
|
|
16
20
|
field :is_trash, :type => Boolean, :default => false
|
17
|
-
index :is_trash => 1, :is_public => 1
|
21
|
+
index :is_trash => 1, :is_public => 1
|
18
22
|
|
19
23
|
field :is_public, :type => Boolean, :default => true
|
20
24
|
index({ :is_public => 1 })
|
@@ -27,13 +31,13 @@ class Report
|
|
27
31
|
|
28
32
|
field :is_done, :type => Boolean, :default => true
|
29
33
|
index({ :is_done => 1 })
|
30
|
-
|
34
|
+
|
31
35
|
field :x, :type => Float
|
32
36
|
field :y, :type => Float
|
33
37
|
|
34
38
|
field :lang, :type => String, :default => 'en'
|
35
39
|
index({ :lang => 1 })
|
36
|
-
|
40
|
+
|
37
41
|
belongs_to :user_profile, :optional => true, :class_name => 'IshModels::UserProfile'
|
38
42
|
|
39
43
|
# validates :user, :presence => true, :allow_nil => false
|
@@ -43,14 +47,14 @@ class Report
|
|
43
47
|
|
44
48
|
field :issue
|
45
49
|
field :subhead
|
46
|
-
|
50
|
+
|
47
51
|
belongs_to :city, :optional => true
|
48
52
|
belongs_to :site, :optional => true
|
49
53
|
belongs_to :cities_user, :optional => true
|
50
54
|
|
51
55
|
has_and_belongs_to_many :tags
|
52
56
|
has_and_belongs_to_many :venues
|
53
|
-
|
57
|
+
|
54
58
|
has_one :photo
|
55
59
|
|
56
60
|
field :n_upvotes, :default => 0
|
@@ -59,15 +63,15 @@ class Report
|
|
59
63
|
default_scope ->{
|
60
64
|
where({ is_public: true, is_trash: false }).order_by({ created_at: :desc })
|
61
65
|
}
|
62
|
-
|
66
|
+
|
63
67
|
has_many :newsitems
|
64
68
|
|
65
69
|
def self.list conditions = { :is_trash => false }
|
66
70
|
out = self.where( conditions ).order_by( :name => :asc ).limit( 100 )
|
67
71
|
[['', nil]] + out.map { |item| [ item.name, item.id ] }
|
68
72
|
end
|
69
|
-
|
70
|
-
PER_PAGE = 20
|
73
|
+
|
74
|
+
PER_PAGE = 20
|
71
75
|
def self.paginates_per
|
72
76
|
self::PER_PAGE
|
73
77
|
end
|
@@ -75,33 +79,30 @@ class Report
|
|
75
79
|
def venue
|
76
80
|
return self.venues[0] || nil
|
77
81
|
end
|
78
|
-
|
82
|
+
|
79
83
|
def self.all
|
80
84
|
self.where( :is_public => true, :is_trash => false ).order_by( :created_at => :desc )
|
81
85
|
end
|
82
|
-
|
86
|
+
|
83
87
|
def self.not_tagged
|
84
88
|
Report.where( :tag_ids => nil, :city => nil )
|
85
89
|
end
|
86
|
-
|
90
|
+
|
87
91
|
def self.for_homepage args
|
88
92
|
begin
|
89
93
|
tag_ids = args[:main_tag].children_tags.map { |tag| tag._id } + [ args[:main_tag]._id ]
|
90
94
|
return Report.where( :tag_ids.in => tag_ids ).page args[:page]
|
91
95
|
rescue
|
92
|
-
return Report.page args[:page]
|
96
|
+
return Report.page args[:page]
|
93
97
|
end
|
94
98
|
end
|
95
99
|
|
96
|
-
before_validation :
|
97
|
-
def set_name_seo
|
98
|
-
self.name_seo ||= self.name.gsub(' ', '-').gsub('.', '')
|
99
|
-
end
|
100
|
+
before_validation :set_slug, :on => :create
|
100
101
|
|
101
102
|
set_callback :update, :after do |doc|
|
102
103
|
Site.update_all updated_at: Time.now
|
103
104
|
end
|
104
|
-
|
105
|
+
|
105
106
|
set_callback :create, :after do |doc|
|
106
107
|
if doc.is_public
|
107
108
|
|
@@ -115,7 +116,7 @@ class Report
|
|
115
116
|
v.newsitems << n
|
116
117
|
v.save
|
117
118
|
end
|
118
|
-
end
|
119
|
+
end
|
119
120
|
|
120
121
|
unless doc.city.blank?
|
121
122
|
city = City.find doc.city.id
|
@@ -131,7 +132,7 @@ class Report
|
|
131
132
|
end
|
132
133
|
end
|
133
134
|
end
|
134
|
-
|
135
|
+
|
135
136
|
def self.clear
|
136
137
|
if Rails.env.test?
|
137
138
|
self.unscoped.each { |r| r.remove }
|
@@ -149,5 +150,5 @@ class Report
|
|
149
150
|
end
|
150
151
|
def premium?; is_premium; end
|
151
152
|
has_many :premium_purchases, class_name: '::Gameui::PremiumPurchase', as: :item
|
152
|
-
|
153
|
+
|
153
154
|
end
|
data/lib/site.rb
CHANGED
@@ -30,7 +30,7 @@ class Site
|
|
30
30
|
field :is_primary, :type => Boolean, :default => false
|
31
31
|
field :is_private, :type => Boolean, :default => false
|
32
32
|
field :private_user_emails, :type => Array, :default => []
|
33
|
-
|
33
|
+
|
34
34
|
field :homepage_layout, :type => String, :default => 'show'
|
35
35
|
field :layout, :type => String, :default => 'application'
|
36
36
|
|
@@ -40,9 +40,8 @@ class Site
|
|
40
40
|
has_many :videos
|
41
41
|
has_many :newsitems, :order => :created_at.desc
|
42
42
|
has_many :issues, :class_name => 'Ish::Issue'
|
43
|
+
has_many :features, :order => :created_at.desc
|
43
44
|
|
44
|
-
embeds_many :features, :order => :created_at.desc
|
45
|
-
|
46
45
|
default_scope ->{ where({ :is_trash => false }).order_by({ :domain => :asc, :lang => :asc }) }
|
47
46
|
|
48
47
|
set_callback :create, :before do |doc|
|
@@ -61,7 +60,7 @@ class Site
|
|
61
60
|
end
|
62
61
|
|
63
62
|
LANGUAGES = [ 'en', 'ru', 'pt' ]
|
64
|
-
|
63
|
+
|
65
64
|
# manager uses it.
|
66
65
|
def self.list
|
67
66
|
out = self.all.order_by( :domain => :asc, :lang => :asc )
|
@@ -79,7 +78,7 @@ class Site
|
|
79
78
|
def n_private_reports
|
80
79
|
self.reports.unscoped.where( :is_public => false, :is_trash => false ).length
|
81
80
|
end
|
82
|
-
|
81
|
+
|
83
82
|
def its_locales
|
84
83
|
Site.where( :domain => self.domain ).map { |s| s.lang.to_sym }
|
85
84
|
end
|
data/lib/tag.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
class Tag
|
2
2
|
include Mongoid::Document
|
3
3
|
include Mongoid::Timestamps
|
4
|
+
include Ish::Utils
|
4
5
|
|
5
6
|
field :name, :type => String
|
6
7
|
# validates :name, :uniqueness => true, :allow_nil => false
|
7
8
|
|
8
|
-
field :
|
9
|
-
validates :
|
9
|
+
field :slug
|
10
|
+
validates :slug, :uniqueness => true, presence: true, allow_nil: false
|
10
11
|
|
11
12
|
field :descr, :type => String, :default => ''
|
12
13
|
|
@@ -19,8 +20,7 @@ class Tag
|
|
19
20
|
has_many :children_tags, :class_name => 'Tag', :inverse_of => :parent_tag
|
20
21
|
belongs_to :parent_tag, :class_name => 'Tag', :inverse_of => :children_tags, :optional => true
|
21
22
|
|
22
|
-
|
23
|
-
# embeds_many :newsitems
|
23
|
+
has_many :features
|
24
24
|
has_many :newsitems
|
25
25
|
|
26
26
|
belongs_to :site, :optional => true
|
@@ -36,11 +36,7 @@ class Tag
|
|
36
36
|
where({ :is_public => true, :is_trash => false }).order_by({ :name => :asc })
|
37
37
|
}
|
38
38
|
|
39
|
-
|
40
|
-
if d.name_seo.blank?
|
41
|
-
d.name_seo = d.name.gsub(' ', '-')
|
42
|
-
end
|
43
|
-
end
|
39
|
+
before_validation :set_slug
|
44
40
|
|
45
41
|
def self.clear
|
46
42
|
if Rails.env.test?
|
@@ -72,9 +68,9 @@ class Tag
|
|
72
68
|
4
|
73
69
|
end
|
74
70
|
|
75
|
-
# @deprecated I don't even know why I have this. Should be simplified into non-being.
|
76
71
|
def self.n_features
|
77
72
|
4
|
78
73
|
end
|
74
|
+
field :n_features, type: Integer, default: 4
|
79
75
|
|
80
76
|
end
|
data/lib/venue.rb
CHANGED
@@ -1,16 +1,20 @@
|
|
1
1
|
class Venue
|
2
2
|
include ::Mongoid::Document
|
3
3
|
include ::Mongoid::Timestamps
|
4
|
+
include Ish::Utils
|
5
|
+
|
6
|
+
field :address
|
4
7
|
|
5
8
|
field :name, :type => String
|
6
9
|
validates :name, :uniqueness => true, :allow_nil => false
|
7
10
|
|
8
|
-
field :
|
9
|
-
validates :
|
10
|
-
|
11
|
+
field :slug
|
12
|
+
validates :slug, :uniqueness => true, :allow_nil => false
|
13
|
+
before_validation :set_slug
|
14
|
+
|
11
15
|
field :subhead
|
12
16
|
field :descr
|
13
|
-
|
17
|
+
|
14
18
|
field :is_trash, :type => Boolean, :default => false
|
15
19
|
scope :fresh, ->{ where({ :is_trash => false }) }
|
16
20
|
scope :trash, ->{ where({ :is_trash => true }) }
|
@@ -39,9 +43,8 @@ class Venue
|
|
39
43
|
has_many :reports
|
40
44
|
has_many :galleries
|
41
45
|
has_many :photos
|
42
|
-
|
43
|
-
|
44
|
-
embeds_many :features
|
46
|
+
has_many :newsitems
|
47
|
+
has_many :features
|
45
48
|
|
46
49
|
PER_PAGE = 6
|
47
50
|
|
@@ -50,9 +53,7 @@ class Venue
|
|
50
53
|
[['', nil]] + out.map { |item| [ item.name, item.id ] }
|
51
54
|
end
|
52
55
|
|
53
|
-
|
54
|
-
doc.name_seo = doc.name.gsub(' ', '-')
|
55
|
-
end
|
56
|
+
|
56
57
|
|
57
58
|
set_callback :save, :before do |doc|
|
58
59
|
if doc.city
|
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.
|
4
|
+
version: 0.0.33.136
|
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
|
@@ -135,6 +137,7 @@ files:
|
|
135
137
|
- lib/ish/stock_action.rb
|
136
138
|
- lib/ish/stock_option.rb
|
137
139
|
- lib/ish/stock_watch.rb
|
140
|
+
- lib/ish/utils.rb
|
138
141
|
- lib/ish/yahoo_stockwatcher.rb
|
139
142
|
- lib/ish_models.rb
|
140
143
|
- lib/ish_models/cache_key.rb
|