ish_models 0.0.33.161 → 0.0.33.164

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 442096ab6ef54689b9a4ca3a16107d1f49f7dd2e0af2eb7b2d79d4bd9706f950
4
- data.tar.gz: 20d4ed02e4eecdcbf558d7cb9dfa5e91cab277e066ecb1bf787287c9829bbd75
3
+ metadata.gz: a783500814f32b8c34ef3feade0aef48169ea390eb033422518593edef4cf67b
4
+ data.tar.gz: ae18235c6b0862be5e0d09b53c86002d1bf76824d17391b2a4507749f358d911
5
5
  SHA512:
6
- metadata.gz: 02af3b69874afdfaf9b78b6c95a3d38319fbbc96513454bbd24e69b5da8b24e6a0dbdd8177291b09ce1927e6dacdf0f6c907f5b776b41f92edf829ed5f50bc59
7
- data.tar.gz: 06d0c1cde0995eb9490a1182cbce13bbc7abe59dc49606d6a213200335e7da6992dab1c557e31fe310225b280c06ff2f345d709c2947d5def30b4af93e8e8534
6
+ metadata.gz: 4522756a1cedf0b0a570e13ad1a35dda926930aadbb7dbe5112de03923b3c5f133ee1e0c569639bf01fccb4be7926a82d406523c8ef1fe2c18705c9bc93e70be
7
+ data.tar.gz: 45b1305bdb9395f37325d78183d746ff7c9c2f6a9bb01ca533dc56b11ac176816cf9ad01b612d58514ff43e7ea0395b126b7fe682ae4a81fcd4091420493d591
@@ -1,5 +1,5 @@
1
1
 
2
- class CoTailors::Address
2
+ class Address
3
3
  include Mongoid::Document
4
4
  include Mongoid::Timestamps
5
5
 
data/lib/city.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  class City
2
2
  include ::Mongoid::Document
3
3
  include ::Mongoid::Timestamps
4
- include AuxModel
5
4
 
6
5
  field :name, :type => String
7
6
  field :description, :type => String, :default => 'The description of this city'
data/lib/gameui/map.rb CHANGED
@@ -25,6 +25,7 @@ class ::Gameui::Map
25
25
  belongs_to :creator_profile, class_name: '::Ish::UserProfile', inverse_of: :my_maps
26
26
 
27
27
  has_and_belongs_to_many :bookmarked_profiles, class_name: '::Ish::UserProfile', inverse_of: :bookmarked_location
28
+ has_and_belongs_to_many :tags, class_name: 'Tag', inverse_of: :map
28
29
 
29
30
  # shareable, nonpublic
30
31
  field :is_public, type: Boolean, default: true
@@ -58,6 +59,10 @@ class ::Gameui::Map
58
59
  field :h, type: Integer
59
60
  validates :h, presence: true
60
61
 
62
+ ## @TODO: abstract this into a module
63
+ field :x, :type => Float
64
+ field :y, :type => Float
65
+
61
66
  # @TODO: this is shared between map and marker, move to a concern.
62
67
  before_validation :compute_w_h
63
68
  def compute_w_h
@@ -82,7 +87,7 @@ class ::Gameui::Map
82
87
 
83
88
  def self.list conditions = { is_trash: false }
84
89
  out = self.order_by( created_at: :desc )
85
- [[nil, nil]] + out.map { |item| [ item.name, item.id ] }
90
+ [[nil, nil]] + out.map { |item| [ item.name, item.id.to_s ] }
86
91
  end
87
92
 
88
93
  def breadcrumbs
data/lib/gameui/marker.rb CHANGED
@@ -4,13 +4,12 @@ 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
- validates :name, presence: true
8
+ validates_uniqueness_of :name, scope: :map_id
9
+ validates_presence_of :name
10
+ def slug
11
+ id.to_s
12
+ end
14
13
 
15
14
  field :ordering, type: String, default: 'jjj'
16
15
 
@@ -30,6 +29,10 @@ class ::Gameui::Marker
30
29
 
31
30
  field :deleted_at, type: Time, default: nil # @TODO: replace with paranoia
32
31
 
32
+ ## @TODO: abstract this into a module
33
+ field :x, :type => Float, default: 0
34
+ field :y, :type => Float, default: 0
35
+
33
36
  field :is_public, type: Boolean, default: true
34
37
  def self.public
35
38
  where( is_public: true )
@@ -49,7 +52,9 @@ class ::Gameui::Marker
49
52
  has_and_belongs_to_many :shared_profiles, :class_name => 'Ish::UserProfile', :inverse_of => :shared_markers
50
53
 
51
54
  belongs_to :map, class_name: '::Gameui::Map', inverse_of: :markers
52
- belongs_to :destination, class_name: '::Gameui::Map', inverse_of: :from_markers
55
+
56
+ belongs_to :destination, class_name: '::Gameui::Map', inverse_of: :from_markers
57
+
53
58
  belongs_to :creator_profile, class_name: 'Ish::UserProfile', inverse_of: :my_markers
54
59
 
55
60
  # # @deprecated, don't use!
@@ -61,22 +66,8 @@ class ::Gameui::Marker
61
66
 
62
67
  field :w, type: Integer
63
68
  validates :w, presence: true
64
-
65
69
  field :h, type: Integer
66
70
  validates :h, presence: true
67
-
68
- field :x, type: Integer, default: 0
69
- # validates :x, presence: true
70
-
71
- field :y, type: Integer, default: 0
72
- # validates :y, presence: true
73
-
74
- field :centerOffsetX, type: Integer, default: 0
75
- # validates :centerXOffset, presence: true
76
-
77
- field :centerOffsetY, type: Integer, default: 0
78
- # validates :centerYOffset, presence: true
79
-
80
71
  # @TODO: this is shared between map and marker, move to a concern.
81
72
  before_validation :compute_w_h
82
73
  def compute_w_h
@@ -84,7 +75,6 @@ class ::Gameui::Marker
84
75
  self.h = self.w = 0
85
76
  return
86
77
  end
87
-
88
78
  begin
89
79
  geo = Paperclip::Geometry.from_file(Paperclip.io_adapters.for(image.image))
90
80
  self.w = geo.width
@@ -95,6 +85,11 @@ class ::Gameui::Marker
95
85
  end
96
86
  end
97
87
 
88
+ field :centerOffsetX, type: Float, default: 0
89
+ field :centerOffsetY, type: Float, default: 0
90
+
91
+
92
+
98
93
  def export_fields
99
94
  %w|
100
95
  centerOffsetX centerOffsetY creator_profile_id
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 => 'ish_lead'
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_models.rb CHANGED
@@ -45,7 +45,6 @@ require 'ish/premium_item'
45
45
  require 'ish/utils'
46
46
  require 'ish/user_profile'
47
47
 
48
- require 'aux_model'
49
48
  require 'city'
50
49
  require 'cities_user'
51
50
  require 'country'
data/lib/newsitem.rb CHANGED
@@ -11,7 +11,7 @@ class Newsitem
11
11
  def gallery
12
12
  self.gallery_id ? Gallery.unscoped.find( self.gallery_id ) : nil
13
13
  end
14
- belongs_to :map, optional: true, class_name: '::Gameui::Map'
14
+ belongs_to :map, optional: true, class_name: '::Gameui::Map'
15
15
  belongs_to :profile, optional: true, class_name: 'Ish::UserProfile'
16
16
  belongs_to :photo, optional: true
17
17
  belongs_to :report, optional: true
@@ -37,6 +37,18 @@ class Newsitem
37
37
  field :downvoting_users, :type => Array, :default => []
38
38
  field :is_feature, :type => Boolean, :default => false
39
39
 
40
+ TYPE_GALLERY = :type_gallery
41
+ TYPE_PHOTO = :type_photo
42
+ TYPE_REPORT = :type_report
43
+ TYPE_VIDEO = :type_video
44
+ def item_type
45
+ return TYPE_GALLERY if gallery_id
46
+ return TYPE_PHOTO if photo_id
47
+ return TYPE_REPORT if report_id
48
+ return TYPE_VIDEO if video_id
49
+ end
50
+
51
+
40
52
  PER_PAGE = 6
41
53
 
42
54
  default_scope ->{ order_by({ :created_at => :desc }) }
data/lib/site.rb CHANGED
@@ -2,7 +2,6 @@ class Site
2
2
 
3
3
  include Mongoid::Document
4
4
  include Mongoid::Timestamps
5
- include AuxModel
6
5
 
7
6
  field :domain, :type => String
8
7
  validates_presence_of :domain
data/lib/tag.rb CHANGED
@@ -4,15 +4,15 @@ class Tag
4
4
  include Ish::Utils
5
5
 
6
6
  field :name, :type => String
7
- # validates :name, :uniqueness => true, :allow_nil => false
7
+ validates :name, :uniqueness => true, :allow_nil => false
8
8
 
9
9
  field :slug
10
10
  validates :slug, :uniqueness => true, presence: true, allow_nil: false
11
11
 
12
12
  field :descr, :type => String, :default => ''
13
13
 
14
- field :is_public, :type => Boolean, :default => true
15
- field :is_trash, :type => Boolean, :default => false
14
+ field :is_public, :type => Boolean, :default => true
15
+ field :is_trash, :type => Boolean, :default => false
16
16
  field :is_feature, :type => Boolean, :default => false
17
17
 
18
18
  field :weight, :type => Integer, :default => 10
@@ -31,10 +31,7 @@ class Tag
31
31
  has_and_belongs_to_many :galleries
32
32
  has_and_belongs_to_many :reports
33
33
  has_and_belongs_to_many :videos
34
-
35
- default_scope ->{
36
- where({ :is_public => true, :is_trash => false }).order_by({ :name => :asc })
37
- }
34
+ has_and_belongs_to_many :maps, class_name: 'Gameui::Map'
38
35
 
39
36
  before_validation :set_slug
40
37
 
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.161
4
+ version: 0.0.33.164
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/aux_model.rb
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
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
@@ -1,2 +0,0 @@
1
-
2
- namespace co_tailors is trash. It'd take me too much eddors, and I'd rather use SpreeCommerce.
@@ -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
-
@@ -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
-