ish_models 0.0.33 → 0.0.33.5
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/gallery.rb +6 -4
- data/lib/user_profile.rb +12 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf36e9fb0e9249951d3567491b2d8c6d3c2aea0a
|
4
|
+
data.tar.gz: dab1ae7dbc298bb669d5cfd2e14a4b624ac59f6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0adefcb63ea03b69dfd96d303c76e6fa06a325cdafd55dd9313a69f859269e8818c314a939aac095f329b0c8e4944161c1587de15a7cd9591343886ba64eb74
|
7
|
+
data.tar.gz: c6dc54fa3100c2fa3bb0984f3d75edf8b8cfe4629061a7ea893563e8dab6919a0c36b09b68d9537d16219e93cfa4620f44243e2c4396eebe431017aea3f2f65e
|
data/lib/gallery.rb
CHANGED
@@ -3,8 +3,8 @@ class Gallery < AppModel2
|
|
3
3
|
belongs_to :site
|
4
4
|
validates :site, :presence => true
|
5
5
|
|
6
|
-
belongs_to :user,
|
7
|
-
|
6
|
+
belongs_to :user, :optional => true
|
7
|
+
belongs_to :user_profile, :optional => true, :class_name => 'IshModels::UserProfile'
|
8
8
|
field :username, :type => String
|
9
9
|
|
10
10
|
field :name, :type => String
|
@@ -29,8 +29,10 @@ class Gallery < AppModel2
|
|
29
29
|
has_many :newsitems
|
30
30
|
|
31
31
|
set_callback(:create, :before) do |doc|
|
32
|
-
doc.
|
33
|
-
|
32
|
+
if doc.user_profile && doc.user_profile.username
|
33
|
+
doc.username = doc.user_profile.username
|
34
|
+
end
|
35
|
+
doc.galleryname = doc.id.to_s
|
34
36
|
|
35
37
|
if doc.is_public
|
36
38
|
# for the sites
|
data/lib/user_profile.rb
CHANGED
@@ -2,6 +2,8 @@ class UserProfile
|
|
2
2
|
include Mongoid::Document
|
3
3
|
include Mongoid::Timestamps
|
4
4
|
|
5
|
+
field :username, :type => String
|
6
|
+
|
5
7
|
field :about, :type => String
|
6
8
|
field :education, :type => String
|
7
9
|
field :objectives, :type => String
|
@@ -12,11 +14,20 @@ class UserProfile
|
|
12
14
|
field :doc_resume_path, :type => String
|
13
15
|
|
14
16
|
field :lang, :type => String
|
15
|
-
|
17
|
+
|
16
18
|
belongs_to :user
|
19
|
+
|
20
|
+
has_many :galleries
|
17
21
|
|
18
22
|
def manager?
|
19
23
|
%w( piousbox@gmail.com manager@gmail.com ).include?( self.user.email ) ? true : false
|
20
24
|
end
|
21
25
|
|
26
|
+
# manager uses it.
|
27
|
+
# @TODO: check this, this is shit. _vp_ 20170527
|
28
|
+
def self.list
|
29
|
+
out = self.all.order_by( :domain => :asc, :lang => :asc )
|
30
|
+
[['', nil]] + out.map { |item| [ item.username, item.id ] }
|
31
|
+
end
|
32
|
+
|
22
33
|
end
|