@@ -6,6 +6,7 @@ class OpportunitiesController < ApplicationController
6
6
before_action :verify_payment , only : [ :new , :create ]
7
7
before_action :stringify_location , only : [ :create , :update ]
8
8
9
+ # POST /teams/:team_id/opportunities/:id/apply(.:format)
9
10
def apply
10
11
redirect_to_signup_if_unauthenticated ( request . referer , "You must login/signup to apply for an opportunity" ) do
11
12
job = Opportunity . find ( params [ :id ] )
@@ -20,14 +21,17 @@ def apply
20
21
end
21
22
end
22
23
24
+ # GET /teams/:team_id/opportunities/new(.:format)
23
25
def new
24
26
team_id = params [ :team_id ]
25
27
@job = Opportunity . new ( team_id : team_id )
26
28
end
27
29
30
+ # GET /teams/:team_id/opportunities/:id/edit(.:format)
28
31
def edit
29
32
end
30
33
34
+ # POST /teams/:team_id/opportunities(.:format)
31
35
def create
32
36
opportunity_create_params = params . require ( :opportunity ) . permit ( :name , :team_id , :opportunity_type , :description , :tag_list , :location , :link , :salary , :apply , :remote )
33
37
@job = Opportunity . new ( opportunity_create_params )
@@ -41,6 +45,7 @@ def create
41
45
end
42
46
end
43
47
48
+ # PUT /teams/:team_id/opportunities/:id(.:format)
44
49
def update
45
50
opportunity_update_params = params . require ( :opportunity ) . permit ( :id , :name , :team_id , :opportunity_type , :description , :tag_list , :location , :link , :salary , :apply )
46
51
respond_to do |format |
@@ -52,30 +57,33 @@ def update
52
57
end
53
58
end
54
59
60
+ # GET /teams/:team_id/opportunities/:id/activate(.:format)
55
61
def activate
56
62
@job . activate!
57
63
header_ok
58
64
end
59
65
66
+ # GET /teams/:team_id/opportunities/:id/deactivate(.:format)
60
67
def deactivate
61
68
@job . deactivate!
62
69
header_ok
63
70
end
64
71
72
+ # POST /teams/:team_id/opportunities/:id/visit(.:format)
65
73
def visit
66
74
unless is_admin?
67
75
viewing_user . track_opportunity_view! ( @job ) if viewing_user
68
76
@job . viewed_by ( viewing_user || session_id )
69
77
end
70
78
header_ok
71
79
end
72
-
80
+
81
+ # GET /jobs(/:location(/:skill))(.:format)
73
82
def index
74
83
current_user . seen ( :jobs ) if signed_in?
75
84
store_location! unless signed_in?
76
85
chosen_location = ( params [ :location ] || closest_to_user ( current_user ) ) . try ( :titleize )
77
86
chosen_location = nil if chosen_location == 'Worldwide'
78
-
79
87
@remote_allowed = params [ :remote ] == 'true'
80
88
81
89
@page = params [ :page ] . try ( :to_i ) || 1
@@ -94,13 +102,14 @@ def index
94
102
@lat , @lng = geocode_location ( chosen_location )
95
103
96
104
respond_to do |format |
97
- format . html { render layout : 'jobs ' }
105
+ format . html { render layout : 'coderwallv2 ' }
98
106
format . json { render json : @jobs . map ( &:to_public_hash ) }
99
107
format . js
100
108
end
101
109
102
110
end
103
111
112
+ # GET /jobs-map(.:format)
104
113
def map
105
114
@job_locations = all_job_locations
106
115
@job_skills = all_job_skills
0 commit comments