ish_models 0.0.33.241 → 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: 272ee9358917dbef42235373fb57c5c795461ea3686b9af93109d038aa67108c
4
- data.tar.gz: 14b29f6d63f6954c5068811989e8753b952dbc6406b7b1d03b25e96cd36130f9
3
+ metadata.gz: 947ab34b57772b91d9fb1b1334c035debd3a0935f5fc1d06fccd102d49742ff0
4
+ data.tar.gz: c1c390a81049197dd06af734b0018f8697c21f9fec0d5b5c8f54d286ec2bdb38
5
5
  SHA512:
6
- metadata.gz: 29ff547eeffbf6efb6d1954726702907b2805bacf60f0b60e0a8b6560a78c1336ee51e051de39e70f8e351e1fb1e25224d923dcbed97f2ea4bcb75f4db7547c5
7
- data.tar.gz: 48fb17551e98e47216766dbfecc47b5c0d901dddbff16399889993a5a98819e1781e3b3cdd58c361acf871c707162a7b4c4c9a4323a1ebbea0cfd998bcf6aec4
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'
@@ -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.241
4
+ version: 0.0.33.242
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox