ish_models 0.0.33.177 → 0.0.33.179
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gallery.rb +19 -51
- data/lib/gameui/asset3d.rb +1 -0
- data/lib/gameui/map.rb +0 -1
- data/lib/ish/{unsubscribe.rb → email_unsubscribe.rb} +1 -1
- data/lib/ish/image_asset.rb +1 -0
- data/lib/ish/lead.rb +1 -0
- data/lib/ish/lead.rb-bk +38 -0
- data/lib/ish/lorem_ipsum.rb +30 -0
- data/lib/ish/user_profile.rb +3 -4
- data/lib/ish_models.rb +2 -10
- data/lib/photo.rb +1 -7
- data/lib/report.rb +29 -59
- data/lib/video.rb +2 -7
- metadata +4 -10
- data/lib/cities_user.rb +0 -17
- data/lib/city.rb +0 -100
- data/lib/country.rb +0 -13
- data/lib/event.rb +0 -28
- data/lib/ish/app_model2.rb +0 -21
- data/lib/site.rb +0 -99
- data/lib/tag.rb +0 -73
- data/lib/venue.rb +0 -77
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd4856588ae1c58f116e5b7aab0c19f849ee3a259fed84f579e2446d53490b89
|
4
|
+
data.tar.gz: 65cf00bc66e043d83c98c7a33177e73ef779b2348b21d7bc3a10f5dea19c7b15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd32c9f1c11ffc7dfb70adb0e61d8c2c8f2bccc4c63cfe56a35e979b922362d1c37eae5afbf16010ef399cff9067042ecf0d4f531199c0eac1777350e218a2b7
|
7
|
+
data.tar.gz: '0586b6ee15066575877cd6aef440a591f4f1cb7de7e4d7df31b0a68485f9d38cdc359dbf5f079558dd9447ec1a01d94d46ec413d760a78b216124a354cc9ba09'
|
data/lib/gallery.rb
CHANGED
@@ -8,7 +8,9 @@ class Gallery
|
|
8
8
|
PER_PAGE = 6
|
9
9
|
|
10
10
|
field :name
|
11
|
-
validates :name, :uniqueness => true
|
11
|
+
validates :name, :uniqueness => true
|
12
|
+
field :subhead
|
13
|
+
field :descr, :as => :description
|
12
14
|
|
13
15
|
field :is_public, type: Boolean, default: false
|
14
16
|
has_and_belongs_to_many :shared_profiles, :class_name => 'Ish::UserProfile', :inverse_of => :shared_galleries
|
@@ -27,10 +29,9 @@ class Gallery
|
|
27
29
|
|
28
30
|
field :x, :type => Float
|
29
31
|
field :y, :type => Float
|
30
|
-
field :
|
31
|
-
|
32
|
+
field :z, :type => Float
|
33
|
+
|
32
34
|
field :lang, :default => 'en'
|
33
|
-
field :issue
|
34
35
|
field :username
|
35
36
|
|
36
37
|
field :slug
|
@@ -43,59 +44,31 @@ class Gallery
|
|
43
44
|
[['', nil]] + out.map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
|
44
45
|
end
|
45
46
|
|
46
|
-
belongs_to :site, :optional => true
|
47
47
|
belongs_to :user_profile, :optional => true, :class_name => 'Ish::UserProfile', :inverse_of => :galleries
|
48
48
|
|
49
|
-
has_and_belongs_to_many :tags
|
50
|
-
|
51
49
|
has_many :newsitems # seems correct. _vp_ 2022-03-21
|
52
50
|
has_many :photos
|
53
51
|
|
54
|
-
belongs_to :city, :optional => true
|
55
|
-
belongs_to :venue, :optional => true
|
56
|
-
|
57
|
-
|
58
52
|
set_callback(:create, :before) do |doc|
|
59
|
-
if doc.user_profile && doc.user_profile.name
|
60
|
-
doc.username = doc.user_profile.name
|
61
|
-
end
|
62
53
|
|
63
54
|
#
|
64
55
|
# newsitems
|
65
56
|
#
|
66
57
|
if doc.is_public
|
67
|
-
# for the sites
|
68
|
-
if doc.site
|
69
|
-
sites = Site.where( :domain => doc.site.domain )
|
70
|
-
sites.each do |site|
|
71
|
-
n = Newsitem.new {}
|
72
|
-
n.gallery = doc
|
73
|
-
n.username = doc.username
|
74
|
-
site.newsitems << n
|
75
|
-
flag = site.save
|
76
|
-
if !flag
|
77
|
-
puts! site.errors
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
# for the city
|
82
|
-
if doc.city
|
83
|
-
n = Newsitem.new {}
|
84
|
-
n.gallery = doc
|
85
|
-
n.city = doc.city
|
86
|
-
n.username = doc.username
|
87
|
-
n.save
|
88
|
-
end
|
89
|
-
end
|
90
58
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
doc
|
96
|
-
|
97
|
-
|
98
|
-
|
59
|
+
# if doc.site
|
60
|
+
# sites = Site.where( :domain => doc.site.domain )
|
61
|
+
# sites.each do |site|
|
62
|
+
# n = Newsitem.new {}
|
63
|
+
# n.gallery = doc
|
64
|
+
# n.username = doc.username
|
65
|
+
# site.newsitems << n
|
66
|
+
# flag = site.save
|
67
|
+
# if !flag
|
68
|
+
# puts! site.errors
|
69
|
+
# end
|
70
|
+
# end
|
71
|
+
# end
|
99
72
|
end
|
100
73
|
|
101
74
|
end
|
@@ -109,13 +82,8 @@ class Gallery
|
|
109
82
|
RENDER_TITLES = 'index_titles' # view name
|
110
83
|
RENDER_THUMBS = 'index_thumbs' # view name
|
111
84
|
|
112
|
-
|
113
|
-
set_callback :update, :after do |doc|
|
114
|
-
Site.update_all updated_at: Time.now
|
115
|
-
end
|
116
|
-
|
117
85
|
def export_fields
|
118
|
-
%w| name descr |
|
86
|
+
%w| name subhead descr |
|
119
87
|
end
|
120
88
|
|
121
89
|
end
|
data/lib/gameui/asset3d.rb
CHANGED
data/lib/gameui/map.rb
CHANGED
@@ -32,7 +32,6 @@ class ::Gameui::Map
|
|
32
32
|
belongs_to :creator_profile, class_name: '::Ish::UserProfile', inverse_of: :my_maps
|
33
33
|
|
34
34
|
has_and_belongs_to_many :bookmarked_profiles, class_name: '::Ish::UserProfile', inverse_of: :bookmarked_location
|
35
|
-
has_and_belongs_to_many :tags, class_name: 'Tag', inverse_of: :map
|
36
35
|
|
37
36
|
# shareable, nonpublic
|
38
37
|
field :is_public, type: Boolean, default: true
|
data/lib/ish/image_asset.rb
CHANGED
data/lib/ish/lead.rb
CHANGED
data/lib/ish/lead.rb-bk
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Lead
|
4
|
+
# _vp_ 20171204
|
5
|
+
#
|
6
|
+
class Ish::Lead
|
7
|
+
include Mongoid::Document
|
8
|
+
include Mongoid::Timestamps
|
9
|
+
|
10
|
+
store_in :collection => 'ish_leads'
|
11
|
+
|
12
|
+
# field :email
|
13
|
+
# field :company_url
|
14
|
+
# field :yelp_url
|
15
|
+
|
16
|
+
# # company name
|
17
|
+
# field :company
|
18
|
+
# validates_uniqueness_of :company
|
19
|
+
# index({ :company => -1 })
|
20
|
+
|
21
|
+
# field :description # comment, actually
|
22
|
+
|
23
|
+
field :is_done, :type => Boolean, :default => false
|
24
|
+
field :is_trash, :type => Boolean, :default => false
|
25
|
+
|
26
|
+
field :tag, :type => String # 'hired_com_ror', not enumerated for now _vp_ 20180103
|
27
|
+
# field :location
|
28
|
+
|
29
|
+
field :raw_phone, :type => String
|
30
|
+
def phone= which
|
31
|
+
write_attribute :raw_phone, which
|
32
|
+
write_attribute :phone, which.gsub(/\D/, '').to_i
|
33
|
+
end
|
34
|
+
field :phone, :type => Integer
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
class Ish::LoremIpsum
|
3
|
+
|
4
|
+
ARR = [
|
5
|
+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas a diam pretium, pellentesque lorem consequat, tempus lorem. Morbi et augue mattis, mollis enim et, lobortis ipsum. Aenean ultrices efficitur convallis. Aliquam vel tellus eu orci lobortis rhoncus. Proin varius tellus id pellentesque imperdiet. Donec accumsan diam ut tortor hendrerit pharetra. Duis rhoncus sapien leo, nec tempor massa luctus nec. In venenatis, augue ac pharetra malesuada, erat elit aliquam nisi, ac rutrum nunc purus in odio. Nam mattis vehicula finibus. Vivamus porta, massa nec posuere pulvinar, lacus nisl varius tortor, non fermentum ligula sem at odio. Cras viverra ligula quis elementum gravida. Integer interdum, orci quis varius viverra, neque eros tincidunt ex, quis fringilla quam erat in ex.",
|
6
|
+
"Pellentesque consectetur faucibus porta. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque ut orci ut justo rutrum mattis non non turpis. Quisque velit neque, porttitor at lacus quis, ultricies aliquam orci. Morbi finibus neque dolor, vitae convallis leo aliquam in. Nullam posuere urna quis velit mattis, vitae posuere mi elementum. Cras vitae fermentum nisi, sed pretium diam. Donec vestibulum, leo et vehicula pharetra, massa ante vestibulum risus, malesuada pretium metus ipsum eget quam. Nunc feugiat enim elit. Mauris dictum arcu ac nisl placerat, eu cursus tellus malesuada.",
|
7
|
+
"Nullam ultrices neque ut ipsum venenatis, et luctus justo aliquet. Nam laoreet magna eget accumsan ultrices. Quisque ut congue velit. Vivamus tincidunt bibendum tincidunt. Cras at purus eget odio consequat porta. Nullam ultricies dolor non dignissim commodo. Nullam cursus est eu mauris pharetra, sed euismod risus bibendum. Nullam quis luctus ante.",
|
8
|
+
"Suspendisse cursus quis tellus a dictum. Proin tempus metus nec ultrices egestas. Phasellus imperdiet in ante et bibendum. In aliquam nec sapien vel rutrum. Nunc libero velit, bibendum ac dolor non, interdum fringilla nulla. Aliquam nec lectus nibh. Curabitur non scelerisque tellus, eu viverra ligula. Maecenas euismod sem turpis, ac efficitur velit placerat eget.",
|
9
|
+
"Donec faucibus urna a mauris vulputate, quis dignissim turpis venenatis. Phasellus sodales dignissim molestie. Donec ultrices tempor aliquam. Pellentesque sed mi volutpat, euismod erat quis, ultricies enim. Curabitur in nibh eget ipsum fringilla laoreet. Vivamus tincidunt rutrum ullamcorper. Nulla suscipit, libero sit amet blandit venenatis, lorem diam viverra elit, sed egestas elit eros at libero.",
|
10
|
+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas a diam pretium, pellentesque lorem consequat, tempus lorem. Morbi et augue mattis, mollis enim et, lobortis ipsum. Aenean ultrices efficitur convallis. Aliquam vel tellus eu orci lobortis rhoncus. Proin varius tellus id pellentesque imperdiet. Donec accumsan diam ut tortor hendrerit pharetra. Duis rhoncus sapien leo, nec tempor massa luctus nec. In venenatis, augue ac pharetra malesuada, erat elit aliquam nisi, ac rutrum nunc purus in odio. Nam mattis vehicula finibus. Vivamus porta, massa nec posuere pulvinar, lacus nisl varius tortor, non fermentum ligula sem at odio. Cras viverra ligula quis elementum gravida. Integer interdum, orci quis varius viverra, neque eros tincidunt ex, quis fringilla quam erat in ex.",
|
11
|
+
"Pellentesque consectetur faucibus porta. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque ut orci ut justo rutrum mattis non non turpis. Quisque velit neque, porttitor at lacus quis, ultricies aliquam orci. Morbi finibus neque dolor, vitae convallis leo aliquam in. Nullam posuere urna quis velit mattis, vitae posuere mi elementum. Cras vitae fermentum nisi, sed pretium diam. Donec vestibulum, leo et vehicula pharetra, massa ante vestibulum risus, malesuada pretium metus ipsum eget quam. Nunc feugiat enim elit. Mauris dictum arcu ac nisl placerat, eu cursus tellus malesuada.",
|
12
|
+
"Nullam ultrices neque ut ipsum venenatis, et luctus justo aliquet. Nam laoreet magna eget accumsan ultrices. Quisque ut congue velit. Vivamus tincidunt bibendum tincidunt. Cras at purus eget odio consequat porta. Nullam ultricies dolor non dignissim commodo. Nullam cursus est eu mauris pharetra, sed euismod risus bibendum. Nullam quis luctus ante.",
|
13
|
+
"Suspendisse cursus quis tellus a dictum. Proin tempus metus nec ultrices egestas. Phasellus imperdiet in ante et bibendum. In aliquam nec sapien vel rutrum. Nunc libero velit, bibendum ac dolor non, interdum fringilla nulla. Aliquam nec lectus nibh. Curabitur non scelerisque tellus, eu viverra ligula. Maecenas euismod sem turpis, ac efficitur velit placerat eget.",
|
14
|
+
"Donec faucibus urna a mauris vulputate, quis dignissim turpis venenatis. Phasellus sodales dignissim molestie. Donec ultrices tempor aliquam. Pellentesque sed mi volutpat, euismod erat quis, ultricies enim. Curabitur in nibh eget ipsum fringilla laoreet. Vivamus tincidunt rutrum ullamcorper. Nulla suscipit, libero sit amet blandit venenatis, lorem diam viverra elit, sed egestas elit eros at libero.",
|
15
|
+
]
|
16
|
+
|
17
|
+
|
18
|
+
def self.txt n=3
|
19
|
+
ARR[0...3].join("\n\n")
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def self.html n=3
|
25
|
+
"<p>#{ARR[0...n].join("</p><p>")}</p>"
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
end
|
30
|
+
|
data/lib/ish/user_profile.rb
CHANGED
@@ -40,7 +40,8 @@ class Ish::UserProfile
|
|
40
40
|
|
41
41
|
has_one :profile_photo, :class_name => 'Photo', :inverse_of => :profile_city
|
42
42
|
|
43
|
-
belongs_to :user
|
43
|
+
# belongs_to :user
|
44
|
+
# validates_presence_of :user
|
44
45
|
|
45
46
|
belongs_to :current_city, :class_name => 'City', :inverse_of => :current_users, :optional => true
|
46
47
|
belongs_to :guide_city, :class_name => 'City', :inverse_of => :guide, :optional => true
|
@@ -81,9 +82,8 @@ class Ish::UserProfile
|
|
81
82
|
## @TODO: better naming convention, or remove this
|
82
83
|
field :videos_embed, :type => Boolean, :default => false
|
83
84
|
|
84
|
-
## @TODO: remove _vp_ 2022-10-04
|
85
85
|
def sudoer?
|
86
|
-
%w( piousbox@gmail.com victor@wasya.co ).include?( email )
|
86
|
+
%w( piousbox@gmail.com victor@wasya.co ).include?( self.email )
|
87
87
|
end
|
88
88
|
|
89
89
|
## manager uses it.
|
@@ -125,7 +125,6 @@ class Ish::UserProfile
|
|
125
125
|
profile = Ish::UserProfile.new({
|
126
126
|
email: email,
|
127
127
|
role_name: role_name,
|
128
|
-
user: user,
|
129
128
|
})
|
130
129
|
profile.save
|
131
130
|
|
data/lib/ish_models.rb
CHANGED
@@ -45,31 +45,23 @@ require 'ish/campaign'
|
|
45
45
|
require 'ish/crawler'
|
46
46
|
require 'ish/email_context'
|
47
47
|
require 'ish/email_template'
|
48
|
+
require 'ish/email_unsubscribe'
|
48
49
|
require 'ish/gallery_name'
|
49
50
|
require 'ish/image_asset'
|
50
51
|
require 'ish/input_error'
|
51
52
|
require 'ish/invoice'
|
52
53
|
require 'ish/issue'
|
53
54
|
require 'ish/lead'
|
55
|
+
require 'ish/lorem_ipsum'
|
54
56
|
require 'ish/meeting'
|
55
57
|
require 'ish/payment'
|
56
58
|
require 'ish/premium_item'
|
57
|
-
require 'ish/unsubscribe'
|
58
59
|
require 'ish/user_profile'
|
59
60
|
|
60
|
-
|
61
|
-
require 'city'
|
62
|
-
require 'cities_user'
|
63
|
-
require 'country'
|
64
|
-
require 'event'
|
65
|
-
require 'feature'
|
66
61
|
require 'gallery'
|
67
62
|
require 'newsitem'
|
68
63
|
require 'photo'
|
69
64
|
require 'report'
|
70
|
-
require 'site'
|
71
|
-
require 'tag'
|
72
|
-
require 'venue'
|
73
65
|
require 'video'
|
74
66
|
|
75
67
|
|
data/lib/photo.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
|
2
2
|
require 'aws-sdk'
|
3
|
+
require 'mongoid_paperclip'
|
3
4
|
|
4
5
|
class Photo
|
5
6
|
include Mongoid::Document
|
@@ -7,20 +8,13 @@ class Photo
|
|
7
8
|
include Mongoid::Paperclip
|
8
9
|
include Ish::Utils
|
9
10
|
|
10
|
-
has_and_belongs_to_many :viewers, :class_name => 'User', :inverse_of => :viewable_photos
|
11
|
-
|
12
11
|
belongs_to :user_profile, :class_name => 'Ish::UserProfile', :optional => true
|
13
12
|
def user
|
14
13
|
user_profile
|
15
14
|
end
|
16
|
-
belongs_to :profile_city, :class_name => 'City', :inverse_of => :profile_photo, :optional => true
|
17
15
|
belongs_to :user_profile, :class_name => 'Ish::UserProfile', :inverse_of => :profile_photo, :optional => true
|
18
|
-
belongs_to :profile_venue, :class_name => 'Venue', :inverse_of => :profile_photo, :optional => true
|
19
|
-
belongs_to :profile_event, :class_name => 'Event', :inverse_of => :profile_photo, :optional => true
|
20
16
|
|
21
17
|
belongs_to :report, :optional => true
|
22
|
-
belongs_to :venue, :optional => true
|
23
|
-
belongs_to :event, :optional => true
|
24
18
|
belongs_to :feature, :optional => true
|
25
19
|
belongs_to :gallery, :optional => true
|
26
20
|
belongs_to :newsitem, :optional => true
|
data/lib/report.rb
CHANGED
@@ -52,13 +52,6 @@ class Report
|
|
52
52
|
field :issue
|
53
53
|
field :subhead
|
54
54
|
|
55
|
-
belongs_to :city, :optional => true
|
56
|
-
belongs_to :site, :optional => true
|
57
|
-
belongs_to :cities_user, :optional => true
|
58
|
-
|
59
|
-
has_and_belongs_to_many :tags
|
60
|
-
has_and_belongs_to_many :venues
|
61
|
-
|
62
55
|
has_one :photo
|
63
56
|
|
64
57
|
field :n_upvotes, :default => 0
|
@@ -80,62 +73,43 @@ class Report
|
|
80
73
|
self::PER_PAGE
|
81
74
|
end
|
82
75
|
|
83
|
-
def venue
|
84
|
-
return self.venues[0] || nil
|
85
|
-
end
|
86
|
-
|
87
76
|
def self.all
|
88
77
|
self.where( :is_public => true, :is_trash => false ).order_by( :created_at => :desc )
|
89
78
|
end
|
90
79
|
|
91
|
-
def self.not_tagged
|
92
|
-
Report.where( :tag_ids => nil, :city => nil )
|
93
|
-
end
|
94
|
-
|
95
|
-
def self.for_homepage args
|
96
|
-
begin
|
97
|
-
tag_ids = args[:main_tag].children_tags.map { |tag| tag._id } + [ args[:main_tag]._id ]
|
98
|
-
return Report.where( :tag_ids.in => tag_ids ).page args[:page]
|
99
|
-
rescue
|
100
|
-
return Report.page args[:page]
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
|
105
|
-
|
106
80
|
set_callback :update, :after do |doc|
|
107
81
|
Site.update_all updated_at: Time.now
|
108
82
|
end
|
109
83
|
|
110
|
-
set_callback :create, :after do |doc|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
end
|
84
|
+
# set_callback :create, :after do |doc|
|
85
|
+
# if doc.is_public
|
86
|
+
|
87
|
+
# if !doc.venue_ids.blank?
|
88
|
+
# ( doc.venue_ids || [] ).each do |venue_id|
|
89
|
+
# v = Venue.find venue_id
|
90
|
+
# u = ::IshModels::User.find doc.user_id
|
91
|
+
# n = Newsitem.new
|
92
|
+
# n.username = u.username unless u.blank?
|
93
|
+
# n.report = doc
|
94
|
+
# v.newsitems << n
|
95
|
+
# v.save
|
96
|
+
# end
|
97
|
+
# end
|
98
|
+
|
99
|
+
# unless doc.city.blank?
|
100
|
+
# city = City.find doc.city.id
|
101
|
+
# if defined?( doc.profile ) && doc.profile
|
102
|
+
# username = doc.profile.username || 'anon'
|
103
|
+
# else
|
104
|
+
# username = '<username>'
|
105
|
+
# end
|
106
|
+
# n = Newsitem.new :report => doc, :username => username
|
107
|
+
# city.newsitems << n
|
108
|
+
# city.save
|
109
|
+
# city.touch
|
110
|
+
# end
|
111
|
+
# end
|
112
|
+
# end
|
139
113
|
|
140
114
|
def self.clear
|
141
115
|
if Rails.env.test?
|
@@ -143,10 +117,6 @@ class Report
|
|
143
117
|
end
|
144
118
|
end
|
145
119
|
|
146
|
-
def venue
|
147
|
-
self.venues[0] || nil
|
148
|
-
end
|
149
|
-
|
150
120
|
## copy-paste
|
151
121
|
field :premium_tier, type: Integer, default: 0 # how many stars need to spend, to get access? 0 = free
|
152
122
|
def is_premium
|
data/lib/video.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'mongoid/paranoia'
|
2
|
+
require 'mongoid_paperclip'
|
2
3
|
require_relative './mongoid/votable.rb'
|
3
4
|
|
4
5
|
class Video
|
@@ -34,17 +35,11 @@ class Video
|
|
34
35
|
field :lang, :type => String, :default => 'en'
|
35
36
|
|
36
37
|
field :youtube_id, :type => String
|
37
|
-
|
38
|
+
validates :youtube_id, :uniqueness => true
|
38
39
|
|
39
|
-
has_and_belongs_to_many :tags
|
40
|
-
belongs_to :city, :optional => true
|
41
|
-
belongs_to :site, :optional => true
|
42
|
-
# has_many :newsitems # unnecessary, right? _vp_ 20200412
|
43
40
|
|
44
41
|
belongs_to :user_profile, :optional => true, :class_name => 'Ish::UserProfile', :inverse_of => :videos
|
45
42
|
|
46
|
-
accepts_nested_attributes_for :site, :tags, :city
|
47
|
-
|
48
43
|
def self.list
|
49
44
|
[['', nil]] + Video.unscoped.order_by( :created_at => :desc ).map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
|
50
45
|
end
|
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.179
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
@@ -115,10 +115,6 @@ extensions: []
|
|
115
115
|
extra_rdoc_files: []
|
116
116
|
files:
|
117
117
|
- lib/address.rb
|
118
|
-
- lib/cities_user.rb
|
119
|
-
- lib/city.rb
|
120
|
-
- lib/country.rb
|
121
|
-
- lib/event.rb
|
122
118
|
- lib/feature.rb
|
123
119
|
- lib/gallery.rb
|
124
120
|
- lib/gameui/asset3d.rb
|
@@ -126,24 +122,25 @@ files:
|
|
126
122
|
- lib/gameui/map_bookmark.rb
|
127
123
|
- lib/gameui/marker.rb
|
128
124
|
- lib/gameui/premium_purchase.rb
|
129
|
-
- lib/ish/app_model2.rb
|
130
125
|
- lib/ish/cache_key.rb
|
131
126
|
- lib/ish/campaign.rb
|
132
127
|
- lib/ish/configuration.rb
|
133
128
|
- lib/ish/crawler.rb
|
134
129
|
- lib/ish/email_context.rb
|
135
130
|
- lib/ish/email_template.rb
|
131
|
+
- lib/ish/email_unsubscribe.rb
|
136
132
|
- lib/ish/gallery_name.rb
|
137
133
|
- lib/ish/image_asset.rb
|
138
134
|
- lib/ish/input_error.rb
|
139
135
|
- lib/ish/invoice.rb
|
140
136
|
- lib/ish/issue.rb
|
141
137
|
- lib/ish/lead.rb
|
138
|
+
- lib/ish/lead.rb-bk
|
139
|
+
- lib/ish/lorem_ipsum.rb
|
142
140
|
- lib/ish/meeting.rb
|
143
141
|
- lib/ish/payment.rb
|
144
142
|
- lib/ish/premium_item.rb
|
145
143
|
- lib/ish/railtie.rb
|
146
|
-
- lib/ish/unsubscribe.rb
|
147
144
|
- lib/ish/user_profile.rb
|
148
145
|
- lib/ish/utils.rb
|
149
146
|
- lib/ish_models.rb
|
@@ -152,15 +149,12 @@ files:
|
|
152
149
|
- lib/newsitem.rb
|
153
150
|
- lib/photo.rb
|
154
151
|
- lib/report.rb
|
155
|
-
- lib/site.rb
|
156
|
-
- lib/tag.rb
|
157
152
|
- lib/trash/app_model2.rb
|
158
153
|
- lib/trash/city.rb-bk
|
159
154
|
- lib/trash/event.rb
|
160
155
|
- lib/trash/site.rb
|
161
156
|
- lib/trash/tag_trash.rb
|
162
157
|
- lib/trash/venue.rb
|
163
|
-
- lib/venue.rb
|
164
158
|
- lib/video.rb
|
165
159
|
homepage: https://wasya.co
|
166
160
|
licenses:
|
data/lib/cities_user.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
|
2
|
-
class CitiesUser
|
3
|
-
|
4
|
-
include Mongoid::Document
|
5
|
-
include Mongoid::Timestamps
|
6
|
-
|
7
|
-
field :date, :type => Time
|
8
|
-
field :name, :type => String
|
9
|
-
field :descr, :type => String
|
10
|
-
|
11
|
-
belongs_to :city
|
12
|
-
belongs_to :user
|
13
|
-
|
14
|
-
has_many :reports
|
15
|
-
has_many :galleries
|
16
|
-
|
17
|
-
end
|
data/lib/city.rb
DELETED
@@ -1,100 +0,0 @@
|
|
1
|
-
class City
|
2
|
-
include ::Mongoid::Document
|
3
|
-
include ::Mongoid::Timestamps
|
4
|
-
|
5
|
-
field :name, :type => String
|
6
|
-
field :description, :type => String, :default => 'The description of this city'
|
7
|
-
|
8
|
-
field :cityname, :type => String
|
9
|
-
validates :cityname, :uniqueness => true, :allow_nil => false, :presence => true
|
10
|
-
def slug; cityname; end
|
11
|
-
def slug= s; cityname = s; end
|
12
|
-
|
13
|
-
field :x, :type => Float
|
14
|
-
field :y, :type => Float
|
15
|
-
|
16
|
-
field :deleted_at, type: Time
|
17
|
-
def self.all
|
18
|
-
self.where( deleted_at: nil, is_active: true ).order_by( name: :desc )
|
19
|
-
end
|
20
|
-
|
21
|
-
belongs_to :country, :optional => true
|
22
|
-
|
23
|
-
has_many :events
|
24
|
-
has_many :galleries
|
25
|
-
has_many :photos
|
26
|
-
has_many :reports
|
27
|
-
has_many :venues
|
28
|
-
has_many :videos
|
29
|
-
has_and_belongs_to_many :tags
|
30
|
-
|
31
|
-
has_many :current_users, :class_name => '::Ish::UserProfile', :inverse_of => :current_city
|
32
|
-
has_many :newsitems
|
33
|
-
|
34
|
-
has_many :current_users, :class_name => '::Ish::UserProfile', :inverse_of => :current_city
|
35
|
-
has_one :profile_photo, :class_name => 'Photo', :inverse_of => :profile_city
|
36
|
-
has_one :guide, :class_name => '::Ish::UserProfile', :inverse_of => :guide_city
|
37
|
-
|
38
|
-
has_many :features
|
39
|
-
|
40
|
-
field :calendar_frame, :type => String
|
41
|
-
field :is_active, type: Boolean, default: true
|
42
|
-
|
43
|
-
default_scope ->{ order_by({ :name => :asc }) }
|
44
|
-
|
45
|
-
def self.list
|
46
|
-
out = self.order_by( :name => :asc )
|
47
|
-
# no_city = City.where( :cityname => 'no_city' ).first || City.create( :cityname => 'no_city', :name => 'No City' )
|
48
|
-
[['', nil]] + out.map { |item| [ item.name, item.id ] }
|
49
|
-
end
|
50
|
-
|
51
|
-
def self.list_citynames lang = 'en'
|
52
|
-
out = self.order_by( :name => :asc )
|
53
|
-
[['', nil]] + out.map { |item| [ item['name_'+lang], item.cityname ] }
|
54
|
-
end
|
55
|
-
|
56
|
-
def self.clear
|
57
|
-
if Rails.env.test?
|
58
|
-
City.all.each { |r| r.remove }
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def self.n_features
|
63
|
-
4
|
64
|
-
end
|
65
|
-
def n_features
|
66
|
-
4
|
67
|
-
end
|
68
|
-
|
69
|
-
|
70
|
-
def j_reports args = {}
|
71
|
-
out = []
|
72
|
-
self.reports.each do |r|
|
73
|
-
rr = r.clone
|
74
|
-
rr[:username] = r.user.username
|
75
|
-
rr.created_at = r.created_at # pretty_date( r.created_at )
|
76
|
-
rr[:tag_name] = r.tag.name unless r.tag.blank?
|
77
|
-
rr[:tag_name] ||= ''
|
78
|
-
out << rr
|
79
|
-
end
|
80
|
-
return out
|
81
|
-
end
|
82
|
-
|
83
|
-
def self.for_homepage
|
84
|
-
cities = City.all.order_by( :name => :asc )
|
85
|
-
cities = cities.delete_if do |c|
|
86
|
-
( false == c.is_feature ) && ( 0 == c.galleries.length ) && ( 0 == c.reports.length )
|
87
|
-
end
|
88
|
-
return cities
|
89
|
-
end
|
90
|
-
|
91
|
-
def self.method_missing name, *args, &block
|
92
|
-
city = City.where( :cityname => name ).first
|
93
|
-
return city if city
|
94
|
-
super
|
95
|
-
end
|
96
|
-
|
97
|
-
end
|
98
|
-
|
99
|
-
|
100
|
-
|
data/lib/country.rb
DELETED
data/lib/event.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
|
2
|
-
class Event
|
3
|
-
|
4
|
-
include Mongoid::Document
|
5
|
-
include Mongoid::Timestamps
|
6
|
-
|
7
|
-
field :name, :type => String
|
8
|
-
validates :name, :presence => true, :uniqueness => true
|
9
|
-
|
10
|
-
field :eventname, :type => String
|
11
|
-
validates :eventname, :presence => true, :uniqueness => true
|
12
|
-
|
13
|
-
field :description, :type => String
|
14
|
-
|
15
|
-
field :date, :type => DateTime
|
16
|
-
validates :date, :presence => true
|
17
|
-
|
18
|
-
belongs_to :city
|
19
|
-
validates :city, :presence => true
|
20
|
-
|
21
|
-
field :x, :type => Float
|
22
|
-
field :y, :type => Float
|
23
|
-
|
24
|
-
has_one :profile_photo, :class_name => 'Photo', :inverse_of => :profile_event
|
25
|
-
has_many :photos
|
26
|
-
|
27
|
-
end
|
28
|
-
|
data/lib/ish/app_model2.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
|
2
|
-
# @deprecated, remove
|
3
|
-
class Ish::AppModel2
|
4
|
-
include ::Mongoid::Document
|
5
|
-
include ::Mongoid::Timestamps
|
6
|
-
|
7
|
-
field :is_public, :type => Boolean, :default => false
|
8
|
-
field :is_trash, :type => Boolean, :default => false
|
9
|
-
|
10
|
-
default_scope ->{ where({ :is_public => true, :is_trash => false }).order_by({ :created_at => :desc }) }
|
11
|
-
|
12
|
-
field :x, :type => Float
|
13
|
-
field :y, :type => Float
|
14
|
-
|
15
|
-
def self.list conditions = { :is_trash => false }
|
16
|
-
out = self.where( conditions ).order_by( :created_at => :desc )
|
17
|
-
[['', nil]] + out.map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
|
18
|
-
end
|
19
|
-
|
20
|
-
|
21
|
-
end
|
data/lib/site.rb
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
class Site
|
2
|
-
|
3
|
-
include Mongoid::Document
|
4
|
-
include Mongoid::Timestamps
|
5
|
-
|
6
|
-
field :domain, :type => String
|
7
|
-
validates_presence_of :domain
|
8
|
-
|
9
|
-
field :lang, :type => String, :default => 'en'
|
10
|
-
# validates :lang, { :uniqueness => :true, :scope => :domain }
|
11
|
-
|
12
|
-
field :title
|
13
|
-
field :subhead
|
14
|
-
field :description
|
15
|
-
field :home_redirect_path
|
16
|
-
|
17
|
-
field :n_features, :type => Integer, :default => 4
|
18
|
-
field :n_newsitems, :type => Integer, :default => 20
|
19
|
-
field :newsitems_per_page, :type => Integer, :default => 10 # this is used. _vp_ 20171025
|
20
|
-
field :play_videos_in_preview, :type => Boolean, :default => true
|
21
|
-
|
22
|
-
# denormalized
|
23
|
-
field :n_reports, :type => Integer
|
24
|
-
field :n_galleries, :type => Integer
|
25
|
-
|
26
|
-
field :is_video_enabled, :type => Boolean, :default => false
|
27
|
-
field :is_resume_enabled, :type => Boolean, :default => false
|
28
|
-
field :is_ads_enabled, :type => Boolean, :default => true
|
29
|
-
field :is_trash, :type => Boolean, :default => false
|
30
|
-
field :is_primary, :type => Boolean, :default => false
|
31
|
-
field :is_private, :type => Boolean, :default => false
|
32
|
-
field :private_user_emails, :type => Array, :default => []
|
33
|
-
|
34
|
-
field :homepage_layout, :type => String, :default => 'show'
|
35
|
-
field :layout, :type => String, :default => 'application'
|
36
|
-
|
37
|
-
has_many :reports
|
38
|
-
has_many :galleries
|
39
|
-
has_many :tags
|
40
|
-
has_many :videos
|
41
|
-
has_many :newsitems, :order => :created_at.desc
|
42
|
-
has_many :issues, :class_name => 'Ish::Issue'
|
43
|
-
has_many :features, :order => :created_at.desc
|
44
|
-
|
45
|
-
default_scope ->{ where({ :is_trash => false }).order_by({ :domain => :asc, :lang => :asc }) }
|
46
|
-
|
47
|
-
set_callback :create, :before do |doc|
|
48
|
-
if Site.where( :lang => doc.lang, :domain => doc.domain ).length > 0
|
49
|
-
false
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
set_callback :update, :before do |doc|
|
54
|
-
possible_duplicate = Site.where( :lang => doc.lang, :domain => doc.domain ).first
|
55
|
-
if possible_duplicate.blank?
|
56
|
-
true
|
57
|
-
elsif doc.id != possible_duplicate.id
|
58
|
-
false
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
LANGUAGES = [ 'en', 'ru', 'pt' ]
|
63
|
-
|
64
|
-
# manager uses it.
|
65
|
-
def self.list
|
66
|
-
out = self.all.order_by( :domain => :asc, :lang => :asc )
|
67
|
-
[['Select Site', nil]] + out.map { |item| [ "#{item.domain} #{item.lang}", item.id ] }
|
68
|
-
end
|
69
|
-
|
70
|
-
def self.mobi
|
71
|
-
Site.where( :domain => 'travel-guide.mobi', :lang => 'en' ).first
|
72
|
-
end
|
73
|
-
|
74
|
-
def n_reports
|
75
|
-
self.reports.unscoped.where( :is_trash => false ).length
|
76
|
-
end
|
77
|
-
|
78
|
-
def n_private_reports
|
79
|
-
self.reports.unscoped.where( :is_public => false, :is_trash => false ).length
|
80
|
-
end
|
81
|
-
|
82
|
-
def its_locales
|
83
|
-
Site.where( :domain => self.domain ).map { |s| s.lang.to_sym }
|
84
|
-
end
|
85
|
-
|
86
|
-
def self.Tgm
|
87
|
-
Site.find_by( :domain => 'travel-guide.mobi', :lang => :en )
|
88
|
-
end
|
89
|
-
def self.sedux
|
90
|
-
site = Site.where( :domain => 'sedux.local' ).first
|
91
|
-
site ||= Site.where( :domain => 'sedux.net' ).first
|
92
|
-
site
|
93
|
-
end
|
94
|
-
|
95
|
-
def name
|
96
|
-
"#{domain}/#{lang}"
|
97
|
-
end
|
98
|
-
|
99
|
-
end
|
data/lib/tag.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
class Tag
|
2
|
-
include Mongoid::Document
|
3
|
-
include Mongoid::Timestamps
|
4
|
-
include Ish::Utils
|
5
|
-
|
6
|
-
field :name, :type => String
|
7
|
-
validates :name, uniqueness: true, presence: true, allow_nil: false # @TODO: tags should only be unique globally, and per-user.
|
8
|
-
|
9
|
-
field :slug
|
10
|
-
validates :slug, uniqueness: true, presence: true, allow_nil: false
|
11
|
-
|
12
|
-
field :descr, :type => String, :default => ''
|
13
|
-
|
14
|
-
field :is_public, :type => Boolean, :default => true
|
15
|
-
field :is_trash, :type => Boolean, :default => false
|
16
|
-
field :is_feature, :type => Boolean, :default => false
|
17
|
-
|
18
|
-
field :weight, :type => Integer, :default => 10
|
19
|
-
|
20
|
-
has_many :children_tags, :class_name => 'Tag', :inverse_of => :parent_tag
|
21
|
-
belongs_to :parent_tag, :class_name => 'Tag', :inverse_of => :children_tags, :optional => true
|
22
|
-
|
23
|
-
has_many :features
|
24
|
-
has_many :newsitems
|
25
|
-
|
26
|
-
belongs_to :site, :optional => true
|
27
|
-
belongs_to :city, :optional => true
|
28
|
-
|
29
|
-
has_and_belongs_to_many :venues
|
30
|
-
has_and_belongs_to_many :cities
|
31
|
-
has_and_belongs_to_many :galleries
|
32
|
-
has_and_belongs_to_many :reports
|
33
|
-
has_and_belongs_to_many :videos
|
34
|
-
has_and_belongs_to_many :maps, class_name: 'Gameui::Map'
|
35
|
-
|
36
|
-
before_validation :set_slug
|
37
|
-
|
38
|
-
def self.clear
|
39
|
-
if Rails.env.test?
|
40
|
-
Tag.each { |r| r.remove }
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.no_parent
|
45
|
-
Tag.where( :parent_tag_id => nil )
|
46
|
-
end
|
47
|
-
|
48
|
-
# the first blank used to be disabled, not anymore _vp_ 20180418
|
49
|
-
def self.list
|
50
|
-
out = Tag.unscoped.order_by( :name => :asc )
|
51
|
-
return( [['', nil]] + out.map { |item| [ item.name, item.id ] } )
|
52
|
-
end
|
53
|
-
|
54
|
-
# @deprecated, there will be no reports or galleries in tags. There will be only features and newsitems
|
55
|
-
def self.n_items
|
56
|
-
10
|
57
|
-
end
|
58
|
-
def self.n_reports
|
59
|
-
4
|
60
|
-
end
|
61
|
-
def self.n_galleries
|
62
|
-
4
|
63
|
-
end
|
64
|
-
def self.n_videos
|
65
|
-
4
|
66
|
-
end
|
67
|
-
|
68
|
-
def self.n_features
|
69
|
-
4
|
70
|
-
end
|
71
|
-
field :n_features, type: Integer, default: 4
|
72
|
-
|
73
|
-
end
|
data/lib/venue.rb
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
class Venue
|
2
|
-
include ::Mongoid::Document
|
3
|
-
include ::Mongoid::Timestamps
|
4
|
-
include Ish::Utils
|
5
|
-
|
6
|
-
field :address
|
7
|
-
|
8
|
-
field :name, :type => String
|
9
|
-
validates :name, :uniqueness => true, :allow_nil => false
|
10
|
-
|
11
|
-
field :slug
|
12
|
-
validates :slug, :uniqueness => true, :allow_nil => false
|
13
|
-
before_validation :set_slug
|
14
|
-
|
15
|
-
field :subhead
|
16
|
-
field :descr
|
17
|
-
|
18
|
-
field :is_trash, :type => Boolean, :default => false
|
19
|
-
scope :fresh, ->{ where({ :is_trash => false }) }
|
20
|
-
scope :trash, ->{ where({ :is_trash => true }) }
|
21
|
-
|
22
|
-
field :is_public, :type => Boolean, :default => true
|
23
|
-
scope :public, ->{ where({ :is_public => true }) }
|
24
|
-
scope :not_public, ->{ where({ :is_public => false }) }
|
25
|
-
|
26
|
-
field :is_feature, :type => Boolean, :default => false
|
27
|
-
|
28
|
-
field :x, :type => Float
|
29
|
-
field :y, :type => Float
|
30
|
-
|
31
|
-
field :lang, :type => String, :default => 'en'
|
32
|
-
|
33
|
-
belongs_to :city
|
34
|
-
# belongs_to :owner, :class_name => 'User', :inverse_of => :owned_venue
|
35
|
-
validates :city, :allow_nil => false, :presence => true
|
36
|
-
|
37
|
-
has_and_belongs_to_many :tags
|
38
|
-
|
39
|
-
has_and_belongs_to_many :users
|
40
|
-
|
41
|
-
has_one :profile_photo, :class_name => 'Photo', :inverse_of => :profile_venue
|
42
|
-
|
43
|
-
has_many :reports
|
44
|
-
has_many :galleries
|
45
|
-
has_many :photos
|
46
|
-
has_many :newsitems
|
47
|
-
has_many :features
|
48
|
-
|
49
|
-
PER_PAGE = 6
|
50
|
-
|
51
|
-
def self.list conditions = { :is_trash => false }
|
52
|
-
out = self.where( conditions).order_by( :name => :asc )
|
53
|
-
[['', nil]] + out.map { |item| [ item.name, item.id ] }
|
54
|
-
end
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
set_callback :save, :before do |doc|
|
59
|
-
if doc.city
|
60
|
-
city.touch
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def self.types
|
65
|
-
return []
|
66
|
-
# if 'en' == @locale
|
67
|
-
# [ 'Hotels', 'Restaurants', 'Bars' ]
|
68
|
-
# else
|
69
|
-
# [ 'Hotels', 'Restaurants', 'Bars' ]
|
70
|
-
# end
|
71
|
-
end
|
72
|
-
|
73
|
-
def self.n_features
|
74
|
-
6
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|