ish_models 0.0.33.181 → 0.0.33.183

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: 35c779eec7fc64840dfadc7ca7d585f6c4a583295e85c278580b53c3c0c0775a
4
- data.tar.gz: 86dc21c7dca66c81652521a0d4ff86ab110bdbe819351835763f2bd40cdc320c
3
+ metadata.gz: 85f8fca5beb0c5b47064b21cc701211337dc0958413042fe7a0d06760bf37b6d
4
+ data.tar.gz: 401e647a0822369046967e7a89f1f5e8171a39788c13c599641855497b955532
5
5
  SHA512:
6
- metadata.gz: be8bc0b1e9e652f25308acb2c6c90ab0703e310bab8e51ad2f86404897444c6502d2910d1a5eae7862e5c6147a6716af1987f53cffcb0736b8f2974e9dde10db
7
- data.tar.gz: a1bd576a1ef3d754f3216c0c6de25199872171783932ee8ad1628475dc1688f28c236ef86c078227ca7040ae42141622f028f1aecb8317726274b1c4d9370a91
6
+ metadata.gz: 64946732013186fc3677c73c907a089165534e57b3fbaa064ecd6a4194acf8d9e263b4fd5736f4aab5e726105f76fa960cf396487bf75bf88dce5dec6708acb4
7
+ data.tar.gz: 299a36f616f7e436f650071604ae9fdc7ae20e23269579b9cb06904be845bfc8516b849022091dfed625bf7eb657f04cb086ca4ff63b92168d27bfcc33632fbe
@@ -9,6 +9,13 @@ class Ish::EmailContext
9
9
 
10
10
  PAGE_PARAM_NAME = 'email_contexts_page'
11
11
 
12
+ FROM_EMAILS = %w| piousbox@gmail.com victor@piousbox.com victor@wasya.co no-reply@piousbox.com |
13
+ field :from_email
14
+ validates_presence_of :from_email
15
+ def self.from_email_list
16
+ [ [nil, nil] ] + FROM_EMAILS.map { |i| [i, i] }
17
+ end
18
+
12
19
  field :to_email
13
20
  validates_presence_of :to_email
14
21
 
@@ -16,7 +23,7 @@ class Ish::EmailContext
16
23
  validates_presence_of :subject
17
24
 
18
25
  field :body
19
- validates_presence_of :body
26
+ # validates_presence_of :body ## With plain type, there is no body but there are variables for templating.
20
27
 
21
28
  belongs_to :email_template
22
29
 
@@ -24,5 +31,10 @@ class Ish::EmailContext
24
31
 
25
32
  field :sent_at, type: DateTime
26
33
 
34
+ #
35
+ # For templating:
36
+ #
37
+ field :name
38
+
27
39
  end
28
40
  EmailContext = Ish::EmailContext
@@ -9,5 +9,15 @@ class ::Ish::EmailTemplate
9
9
 
10
10
  field :version, default: '0.0.0'
11
11
 
12
+ TYPES = %w| partial plain |
13
+ field :type
14
+ def self.type_list
15
+ [ [nil,nil] ] + TYPES.map { |i| [i, i] }
16
+ end
17
+
18
+ field :subject
19
+ field :body
20
+ field :from_email
21
+
12
22
  end
13
23
  EmailTemplate = ::Ish::EmailTemplate
data/lib/video.rb CHANGED
@@ -29,14 +29,15 @@ class Video
29
29
  field :is_public, :type => Boolean, :default => false
30
30
  field :is_feature, :type => Boolean, :default => false
31
31
 
32
- field :x, :type => Float
33
- field :y, :type => Float
32
+ field :x, type: Float
33
+ field :y, type: Float
34
+ field :z, type: Float
34
35
 
35
36
  field :lang, :type => String, :default => 'en'
36
37
 
37
- field :youtube_id, :type => String
38
- validates :youtube_id, :uniqueness => true, allow_nil: true
39
-
38
+ field :youtube_id
39
+ validates_uniqueness_of :youtube_id, allow_blank: true, case_sensitive: false
40
+ before_save { youtube_id.present? || youtube_id = nil }
40
41
 
41
42
  belongs_to :user_profile, :optional => true, :class_name => 'Ish::UserProfile', :inverse_of => :videos
42
43
 
@@ -44,12 +45,6 @@ class Video
44
45
  [['', nil]] + Video.unscoped.order_by( :created_at => :desc ).map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
45
46
  end
46
47
 
47
- set_callback( :create, :before ) do |doc|
48
- if doc.is_public
49
- doc.city.add_newsitem( doc ) unless doc.city.blank?
50
- doc.site.add_newsitem( doc ) unless doc.site.blank?
51
- end
52
- end
53
48
 
54
49
  field :issue
55
50
  field :subhead
@@ -84,10 +79,6 @@ class Video
84
79
  s3_region: ::S3_CREDENTIALS[:region]
85
80
  validates_attachment_content_type :thumb, :content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif", 'application/octet-stream' ]
86
81
 
87
- set_callback :update, :after do |doc|
88
- Site.update_all updated_at: Time.now
89
- end
90
-
91
82
  ## copy-paste
92
83
  field :premium_tier, type: Integer, default: 0 # how many stars need to spend, to get access? 0 = free
93
84
  def is_premium
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.181
4
+ version: 0.0.33.183
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox