@@ -44,8 +44,22 @@ class Team < ActiveRecord::Base
44
44
has_many :members , class_name : 'Teams::Member' , foreign_key : 'team_id' , dependent : :delete_all
45
45
has_many :links , class_name : 'Teams::Link' , foreign_key : 'team_id' , dependent : :delete_all
46
46
has_many :locations , class_name : 'Teams::Location' , foreign_key : 'team_id' , dependent : :delete_all
47
+
48
+ def featured_links
49
+ links
50
+ end
51
+
47
52
has_many :jobs , class_name : 'Opportunity' , foreign_key : 'team_id' , dependent : :destroy
48
53
54
+ #def jobs
55
+ #all_jobs.valid
56
+ #end
57
+
58
+ #Replaced with jobs
59
+ def all_jobs
60
+ jobs . order ( 'created_at DESC' )
61
+ end
62
+
49
63
has_many :follows , class_name : 'FollowedTeam' , foreign_key : 'team_id' , dependent : :destroy
50
64
has_many :followers , through : :follows , source : :team
51
65
@@ -173,7 +187,7 @@ def locations
173
187
174
188
def locations_message
175
189
if premium?
176
- team_locations . collect ( &:name ) . join ( ', ' )
190
+ locations . collect ( &:name ) . join ( ', ' )
177
191
else
178
192
locations . join ( ', ' )
179
193
end
@@ -196,6 +210,11 @@ def on_team?(user)
196
210
has_member? ( user )
197
211
end
198
212
213
+ def has_member? ( user )
214
+ team_members . include? ( user )
215
+ end
216
+
217
+
199
218
def branding_hex_color
200
219
branding || DEFAULT_HEX_BRAND
201
220
end
@@ -330,7 +349,7 @@ def has_interview_steps?
330
349
end
331
350
332
351
def has_locations?
333
- !team_locations . blank?
352
+ !locations . blank?
334
353
end
335
354
336
355
def has_featured_links?
@@ -616,23 +635,23 @@ def self.most_active_countries
616
635
end
617
636
618
637
def primary_address
619
- team_locations . first . try ( :address ) || primary_address_name
638
+ locations . first . try ( :address ) || primary_address_name
620
639
end
621
640
622
641
def primary_address_name
623
- team_locations . first . try ( :name )
642
+ locations . first . try ( :name )
624
643
end
625
644
626
645
def primary_address_description
627
- team_locations . first . try ( :description )
646
+ locations . first . try ( :description )
628
647
end
629
648
630
649
def primary_points_of_interest
631
- team_locations . first . try ( :points_of_interest ) . to_a
650
+ locations . first . try ( :points_of_interest ) . to_a
632
651
end
633
652
634
653
def cities
635
- team_locations . map ( &:city ) . reject { |city | city . blank? }
654
+ locations . map ( &:city ) . reject { |city | city . blank? }
636
655
end
637
656
638
657
def generate_event
@@ -662,18 +681,10 @@ def active_job_titles
662
681
active_jobs . collect ( &:title ) . uniq
663
682
end
664
683
665
- def jobs
666
- all_jobs . valid
667
- end
668
-
669
- #Replaced with jobs
670
- def all_jobs
671
- jobs . order ( 'created_at DESC' )
672
- end
673
684
674
685
675
686
676
- SECTION_FIELDS = %w( about headline big_quote our_challenge benefit_description_1 organization_way office_photos stack_list reason_name_1 interview_steps team_locations blog_feed )
687
+ SECTION_FIELDS = %w( about headline big_quote our_challenge benefit_description_1 organization_way office_photos stack_list reason_name_1 interview_steps locations blog_feed )
677
688
678
689
679
690
def visitors_interested_in_jobs
0 commit comments