ish_models 0.0.32 → 0.0.33

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
  SHA1:
3
- metadata.gz: 2969237ff16d6f14db37047fb60204f1d4c0ecc2
4
- data.tar.gz: 8c4d6a25f815a676736d0e1c1d6572cec7640bd2
3
+ metadata.gz: b88f19a07f74c4ebd1304b99a73c27928d4607b2
4
+ data.tar.gz: 4d4c0b4cf6324a53aea82a224bd18b8ae4080463
5
5
  SHA512:
6
- metadata.gz: 9f855acb9639155a8a0e1edd7eeece6f943449cefcabe496865754e93ce478ae4716b5fced45cdf0ed85ab73f5322c57d3b5822348d116a8946c8249b6030f0a
7
- data.tar.gz: 5f8889ff575b4433f3d34e795253d191192110bb30277af1b0cb2a6bfe7fd8872da5d7231049dc649b29fd2f2249589ea0824cf9f6664d0927ba285279d68597
6
+ metadata.gz: 1e5d10953f7271af06325ee754e77bcf9e1a4bbdda20bf780ff8507a5b03d1217737a13b3b314aeba471bdbacb4db9e6965818edfdc34f23b81171935bdf2e37
7
+ data.tar.gz: 569f5060aef50776fdf18cabf9614dc061aecc6045aeffbcf4a3ffdc22b765b4312093fe0e4fb3d395a15a0e1c11b66669053d5705bd8c853efc3e9422bf9efd
@@ -28,12 +28,13 @@ require 'country.rb'
28
28
  require 'event.rb'
29
29
  require 'feature.rb'
30
30
  require 'gallery.rb'
31
+ require 'manager.rb'
31
32
  require 'newsitem.rb'
32
33
  require 'photo.rb'
33
34
  require 'public_item.rb'
34
35
  require 'report.rb'
35
36
  require 'site.rb'
36
37
  require 'tag.rb'
37
- # require 'user.rb'
38
+ require 'user_profile.rb'
38
39
  require 'venue.rb'
39
40
  require 'video.rb'
@@ -0,0 +1,7 @@
1
+
2
+ #
3
+ # I need this thing for permissions
4
+ #
5
+ class Manager
6
+ end
7
+
@@ -5,21 +5,20 @@ 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
8
+ # belongs_to :user, :inverse_of => :photos
9
+ # validates :user, :presence => true
10
+ # field :username, :type => String
11
11
 
12
12
  has_and_belongs_to_many :viewers, :class_name => 'User', :inverse_of => :viewable_photos
13
13
 
14
- belongs_to :profile_user, :class_name => 'User', :inverse_of => :profile_photo
15
- belongs_to :profile_city, :class_name => 'City', :inverse_of => :profile_photo
16
- belongs_to :profile_venue, :class_name => 'Venue', :inverse_of => :profile_photo
14
+ # belongs_to :profile_user, :class_name => 'User', :inverse_of => :profile_photo
15
+ belongs_to :profile_city, :class_name => 'City', :inverse_of => :profile_photo, :optional => true
16
+ belongs_to :profile_venue, :class_name => 'Venue', :inverse_of => :profile_photo, :optional => true
17
17
 
18
- belongs_to :report
19
- belongs_to :tag
20
- belongs_to :venue
21
- belongs_to :feature
22
- belongs_to :gallery
18
+ belongs_to :report, :optional => true
19
+ belongs_to :venue, :optional => true
20
+ belongs_to :feature, :optional => true
21
+ belongs_to :gallery, :optional => true
23
22
 
24
23
  field :name, :type => String
25
24
  field :descr, :type => String
@@ -31,8 +30,6 @@ class Photo
31
30
  field :is_trash, :type => Boolean, :default => false
32
31
  default_scope ->{ where({ :is_trash => false }) }
33
32
 
34
- # File.open('/tmp/this', 'a') { |f| f.puts "#{Time.now} - inside photo.rb" }
35
-
36
33
  has_mongoid_attached_file :photo,
37
34
  :styles => {
38
35
  :mini => '20x20#',
@@ -0,0 +1,22 @@
1
+ class UserProfile
2
+ include Mongoid::Document
3
+ include Mongoid::Timestamps
4
+
5
+ field :about, :type => String
6
+ field :education, :type => String
7
+ field :objectives, :type => String
8
+ field :current_employment, :type => String
9
+ field :past_employment, :type => String
10
+
11
+ field :pdf_resume_path, :type => String
12
+ field :doc_resume_path, :type => String
13
+
14
+ field :lang, :type => String
15
+
16
+ belongs_to :user
17
+
18
+ def manager?
19
+ %w( piousbox@gmail.com manager@gmail.com ).include?( self.user.email ) ? true : false
20
+ end
21
+
22
+ end
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.32
4
+ version: 0.0.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
@@ -72,13 +72,14 @@ files:
72
72
  - lib/ish_models/railtie.rb~
73
73
  - lib/ish_models/user.rb
74
74
  - lib/ish_models/user.rb~
75
+ - lib/manager.rb
75
76
  - lib/newsitem.rb
76
77
  - lib/photo.rb
77
78
  - lib/public_item.rb
78
79
  - lib/report.rb
79
80
  - lib/site.rb
80
81
  - lib/tag.rb
81
- - lib/user.rb
82
+ - lib/user_profile.rb
82
83
  - lib/venue.rb
83
84
  - lib/video.rb
84
85
  homepage: http://wasya.co
@@ -1,122 +0,0 @@
1
-
2
- class User
3
- include Mongoid::Document
4
- include Mongoid::Timestamps
5
-
6
- # Setup accessible (or protected) attributes for your model
7
- # attr_accessible :email, :password, :password_confirmation, :remember_me
8
-
9
- ## Database authenticatable
10
- field :email, type: String, default: ""
11
- validates :email, :presence => true, :uniqueness => true
12
-
13
- field :encrypted_password, type: String, default: ""
14
-
15
- ## Recoverable
16
- field :reset_password_token, type: String
17
- field :reset_password_sent_at, type: Time
18
-
19
- ## Rememberable
20
- field :remember_created_at, type: Time
21
-
22
- ## Trackable
23
- field :sign_in_count, type: Integer, default: 0
24
- field :current_sign_in_at, type: Time
25
- field :last_sign_in_at, type: Time
26
- field :current_sign_in_ip, type: String
27
- field :last_sign_in_ip, type: String
28
-
29
- ## Confirmable
30
- # field :confirmation_token, type: String
31
- # field :confirmed_at, type: Time
32
- # field :confirmation_sent_at, type: Time
33
- # field :unconfirmed_email, type: String # Only if using reconfirmable
34
-
35
- ## Lockable
36
- # field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
37
- # field :unlock_token, type: String # Only if unlock strategy is :email or :both
38
- # field :locked_at, type: Time
39
-
40
- # :recoverable, :trackable :rememberable,
41
- # :token_authenticatable,
42
- # :lockable, :timeoutable, :confirmable
43
- devise :registerable, :validatable
44
- devise :database_authenticatable, :authentication_keys => [ :email ]
45
- # devise :omniauthable, :omniauth_providers => [ :facebook ]
46
- # devise :encryptable, :encryptor => :sha1base64
47
- #
48
- #
49
- # field :confirmed_at, :type => DateTime
50
- # field :confirmation_token, :type => String
51
- # field :confirmation_sent_at, :type => DateTime
52
-
53
- field :username, :type => String
54
- validates :username, :presence => true, :uniqueness => true
55
-
56
- field :name, :type => String
57
- validates :name, :presence => true
58
-
59
- field :group_id, :type => Integer, :default => 3
60
-
61
- field :scratchpad, :type => String
62
- field :github_path, :type => String
63
- field :facebook_path, :type => String
64
- field :stackoverflow_path, :type => String
65
-
66
- field :is_feature, :type => Boolean, :default => false
67
- field :is_trash, :type => Boolean, :default => false
68
-
69
- field :display_ads, :type => Boolean, :default => true
70
- field :display_help, :type => Boolean, :default => true
71
-
72
- has_many :reports
73
- has_many :photos
74
- has_many :user_profiles
75
- has_many :galleries
76
- has_many :videos
77
-
78
- has_one :profile_photo, :class_name => 'Photo', :inverse_of => :profile_user
79
-
80
- has_and_belongs_to_many :viewable_photos, :class_name => 'Photo', :inverse_of => :viewer
81
-
82
- belongs_to :guide_city, :class_name => 'City', :inverse_of => :guide
83
- belongs_to :current_city, :class_name => 'City', :inverse_of => :city_users
84
-
85
- def self.list conditions = { :is_trash => false }
86
- out = self.where( conditions ).order_by( :name => :asc )
87
- [['', nil]] + out.map { |item| [ item.name, item.id ] }
88
- end
89
-
90
- embeds_many :newsitems
91
-
92
- def self.all
93
- self.where( :is_trash => false ).order_by( :created_at => :desc )
94
- end
95
-
96
- def create_newsitem args = {}
97
- unless args[:photo].blank?
98
- n = Newsitem.new
99
- n.photo = args[:photo]
100
- n.descr = 'uploaded new photo on'
101
- n.username = self.username
102
- self.newsitems << n
103
- self.save
104
- end
105
- end
106
-
107
- def self.per_page
108
- 16
109
- end
110
-
111
- def self.clear
112
- if Rails.env.test?
113
- User.unscoped.each { |u| u.remove }
114
- end
115
- end
116
-
117
- def generate_auth_token
118
- payload = { user_id: self.id }
119
- AuthToken.encode(payload)
120
- end
121
-
122
- end