ish_models 0.0.33.162 → 0.0.33.166
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/{co_tailors/address.rb → address.rb} +1 -1
- data/lib/city.rb +0 -1
- data/lib/gameui/map.rb +5 -1
- data/lib/gameui/marker.rb +16 -30
- data/lib/ish/lead.rb +4 -1
- data/lib/ish/unsubscribe.rb +11 -0
- data/lib/ish/user_profile.rb +3 -0
- data/lib/ish_models.rb +1 -1
- data/lib/site.rb +0 -1
- data/lib/tag.rb +2 -2
- data/lib/video.rb +2 -2
- metadata +3 -8
- data/lib/aux_model.rb +0 -22
- data/lib/co_tailors/README.txt +0 -2
- data/lib/co_tailors/order.rb +0 -26
- data/lib/co_tailors/order_item.rb +0 -29
- data/lib/co_tailors/product.rb +0 -16
- data/lib/co_tailors/profile_measurement.rb +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d2c393a3ae573621c06610661cda6a73bf8173aeaeea1ee126256c31d0848a4
|
4
|
+
data.tar.gz: ff72185a3f761ddd7dd5efdb8bbf99428763ab763319c6da3b3ad2d35216d575
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3bc3cb6150bcc21a7f60ee41b66f694f6290677d5908e698d47d879a76298a3307e2871d54fde5fcdc911906b3a64052e6e2d4d94f98b481617386e0851653d
|
7
|
+
data.tar.gz: c16e81ddfbb6051e2b2907e6685fb8dd77b7b9304ef9741191a3619b72c69317ddff2b78b84a0a665d0b3afe4016929e9efbd5664c87d4c733bdf4fd62914fb8
|
data/lib/city.rb
CHANGED
data/lib/gameui/map.rb
CHANGED
@@ -59,6 +59,10 @@ class ::Gameui::Map
|
|
59
59
|
field :h, type: Integer
|
60
60
|
validates :h, presence: true
|
61
61
|
|
62
|
+
## @TODO: abstract this into a module
|
63
|
+
field :x, :type => Float
|
64
|
+
field :y, :type => Float
|
65
|
+
|
62
66
|
# @TODO: this is shared between map and marker, move to a concern.
|
63
67
|
before_validation :compute_w_h
|
64
68
|
def compute_w_h
|
@@ -83,7 +87,7 @@ class ::Gameui::Map
|
|
83
87
|
|
84
88
|
def self.list conditions = { is_trash: false }
|
85
89
|
out = self.order_by( created_at: :desc )
|
86
|
-
[[nil, nil]] + out.map { |item| [ item.name, item.id ] }
|
90
|
+
[[nil, nil]] + out.map { |item| [ item.name, item.id.to_s ] }
|
87
91
|
end
|
88
92
|
|
89
93
|
def breadcrumbs
|
data/lib/gameui/marker.rb
CHANGED
@@ -4,13 +4,16 @@ class ::Gameui::Marker
|
|
4
4
|
include Mongoid::Timestamps
|
5
5
|
include Ish::Utils
|
6
6
|
|
7
|
-
field :slug
|
8
|
-
## @TODO: probably remove this, no reason not to have two markers to the same slug (destination)
|
9
|
-
validates_uniqueness_of :slug, scope: :map_id
|
10
|
-
validates_presence_of :slug
|
11
|
-
|
12
7
|
field :name, type: String
|
13
|
-
|
8
|
+
validates_uniqueness_of :name, scope: :map_id
|
9
|
+
validates_presence_of :name
|
10
|
+
|
11
|
+
## This is not a map, I don't need a slug.
|
12
|
+
## @TODO: remove it. _vp_ 2022-06-17
|
13
|
+
field :slug
|
14
|
+
def slug
|
15
|
+
return self[:slug] || id.to_s
|
16
|
+
end
|
14
17
|
|
15
18
|
field :ordering, type: String, default: 'jjj'
|
16
19
|
|
@@ -30,6 +33,10 @@ class ::Gameui::Marker
|
|
30
33
|
|
31
34
|
field :deleted_at, type: Time, default: nil # @TODO: replace with paranoia
|
32
35
|
|
36
|
+
## @TODO: abstract this into a module
|
37
|
+
field :x, :type => Float, default: 0
|
38
|
+
field :y, :type => Float, default: 0
|
39
|
+
|
33
40
|
field :is_public, type: Boolean, default: true
|
34
41
|
def self.public
|
35
42
|
where( is_public: true )
|
@@ -50,19 +57,7 @@ class ::Gameui::Marker
|
|
50
57
|
|
51
58
|
belongs_to :map, class_name: '::Gameui::Map', inverse_of: :markers
|
52
59
|
|
53
|
-
belongs_to :destination,
|
54
|
-
before_validation :set_destination
|
55
|
-
def set_destination
|
56
|
-
d = Map.where({ slug: slug }).first
|
57
|
-
|
58
|
-
puts! self, '#set_destination'
|
59
|
-
|
60
|
-
if !d
|
61
|
-
self.errors.add( "Cannot save marker, destination |#{slug}| not found." )
|
62
|
-
return
|
63
|
-
end
|
64
|
-
self.destination_id = d.id
|
65
|
-
end
|
60
|
+
belongs_to :destination, class_name: '::Gameui::Map', inverse_of: :from_markers
|
66
61
|
|
67
62
|
belongs_to :creator_profile, class_name: 'Ish::UserProfile', inverse_of: :my_markers
|
68
63
|
|
@@ -94,17 +89,8 @@ class ::Gameui::Marker
|
|
94
89
|
end
|
95
90
|
end
|
96
91
|
|
97
|
-
field :
|
98
|
-
|
99
|
-
|
100
|
-
field :y, type: Integer, default: 0
|
101
|
-
# validates :y, presence: true
|
102
|
-
|
103
|
-
field :centerOffsetX, type: Integer, default: 0
|
104
|
-
# validates :centerXOffset, presence: true
|
105
|
-
|
106
|
-
field :centerOffsetY, type: Integer, default: 0
|
107
|
-
# validates :centerYOffset, presence: true
|
92
|
+
field :centerOffsetX, type: Float, default: 0
|
93
|
+
field :centerOffsetY, type: Float, default: 0
|
108
94
|
|
109
95
|
|
110
96
|
|
data/lib/ish/lead.rb
CHANGED
@@ -7,7 +7,7 @@ class Ish::Lead
|
|
7
7
|
include Mongoid::Document
|
8
8
|
include Mongoid::Timestamps
|
9
9
|
|
10
|
-
store_in :collection => '
|
10
|
+
store_in :collection => 'ish_leads'
|
11
11
|
|
12
12
|
belongs_to :profile, :class_name => '::Ish::UserProfile'
|
13
13
|
|
@@ -49,3 +49,6 @@ class Ish::Lead
|
|
49
49
|
field :extra, :type => Array, :default => []
|
50
50
|
|
51
51
|
end
|
52
|
+
|
53
|
+
Lead = Ish::Lead
|
54
|
+
|
data/lib/ish/user_profile.rb
CHANGED
@@ -31,6 +31,9 @@ class Ish::UserProfile
|
|
31
31
|
field :lang, default: 'en'
|
32
32
|
|
33
33
|
ROLES = [ :admin, :manager, :guy ]
|
34
|
+
ROLE_ADMIN = :admin
|
35
|
+
ROLE_MANAGER = :manager
|
36
|
+
ROLE_GUY = :guy
|
34
37
|
field :role_name, :type => Symbol
|
35
38
|
|
36
39
|
has_one :profile_photo, :class_name => 'Photo', :inverse_of => :profile_city
|
data/lib/ish_models.rb
CHANGED
@@ -42,10 +42,10 @@ require 'ish/issue'
|
|
42
42
|
require 'ish/lead'
|
43
43
|
require 'ish/payment'
|
44
44
|
require 'ish/premium_item'
|
45
|
+
require 'ish/unsubscribe'
|
45
46
|
require 'ish/utils'
|
46
47
|
require 'ish/user_profile'
|
47
48
|
|
48
|
-
require 'aux_model'
|
49
49
|
require 'city'
|
50
50
|
require 'cities_user'
|
51
51
|
require 'country'
|
data/lib/site.rb
CHANGED
data/lib/tag.rb
CHANGED
@@ -4,10 +4,10 @@ class Tag
|
|
4
4
|
include Ish::Utils
|
5
5
|
|
6
6
|
field :name, :type => String
|
7
|
-
validates :name, :
|
7
|
+
validates :name, uniqueness: true, presence: true, allow_nil: false # @TODO: tags should only be unique globally, and per-user.
|
8
8
|
|
9
9
|
field :slug
|
10
|
-
validates :slug, :
|
10
|
+
validates :slug, uniqueness: true, presence: true, allow_nil: false
|
11
11
|
|
12
12
|
field :descr, :type => String, :default => ''
|
13
13
|
|
data/lib/video.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'mongoid/paranoia'
|
2
|
+
|
1
3
|
class Video
|
2
4
|
include Mongoid::Document
|
3
5
|
include Mongoid::Timestamps
|
@@ -10,8 +12,6 @@ class Video
|
|
10
12
|
field :name, :type => String
|
11
13
|
field :descr, :type => String, :as => :description
|
12
14
|
|
13
|
-
# default_scope ->{ where({ :is_public => true, :is_trash => false }).order_by({ :created_at => :desc }) }
|
14
|
-
|
15
15
|
field :is_trash, :type => Boolean, :default => false
|
16
16
|
def is_trash
|
17
17
|
if deleted_at
|
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.166
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
@@ -114,15 +114,9 @@ executables: []
|
|
114
114
|
extensions: []
|
115
115
|
extra_rdoc_files: []
|
116
116
|
files:
|
117
|
-
- lib/
|
117
|
+
- lib/address.rb
|
118
118
|
- lib/cities_user.rb
|
119
119
|
- lib/city.rb
|
120
|
-
- lib/co_tailors/README.txt
|
121
|
-
- lib/co_tailors/address.rb
|
122
|
-
- lib/co_tailors/order.rb
|
123
|
-
- lib/co_tailors/order_item.rb
|
124
|
-
- lib/co_tailors/product.rb
|
125
|
-
- lib/co_tailors/profile_measurement.rb
|
126
120
|
- lib/country.rb
|
127
121
|
- lib/event.rb
|
128
122
|
- lib/feature.rb
|
@@ -145,6 +139,7 @@ files:
|
|
145
139
|
- lib/ish/payment.rb
|
146
140
|
- lib/ish/premium_item.rb
|
147
141
|
- lib/ish/railtie.rb
|
142
|
+
- lib/ish/unsubscribe.rb
|
148
143
|
- lib/ish/user_profile.rb
|
149
144
|
- lib/ish/utils.rb
|
150
145
|
- lib/ish_models.rb
|
data/lib/aux_model.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
|
2
|
-
module AuxModel
|
3
|
-
|
4
|
-
def add_newsitem item
|
5
|
-
n = Newsitem.new
|
6
|
-
case item.class.name
|
7
|
-
when 'Video'
|
8
|
-
n.video_id = item.id
|
9
|
-
when 'Photo'
|
10
|
-
raise 'Not Implemented'
|
11
|
-
when 'Report'
|
12
|
-
raise 'Not Implemented'
|
13
|
-
when 'Gallery'
|
14
|
-
raise 'Not Implmented'
|
15
|
-
else
|
16
|
-
raise 'Not Implemented'
|
17
|
-
end
|
18
|
-
self.newsitems << n
|
19
|
-
self.save
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
data/lib/co_tailors/README.txt
DELETED
data/lib/co_tailors/order.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require_relative 'order_item'
|
2
|
-
|
3
|
-
class CoTailors::Order
|
4
|
-
include Mongoid::Document
|
5
|
-
include Mongoid::Timestamps
|
6
|
-
|
7
|
-
belongs_to :profile, :class_name => '::Ish::UserProfile'
|
8
|
-
|
9
|
-
has_many :items, :class_name => '::CoTailors::OrderItem'
|
10
|
-
|
11
|
-
field :submitted_at, :type => Time
|
12
|
-
|
13
|
-
MEASUREMENT_PARAMS = [ :neck_around, :chest_around, :waist_around, :sleeve_length, :shoulder_width, :shirt_length, :bicep_around ]
|
14
|
-
|
15
|
-
def grand_total
|
16
|
-
tax = 0.05
|
17
|
-
shipping = 0 # 1200
|
18
|
-
|
19
|
-
subtotal = items.all.map { |i| i.cost }.reduce( :+ )
|
20
|
-
subtotal = subtotal * (tax + 1)
|
21
|
-
subtotal += shipping
|
22
|
-
return subtotal.to_i
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
|
@@ -1,29 +0,0 @@
|
|
1
|
-
|
2
|
-
class CoTailors::OrderItem
|
3
|
-
include Mongoid::Document
|
4
|
-
include Mongoid::Timestamps
|
5
|
-
|
6
|
-
belongs_to :order, :class_name => 'CoTailors::Order'
|
7
|
-
|
8
|
-
KIND_SHIRT = 'const-kind-shirt'
|
9
|
-
KIND_PANTS = 'const-kind-pants'
|
10
|
-
KIND_SUIT = 'const-kind-suits'
|
11
|
-
KINDS = %w{ const-kind-shirt const-kind-pants const-kind-suits }
|
12
|
-
field :kind, :type => String
|
13
|
-
validates :kind, :presence => true
|
14
|
-
|
15
|
-
FABRICS = [ :white, :black, :light_blue, :dark_blue, :dark_green, :pink, :gray ]
|
16
|
-
field :fabric, :type => String
|
17
|
-
validates :fabric, :presence => true
|
18
|
-
|
19
|
-
has_one :measurement, :class_name => 'CoTailors::ProfileMeasurement'
|
20
|
-
validates :measurement, :presence => true
|
21
|
-
|
22
|
-
field :quantity, :type => Integer
|
23
|
-
validates :quantity, :presence => true
|
24
|
-
|
25
|
-
field :cost, :type => Integer # pennies!
|
26
|
-
validates :cost, :presence => true
|
27
|
-
|
28
|
-
end
|
29
|
-
|
data/lib/co_tailors/product.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
|
2
|
-
class CoTailors::Product
|
3
|
-
include Mongoid::Document
|
4
|
-
include Mongoid::Timestamps
|
5
|
-
|
6
|
-
field :cost, :type => Integer
|
7
|
-
field :title, :type => String
|
8
|
-
field :description, :type => String
|
9
|
-
|
10
|
-
KINDS = %w( shirt pants suit )
|
11
|
-
field :kind, :type => String
|
12
|
-
index({ :kind => -1 })
|
13
|
-
validates_uniqueness_of :kind
|
14
|
-
|
15
|
-
end
|
16
|
-
|
@@ -1,32 +0,0 @@
|
|
1
|
-
|
2
|
-
class CoTailors::ProfileMeasurement
|
3
|
-
include Mongoid::Document
|
4
|
-
include Mongoid::Timestamps
|
5
|
-
|
6
|
-
UNITS = [ :inches, :centimeters ]
|
7
|
-
UNITS_INCHES = :inches
|
8
|
-
UNITS_CENTIMETERS = :centimeters
|
9
|
-
field :units, :type => Symbol
|
10
|
-
|
11
|
-
belongs_to :profile, :class_name => 'Ish::UserProfile', :optional => true
|
12
|
-
belongs_to :order_item, :class_name => 'CoTailors::OrderItem', :optional => true
|
13
|
-
|
14
|
-
## shirt
|
15
|
-
field :neck_around, :type => Float, :default => 0
|
16
|
-
field :chest_around, :type => Float, :default => 0
|
17
|
-
field :waist_around, :type => Float, :default => 0
|
18
|
-
field :sleeve_length, :type => Float, :default => 0
|
19
|
-
field :shoulder_width, :type => Float, :default => 0
|
20
|
-
field :shirt_length, :type => Float, :default => 0
|
21
|
-
field :bicep_around, :type => Float, :default => 0
|
22
|
-
field :wrist_around, :type => Float, :default => 0 # Is this optional? I want less here
|
23
|
-
## pants
|
24
|
-
# length
|
25
|
-
# waist
|
26
|
-
# hips
|
27
|
-
## suit
|
28
|
-
|
29
|
-
field :nickname
|
30
|
-
|
31
|
-
end
|
32
|
-
|