ish_models 0.0.33.230 → 0.0.33.231
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/photo.rb +1 -2
 - data/lib/report.rb +5 -22
 - 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: f7a90237b3ffeec198b9d6732898d879fbc4b1958f66caa722bdb4902222f408
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 72ee5abe32d9966fb5a82d5bfc3c147a0ca20e5892a8c412eee838c1e8aefaf1
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 6ecc759ec798a3e34e7d422b601059012cf9291418fe049925fb86c9bd23cf2e1362f4278853173361608aacc54f201c41270ae4516988e81f0791de35a7b140
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: f0b6519444a7eca6208dd5d31bdb266737a3223a7f57ba3643318d3285e02b074bd1334c08e076469df03f13c821ae9b40c1885602be51819650c15a79422b71
         
     | 
    
        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 }) } 
     | 
| 
      
 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 } 
     | 
| 
      
 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 ] }
         
     |