@@ -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,16 +57,19 @@ 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
0 commit comments