ish_models 0.0.33.241 → 0.0.33.243
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/address.rb +3 -1
- data/lib/gallery.rb +2 -0
- data/lib/gameui/map.rb +1 -0
- data/lib/ish/email_template.rb +1 -0
- data/lib/office/email_message.rb +10 -7
- data/lib/photo.rb +24 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cb9bfd0b2e4267bdafbdc6e0e07d9064dfcb7c5bcc4d767ccf14e12ee0f81fb
|
4
|
+
data.tar.gz: b17871e045a9983e191457ad8ec843c03ce4cb515b0846ba1c5b23457a0ade34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1c4d9279bc85b0c051a705e18bc0404a03880e04a69d0e73056e306f6aac13f789b8afebdb73dab6e3b5b8c6fd9fde0bf10dc4f33a5f9520784109500221ed6
|
7
|
+
data.tar.gz: 45207a395aab807bdaf12b33b277e4d342267fdd5eb7ae00672e231cc93153671fc42e68fb284300068976d3f0b557cec4dd8502918a95dec76bf540c849e198
|
data/lib/address.rb
CHANGED
data/lib/gallery.rb
CHANGED
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'
|
data/lib/ish/email_template.rb
CHANGED
data/lib/office/email_message.rb
CHANGED
@@ -23,18 +23,21 @@ class Office::EmailMessage
|
|
23
23
|
field :subject
|
24
24
|
field :part_txt
|
25
25
|
field :part_html
|
26
|
-
|
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,
|
33
|
-
field :froms,
|
34
|
-
field :to,
|
35
|
-
field :tos,
|
36
|
-
field :ccs,
|
37
|
-
field :bccs,
|
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'
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
belongs_to :
|
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
|
-
|
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
|
|