ish_models 0.0.33.160 → 0.0.33.163

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: 9357739f510cad92b5496ec766b721e5dc1a621855ad3d43aa17d95715415b02
4
- data.tar.gz: a1e7f1e1e0687d944313996bf0684977706f3340dbf85a76463616453a988521
3
+ metadata.gz: 68d413825a0a694b0bdfd1a6fee4a85812bb2f3d34e0f431d2b0a30c27b29304
4
+ data.tar.gz: 3a5a7db6ce515ba7e9711839ab4c10b8f74387abd0e6d38c7bf0510d5e86094b
5
5
  SHA512:
6
- metadata.gz: a23fdd757857717baa7e99b0ffb5d01d3a32dda773ba6655a3c525f65e31a10185e4918788804a2ddabbb926b633a1538f2e6fc20dba46d60bd16e427e467bc6
7
- data.tar.gz: 794c26976f05052b423499feb31cdf2f801b5d0e55dd8aacdd51dd41d315f11cdd4c4ed92b14e0a79618214133e3a5c33fd9f3a8e8adc6a8f50f7d645caef1b0
6
+ metadata.gz: c6b20eb004d674c488b459c23c12ca284bacefb558e1dfcdf03ce2e9b9548fb92ee7ba0c7452dbefb785b05e908a00f4ebdbda6548db7ae9a59df327944032b1
7
+ data.tar.gz: 2de807a995e6523d7ff0251f26a24daa127b3b13c1a00279baa69f72b78f708ff0e4cf5317255b19b8cc1f4b98fc629b4aede0321342b2baa6ab4b6d454f0596
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
data/lib/gameui/marker.rb CHANGED
@@ -30,6 +30,10 @@ class ::Gameui::Marker
30
30
 
31
31
  field :deleted_at, type: Time, default: nil # @TODO: replace with paranoia
32
32
 
33
+ ## @TODO: abstract this into a module
34
+ field :x, :type => Float
35
+ field :y, :type => Float
36
+
33
37
  field :is_public, type: Boolean, default: true
34
38
  def self.public
35
39
  where( is_public: true )
@@ -49,7 +53,21 @@ class ::Gameui::Marker
49
53
  has_and_belongs_to_many :shared_profiles, :class_name => 'Ish::UserProfile', :inverse_of => :shared_markers
50
54
 
51
55
  belongs_to :map, class_name: '::Gameui::Map', inverse_of: :markers
56
+
52
57
  belongs_to :destination, class_name: '::Gameui::Map', inverse_of: :from_markers
58
+ before_validation :set_destination
59
+ def set_destination
60
+ d = Map.where({ slug: slug }).first
61
+
62
+ puts! self, '#set_destination'
63
+
64
+ if !d
65
+ self.errors.add( "Cannot save marker, destination |#{slug}| not found." )
66
+ return
67
+ end
68
+ self.destination_id = d.id
69
+ end
70
+
53
71
  belongs_to :creator_profile, class_name: 'Ish::UserProfile', inverse_of: :my_markers
54
72
 
55
73
  # # @deprecated, don't use!
@@ -61,22 +79,8 @@ class ::Gameui::Marker
61
79
 
62
80
  field :w, type: Integer
63
81
  validates :w, presence: true
64
-
65
82
  field :h, type: Integer
66
83
  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
84
  # @TODO: this is shared between map and marker, move to a concern.
81
85
  before_validation :compute_w_h
82
86
  def compute_w_h
@@ -84,7 +88,6 @@ class ::Gameui::Marker
84
88
  self.h = self.w = 0
85
89
  return
86
90
  end
87
-
88
91
  begin
89
92
  geo = Paperclip::Geometry.from_file(Paperclip.io_adapters.for(image.image))
90
93
  self.w = geo.width
@@ -95,6 +98,14 @@ class ::Gameui::Marker
95
98
  end
96
99
  end
97
100
 
101
+ field :centerOffsetX, type: Integer, default: 0
102
+ # validates :centerXOffset, presence: true
103
+
104
+ field :centerOffsetY, type: Integer, default: 0
105
+ # validates :centerYOffset, presence: true
106
+
107
+
108
+
98
109
  def export_fields
99
110
  %w|
100
111
  centerOffsetX centerOffsetY creator_profile_id
@@ -22,7 +22,7 @@ class Ish::UserProfile
22
22
  |
23
23
  end
24
24
 
25
- field :scratchpad
25
+ field :scratchpad, default: ''
26
26
 
27
27
  field :fb_access_token
28
28
  field :fb_long_access_token
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/photo.rb CHANGED
@@ -62,7 +62,7 @@ class Photo
62
62
  |
63
63
  end
64
64
 
65
- validates_attachment_content_type :photo, :content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif", 'application/octet-stream' ]
65
+ validates_attachment_content_type :photo, :content_type => ["image/webp", "image/jpg", "image/jpeg", "image/png", "image/gif", 'application/octet-stream' ]
66
66
 
67
67
  end
68
68
 
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
 
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.160
4
+ version: 0.0.33.163
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox