ish_models 0.0.33.240 → 0.0.33.242

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a019b6d79afed69337d3cb41d08427cae941c52865a68ac5cf08ab3513072f4d
4
- data.tar.gz: 1b38c157a54506f181f940218a3190455f5e790c69fb1c9a5083451043c51724
3
+ metadata.gz: 947ab34b57772b91d9fb1b1334c035debd3a0935f5fc1d06fccd102d49742ff0
4
+ data.tar.gz: c1c390a81049197dd06af734b0018f8697c21f9fec0d5b5c8f54d286ec2bdb38
5
5
  SHA512:
6
- metadata.gz: efaa2cc5056b4b2ce1061a20d64a851eeace5ee617b917ea8de1fa23a95936f390309e06580300d31ee382f545d2cb103fb2ce3959d51ca0cbd15bf974ad9fa7
7
- data.tar.gz: 848da5f2623372fd0936086efeb3044f36bde484b8bf1e92e3899a484fbd0568eb3cdf3133dc5aa6bb769300fe47cd1b68d33df2f3ab6ba50247f63db7419865
6
+ metadata.gz: b5824c65663990c2d9ad914fdec672f952d258a85ef77f682fe086ec49204f65c3d8b5e7ba5a99aa7ca20f613d2cd8c902fae49c0aec2fc50433d1f1c4522259
7
+ data.tar.gz: c92e76f7d0c5ee56898354e1a648581a0979cf3690ebf8a9672e61250d433e3d51cea1a50bd5a4d52ebcca7720ac20aaa1d0a65614be888af7edae53c99af111
data/lib/gameui/map.rb CHANGED
@@ -35,6 +35,7 @@ class ::Gameui::Map
35
35
 
36
36
  # shareable, nonpublic
37
37
  field :is_public, type: Boolean, default: true
38
+ scope :public, ->{ where( is_public: true ) }
38
39
  has_and_belongs_to_many :shared_profiles, :class_name => 'Ish::UserProfile', :inverse_of => :shared_locations
39
40
 
40
41
  field :version, type: String, default: '0.0.0'
@@ -108,6 +108,8 @@ class Ish::UserProfile
108
108
  end
109
109
  end
110
110
 
111
+ field :per_page, type: Integer, default: 100
112
+
111
113
  end
112
114
 
113
115
  Profile = Ish::UserProfile
@@ -23,18 +23,21 @@ class Office::EmailMessage
23
23
  field :subject
24
24
  field :part_txt
25
25
  field :part_html
26
- # attachments ?
26
+ field :preamble
27
+ field :epilogue
28
+
29
+ has_many :attachments, class_name: 'Photo'
27
30
 
28
31
  def lead
29
32
  Lead.find_by email: from
30
33
  end
31
34
 
32
- field :from, type: :string
33
- field :froms, type: Array, default: []
34
- field :to, type: :string
35
- field :tos, type: Array, default: []
36
- field :ccs, type: Array, default: []
37
- field :bccs, type: Array, default: []
35
+ field :from, type: :string
36
+ field :froms, type: Array, default: []
37
+ field :to, type: :string
38
+ field :tos, type: Array, default: []
39
+ field :ccs, type: Array, default: []
40
+ field :bccs, type: Array, default: []
38
41
 
39
42
  field :date, type: DateTime
40
43
  def received_at
data/lib/photo.rb CHANGED
@@ -8,15 +8,12 @@ class Photo
8
8
  include Mongoid::Paperclip
9
9
  include Ish::Utils
10
10
 
11
- belongs_to :user_profile, :class_name => 'Ish::UserProfile', :optional => true
12
- def user
13
- user_profile
14
- end
15
- belongs_to :user_profile, :class_name => 'Ish::UserProfile', :inverse_of => :profile_photo, :optional => true
16
-
17
- belongs_to :report, :optional => true
18
- belongs_to :gallery, :optional => true
19
- belongs_to :newsitem, :optional => true
11
+ belongs_to :user_profile, :optional => true, :class_name => 'Ish::UserProfile'
12
+ belongs_to :user_profile, :optional => true, :class_name => 'Ish::UserProfile', :inverse_of => :profile_photo
13
+ belongs_to :email_message, :optional => true, :class_name => 'Office::EmailMessage'
14
+ belongs_to :report, :optional => true
15
+ belongs_to :gallery, :optional => true
16
+ belongs_to :newsitem, :optional => true
20
17
 
21
18
  # photo.photo.to_s.split('/').last.split('?').first
22
19
  field :name, :type => String
@@ -52,6 +49,7 @@ class Photo
52
49
  :s3_protocol => 'https',
53
50
  :validate_media_type => false,
54
51
  s3_region: ::S3_CREDENTIALS[:region]
52
+ validates_attachment_content_type :photo, :content_type => ["image/webp", "image/jpg", "image/jpeg", "image/png", "image/gif", 'application/octet-stream' ]
55
53
 
56
54
  def self.n_per_manager_gallery
57
55
  25
@@ -66,7 +64,23 @@ class Photo
66
64
  |
67
65
  end
68
66
 
69
- validates_attachment_content_type :photo, :content_type => ["image/webp", "image/jpg", "image/jpeg", "image/png", "image/gif", 'application/octet-stream' ]
67
+ ## From: https://gist.github.com/WizardOfOgz/1012107?permalink_comment_id=1442486
68
+ attr_accessor :content_type, :image_data, :original_filename
69
+ def decode_base64_image
70
+ if image_data && content_type && original_filename
71
+ decoded_data = Base64.decode64(image_data)
72
+
73
+ data = StringIO.new(decoded_data)
74
+ data.class_eval do
75
+ attr_accessor :content_type, :original_filename
76
+ end
77
+
78
+ data.content_type = content_type
79
+ data.original_filename = File.basename(original_filename)
80
+
81
+ self.photo = data
82
+ end
83
+ end
70
84
 
71
85
  end
72
86
 
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.240
4
+ version: 0.0.33.242
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox