ish_models 0.0.33.136 → 0.0.33.137

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 172ea3b5881a62b2d1c4ef8bed4360782c6f9676eaa39c1be7e9febab7e8937b
4
- data.tar.gz: ba242d1b5cc551a2257a0c2183413f1a9cebd5448cc570629761cb69e9e99863
3
+ metadata.gz: b90fe8d9b148631d369ef4f8d6ef435b983784a0fb520654544f2b51bf52cdb2
4
+ data.tar.gz: b3f626ccae620eebf147f8edeff38ee84074fd672c37bd030a9712cca5aea437
5
5
  SHA512:
6
- metadata.gz: c849a3a2b774e4290e10e28b83561f11d85eb0ed316acc2118ad8ff6188d2d7c902b7bab1e0e192f4010a6ab9f1bafafec3ecaaecf47029084c9fcce43da2c34
7
- data.tar.gz: 5c8641248d523733c55643e8fe3ee95c4aa75cd4b7257684b60d4d48735e1a68187015abd7dbbda3558964f6c97c090a12fba4de3deab8081e952501bcec3e1d
6
+ metadata.gz: d2163cae83c7270a83106f36730e52518a4cf7fa384f67f5fde60b1fd5f90b4c781a506cac1050fcbec1cd399ccb9e909dac700d2235bd3b0714dd3016543456
7
+ data.tar.gz: 1584fb6192513d6531f479b6eafbc1c4695d213ca66f9d8c1de0e4ea10e3c050e6e4ecc74667157e61564c0b346e31d264d38ee5eb9a8b9e192a72d28ba7e6ca
data/lib/gallery.rb CHANGED
@@ -3,9 +3,13 @@ require 'kaminari/mongoid'
3
3
  class Gallery
4
4
  include ::Mongoid::Document
5
5
  include ::Mongoid::Timestamps
6
+ include Ish::Utils
6
7
 
7
8
  PER_PAGE = 6
8
9
 
10
+ field :name
11
+ validates :name, :uniqueness => true # , :allow_nil => false
12
+
9
13
  field :is_public, type: Boolean, default: false
10
14
  field :is_trash, type: Boolean, default: false
11
15
  field :is_done, type: Boolean, default: false
@@ -19,51 +23,46 @@ class Gallery
19
23
 
20
24
  default_scope ->{ where({ :is_public => true, :is_trash => false }).order_by({ :created_at => :desc }) }
21
25
 
22
- field :x, :type => Float
23
- field :y, :type => Float
26
+ field :x, :type => Float
27
+ field :y, :type => Float
28
+ field :subhead, :type => String
29
+ field :descr, :type => String, :as => :description
30
+ field :lang, :type => String, :default => 'en'
31
+ field :issue
32
+ field :username
33
+
34
+ ## @TODO: this is still not autogenerated
35
+ field :slug
36
+ index({ :slug => -1 }, { :unique => true })
37
+ validates :slug, presence: true, uniqueness: true
38
+
39
+ ## @TODO: I should have a redirect service, instead of this specific thing. But only after making $50.
40
+ # embeds_many :gallery_names, :class_name => '::Ish::GalleryName'
41
+
24
42
 
25
43
  def self.list conditions = { :is_trash => false }
26
44
  out = self.unscoped.where( conditions ).order_by( :created_at => :desc )
27
45
  [['', nil]] + out.map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
28
46
  end
29
47
 
30
- belongs_to :site, :optional => true
31
- # validates :site, :presence => true
32
-
48
+ belongs_to :site, :optional => true
33
49
  belongs_to :user_profile, :optional => true, :class_name => 'IshModels::UserProfile', :inverse_of => :galleries
34
- field :username, :type => String
35
- has_and_belongs_to_many :shared_profiles, :class_name => 'IshModels::UserProfile', :inverse_of => :shared_galleries
36
-
37
- field :name
38
- validates :name, :uniqueness => true # , :allow_nil => false
39
50
 
40
- field :galleryname
41
- index({ :galleryname => -1 }, { :unique => true })
42
- def slug
43
- galleryname
44
- end
45
- embeds_many :gallery_names, :class_name => '::Ish::GalleryName'
46
- def self.find_by_slug slug
47
- ::Gallery.where( galleryname: slug ).first
48
- end
49
-
50
- field :subhead, :type => String
51
- field :descr, :type => String, :as => :description
52
- field :lang, :type => String, :default => 'en'
51
+ has_and_belongs_to_many :shared_profiles, :class_name => 'IshModels::UserProfile', :inverse_of => :shared_galleries
52
+ has_and_belongs_to_many :tags
53
53
 
54
+ has_many :newsitems
54
55
  has_many :photos
55
56
 
56
- has_and_belongs_to_many :tags
57
57
  belongs_to :city, :optional => true
58
58
  belongs_to :venue, :optional => true
59
+ belongs_to :newsparent, polymorphic: true, optional: true
59
60
 
60
- has_many :newsitems
61
61
 
62
62
  set_callback(:create, :before) do |doc|
63
63
  if doc.user_profile && doc.user_profile.name
64
64
  doc.username = doc.user_profile.name
65
65
  end
66
- doc.galleryname ||= doc.id.to_s
67
66
 
68
67
  #
69
68
  # newsitems
@@ -107,16 +106,13 @@ class Gallery
107
106
 
108
107
  # @deprecated, use Gallery::ACTIONS
109
108
  def self.actions
110
- [ 'show_mini', 'show_long', 'show' ]
109
+ ACTIONS
111
110
  end
112
111
  ACTIONS = [ 'show_mini', 'show_long', 'show' ]
113
112
 
114
- field :issue
115
-
116
113
  RENDER_TITLES = 'index_titles' # view name
117
114
  RENDER_THUMBS = 'index_thumbs' # view name
118
115
 
119
- belongs_to :newsparent, polymorphic: true, optional: true
120
116
 
121
117
  set_callback :update, :after do |doc|
122
118
  Site.update_all updated_at: Time.now
data/lib/gameui/marker.rb CHANGED
@@ -6,7 +6,8 @@ class ::Gameui::Marker
6
6
  belongs_to :map, :class_name => '::Gameui::Map'
7
7
 
8
8
  field :slug
9
- validates :slug, uniqueness: true, presence: true
9
+ validates_uniqueness_of :slug, scope: :map_id
10
+ validates_presence_of :slug
10
11
 
11
12
  field :description
12
13
 
@@ -16,11 +16,13 @@ class IshModels::UserProfile
16
16
  field :fb_long_access_token
17
17
  field :fb_expires_in
18
18
 
19
- field :lang, :type => String, :default => :en
19
+ field :lang, default: 'en'
20
20
 
21
21
  ROLES = [ :admin, :manager, :guy ]
22
22
  field :role_name, :type => Symbol
23
23
 
24
+ has_one :profile_photo, :class_name => 'Photo', :inverse_of => :profile_city
25
+
24
26
  belongs_to :user
25
27
  belongs_to :current_city, :class_name => 'City', :inverse_of => :current_users, :optional => true
26
28
  belongs_to :guide_city, :class_name => 'City', :inverse_of => :guide, :optional => true
@@ -90,16 +92,3 @@ class IshModels::UserProfile
90
92
  end
91
93
 
92
94
  Profile = IshModels::UserProfile
93
-
94
- =begin
95
- field :about, :type => String
96
- field :education, :type => String
97
- field :objectives, :type => String
98
- field :current_employment, :type => String
99
- field :past_employment, :type => String
100
- field :pdf_resume_path, :type => String
101
- field :doc_resume_path, :type => String
102
-
103
- TAGS = [ :social, :professional ]
104
- field :tag, :type => Symbol
105
- =end
data/lib/photo.rb CHANGED
@@ -5,17 +5,16 @@ class Photo
5
5
  include Mongoid::Timestamps
6
6
  include Mongoid::Paperclip
7
7
 
8
- # belongs_to :user, :inverse_of => :photos
9
- # validates :user, :presence => true
10
- # field :username, :type => String
11
-
12
8
  has_and_belongs_to_many :viewers, :class_name => 'User', :inverse_of => :viewable_photos
13
9
 
14
10
  belongs_to :user_profile, :class_name => 'IshModels::UserProfile', :optional => true
15
- def user; user_profile; end
16
- belongs_to :profile_city, :class_name => 'City', :inverse_of => :profile_photo, :optional => true
17
- belongs_to :profile_venue, :class_name => 'Venue', :inverse_of => :profile_photo, :optional => true
18
- belongs_to :profile_event, :class_name => 'Event', :inverse_of => :profile_photo, :optional => true
11
+ def user
12
+ user_profile
13
+ end
14
+ belongs_to :profile_city, :class_name => 'City', :inverse_of => :profile_photo, :optional => true
15
+ belongs_to :user_profile, :class_name => 'IshModels::UserProfile', :inverse_of => :profile_photo, :optional => true
16
+ belongs_to :profile_venue, :class_name => 'Venue', :inverse_of => :profile_photo, :optional => true
17
+ belongs_to :profile_event, :class_name => 'Event', :inverse_of => :profile_photo, :optional => true
19
18
 
20
19
  belongs_to :report, :optional => true
21
20
  belongs_to :venue, :optional => true
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.136
4
+ version: 0.0.33.137
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox