ish_models 0.0.33.114 → 0.0.33.119

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: e49713b83fbd5bb64b86dc9e10c6ac33e511ddb182358a65170ed965dd4624d6
4
- data.tar.gz: 4e9794e42713365d9067531054ab8c948df7492a4c75f7f767a511e86be3d34e
3
+ metadata.gz: 29c1520c5fc6a0d4d621ed6240c77a00b9cf879e4f31b188383eeebdde7b0f24
4
+ data.tar.gz: 2f0c0b4b9f30333aa370b82634bb4f428583109386664e0ce09f7db24c04468f
5
5
  SHA512:
6
- metadata.gz: '06599160cc8c9d000931f86b8cc921dda3192dc61b57e52ff149dffe62f1ae7980115682209a0559e328f53289f18f86069897f124093245afdb39e363c35e6a'
7
- data.tar.gz: b907e1a5e0be37ce44c5c3f3b21103d9e113981aa9fc8e3b9e971e1b39c21b239d0bab4a0bf0e2d93f2bd32da82a2403368f6e204bcdfd5e7605b9db25cb2094
6
+ metadata.gz: 7d8516841d633e40b2e9158c073e19d5e13c547fab4d9b2b20e8402955958e82f853f99c8424779d27244eb3d83ac12a8835af31d1b3b5349bdb116fdc41b724
7
+ data.tar.gz: 9ed78769aa53818df64028f2fc52460a141e135a8d6dd61520bce73c366b71846d3f1fa4c70930c3d56762a76ed88780c76c70552a59a786e788d7f2450b69e1
data/lib/city.rb CHANGED
@@ -16,7 +16,7 @@ class City
16
16
 
17
17
  field :deleted_at, type: Time
18
18
  def self.all
19
- self.where( deleted_at: nil ).order_by( name: :desc )
19
+ self.where( deleted_at: nil, is_active: true ).order_by( name: :desc )
20
20
  end
21
21
 
22
22
  belongs_to :country, :optional => true
@@ -27,7 +27,7 @@ class City
27
27
  has_many :reports
28
28
  has_many :venues
29
29
  has_many :videos
30
- has_many :tags
30
+ has_and_belongs_to_many :tags
31
31
 
32
32
  has_many :current_users, :class_name => '::IshModels::UserProfile', :inverse_of => :current_city
33
33
  has_many :newsitems
@@ -39,6 +39,7 @@ class City
39
39
  embeds_many :features
40
40
 
41
41
  field :calendar_frame, :type => String
42
+ field :is_active, type: Boolean, default: true
42
43
 
43
44
  default_scope ->{ order_by({ :name => :asc }) }
44
45
 
data/lib/gallery.rb CHANGED
@@ -4,6 +4,8 @@ class Gallery
4
4
  include ::Mongoid::Document
5
5
  include ::Mongoid::Timestamps
6
6
 
7
+ PER_PAGE = 6
8
+
7
9
  field :is_public, type: Boolean, default: false
8
10
  field :is_trash, type: Boolean, default: false
9
11
 
@@ -47,7 +49,7 @@ class Gallery
47
49
 
48
50
  has_many :photos
49
51
 
50
- belongs_to :tag, :optional => true
52
+ has_and_belongs_to_many :tags
51
53
  belongs_to :city, :optional => true
52
54
  belongs_to :venue, :optional => true
53
55
 
data/lib/newsitem.rb CHANGED
@@ -31,6 +31,8 @@ class Newsitem
31
31
  field :downvoting_users, :type => Array, :default => []
32
32
  field :is_feature, :type => Boolean, :default => false
33
33
 
34
+ PER_PAGE = 6
35
+
34
36
  default_scope ->{ order_by({ :created_at => :desc }) }
35
37
 
36
38
  def self.from_params item
data/lib/tag.rb CHANGED
@@ -16,10 +16,6 @@ class Tag
16
16
 
17
17
  field :weight, :type => Integer, :default => 10
18
18
 
19
- has_and_belongs_to_many :reports
20
- has_many :galleries
21
- has_many :videos
22
-
23
19
  has_many :children_tags, :class_name => 'Tag', :inverse_of => :parent_tag
24
20
  belongs_to :parent_tag, :class_name => 'Tag', :inverse_of => :children_tags, :optional => true
25
21
 
@@ -31,6 +27,10 @@ class Tag
31
27
  belongs_to :city, :optional => true
32
28
 
33
29
  has_and_belongs_to_many :venues
30
+ has_and_belongs_to_many :cities
31
+ has_and_belongs_to_many :galleries
32
+ has_and_belongs_to_many :reports
33
+ has_and_belongs_to_many :videos
34
34
 
35
35
  default_scope ->{
36
36
  where({ :is_public => true, :is_trash => false }).order_by({ :name => :asc })
data/lib/venue.rb CHANGED
@@ -43,6 +43,8 @@ class Venue
43
43
  embeds_many :newsitems
44
44
  embeds_many :features
45
45
 
46
+ PER_PAGE = 6
47
+
46
48
  def self.list conditions = { :is_trash => false }
47
49
  out = self.where( conditions).order_by( :name => :asc )
48
50
  [['', nil]] + out.map { |item| [ item.name, item.id ] }
data/lib/video.rb CHANGED
@@ -22,14 +22,14 @@ class Video
22
22
  field :youtube_id, :type => String
23
23
  # validates :youtube_id, :uniqueness => true, :presence => true
24
24
 
25
- belongs_to :tag, :optional => true
25
+ has_and_belongs_to_many :tags
26
26
  belongs_to :city, :optional => true
27
27
  belongs_to :site, :optional => true
28
28
  has_many :newsitems
29
29
 
30
30
  belongs_to :user_profile, :optional => true, :class_name => 'IshModels::UserProfile', :inverse_of => :videos
31
31
 
32
- accepts_nested_attributes_for :site, :tag, :city
32
+ accepts_nested_attributes_for :site, :tags, :city
33
33
 
34
34
  def self.list
35
35
  [['', nil]] + Video.unscoped.order_by( :created_at => :desc ).map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{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.114
4
+ version: 0.0.33.119
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox