ish_models 0.0.33.230 → 0.0.33.232

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: 9b6e8cdb5d6318f3571949e0b6bd148bf3bfba895c0f7c53f2744caf060876e0
4
- data.tar.gz: 4c8ff28513a7c4deb978a39ac728729b6b5a10a43ea2e7e13553905655bdf423
3
+ metadata.gz: 7779f5792082964493be63e188d2d488abfed178cdecb64b1f0e288643b6af60
4
+ data.tar.gz: 47b175252e94a3b59c947ebd09b363fc62178f37f29a837a3ed75d95a6233943
5
5
  SHA512:
6
- metadata.gz: 2f6c720885cd4e0b322ee54862fefba63a9d7af7e993c455dd942ec0b1f8aabfcbd9599362e5887bb0e325fd18cfad0c47f193ee7db8f31f7a5f1dae98ba6afd
7
- data.tar.gz: 3e906a2d06e5b4ba91f7cf194cec788c8161d36930bab21fc516a6a47a100e142011ab6609f2fefbd1d17ffdfaa388845793e28ebee3b88e67af8131dd096e1b
6
+ metadata.gz: 5dc4593e03760dea3a5ba96805ba7143c4c7fe6881a59b7e5498ebb1e1e3d00ddf09e6111d2103f703902bd38f7466710b1e24c8dbf7922cd5ff8c31c73332aa
7
+ data.tar.gz: 0c289c198d33ac678dfdc2ea3b5a4ec1d9fefb2f79ac69d123a02577b4c9d6bce4221578b097714e5d3ffb4981d6f5a3f1e503e6acae13b06d54bcb827589093
@@ -7,30 +7,27 @@
7
7
  class Ish::EmailCampaign
8
8
  include Mongoid::Document
9
9
  include Mongoid::Timestamps
10
+ store_in collection: 'ish_email_campaigns'
10
11
 
11
- field :title
12
- def slug
13
- title
14
- end
12
+ field :slug
13
+ validates_uniqueness_of :slug, allow_nil: true
15
14
 
16
15
  PAGE_PARAM_NAME = 'email_contexts_page'
17
16
 
18
- FROM_EMAILS = %w| hello@infiniteshelter.com no-reply@infiniteshelter.com
19
- piousbox@gmail.com hello@piousbox.com no-reply@piousbox.com victor@piousbox.com
20
- admin@wasya.co hello@wasya.co no-reply@wasya.co victor@wasya.co |
17
+ FROM_EMAILS = %w| hello@infiniteshelter.com no-reply@infiniteshelter.com
18
+ piousbox@gmail.com hello@piousbox.com no-reply@piousbox.com victor@piousbox.com
19
+ admin@wasya.co hello@wasya.co no-reply@wasya.co victor@wasya.co |
21
20
  field :from_email
22
21
  validates_presence_of :from_email
23
22
  def self.from_email_list
24
23
  [ [nil, nil] ] + FROM_EMAILS.map { |i| [i, i] }
25
24
  end
26
25
 
27
- field :subject
28
- validates_presence_of :subject
26
+ belongs_to :email_template
27
+ def tmpl; email_template; end
29
28
 
29
+ field :subject
30
30
  field :body
31
- # validates_presence_of :body
32
-
33
- belongs_to :email_template
34
31
 
35
32
  field :sent_at, type: DateTime
36
33
  field :send_at, type: DateTime
@@ -43,6 +43,8 @@ class ::Ish::EmailContext
43
43
  belongs_to :scheduled_email_action, class_name: '::Office::ScheduledEmailAction', optional: true
44
44
  def sch; scheduled_email_action; end
45
45
 
46
+ belongs_to :email_campaign, class_name: 'Ish::EmailCampaign', optional: true
47
+
46
48
  field :rendered_str
47
49
 
48
50
  field :sent_at, type: DateTime
data/lib/photo.rb CHANGED
@@ -15,7 +15,6 @@ class Photo
15
15
  belongs_to :user_profile, :class_name => 'Ish::UserProfile', :inverse_of => :profile_photo, :optional => true
16
16
 
17
17
  belongs_to :report, :optional => true
18
- belongs_to :feature, :optional => true
19
18
  belongs_to :gallery, :optional => true
20
19
  belongs_to :newsitem, :optional => true
21
20
 
@@ -36,7 +35,7 @@ class Photo
36
35
 
37
36
  field :is_public, :type => Boolean, :default => true
38
37
  field :is_trash, :type => Boolean, :default => false # @TODO: nuke this boolean _vp_ 20170515
39
- default_scope ->{ where({ :is_trash => false }) } # @TODO: nuke default scopes
38
+ default_scope ->{ where({ :is_trash => false }) }
40
39
 
41
40
  has_mongoid_attached_file :photo,
42
41
  :styles => {
data/lib/report.rb CHANGED
@@ -6,7 +6,6 @@ class Report
6
6
 
7
7
  field :name, :type => String
8
8
  validates :name, :presence => true
9
- # index({ :name => 1 }, { :unique => true })
10
9
  index({ :name => 1, :is_trash => 1 })
11
10
 
12
11
  field :slug
@@ -14,6 +13,8 @@ class Report
14
13
  index({ :slug => 1 }, { :unique => true })
15
14
  before_validation :set_slug, :on => :create
16
15
 
16
+ field :subhead
17
+
17
18
  ## Can be one of: default (nil), longscroll,
18
19
  ## wordpress e.g. https://piousbox.com/wp-json/wp/v2/posts?slug=intro
19
20
  # ITEM_TYPES = %w| longscroll wordpress |
@@ -23,41 +24,23 @@ class Report
23
24
  field :raw_json
24
25
 
25
26
  field :is_trash, :type => Boolean, :default => false
26
- index({ :is_trash => 1, :is_public => 1 }, { name: 'default_index' })
27
+ index({ :is_trash => 1, :is_public => 1 })
27
28
 
28
29
  field :is_public, :type => Boolean, :default => true
29
30
  index({ :is_public => 1 })
30
31
  scope :public, ->{ where({ is_public: true }) }
31
32
 
32
- field :is_feature, :type => Boolean, :default => false
33
- index({ :is_feature => 1 })
34
-
35
- field :is_done, :type => Boolean, :default => true
36
- index({ :is_done => 1 })
37
-
38
33
  field :x, :type => Float
39
34
  field :y, :type => Float
40
-
41
- field :lang, :type => String, :default => 'en'
42
- index({ :lang => 1 })
35
+ field :z, :type => Float
43
36
 
44
37
  belongs_to :user_profile, :optional => true, :class_name => 'Ish::UserProfile'
45
38
 
46
- # validates :user, :presence => true, :allow_nil => false
47
- field :username, :type => String, :default => 'anonymous'
48
- validates :username, :presence => true, :allow_nil => false
49
- index({ :username => 1 })
50
-
51
- field :issue
52
- field :subhead
53
-
54
39
  has_one :photo
55
40
 
56
- field :n_upvotes, :default => 0
57
- field :n_spamvotes, :default => 0
58
-
59
41
  has_many :newsitems
60
42
 
43
+ ## @TODO: trash, remove
61
44
  def self.list conditions = { :is_trash => false }
62
45
  out = self.where( conditions ).order_by( :name => :asc ).limit( 100 )
63
46
  [['', nil]] + out.map { |item| [ item.name, item.id ] }
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.230
4
+ version: 0.0.33.232
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox