Class: VacanciesController
Instance Method Summary
collapse
included
#current_ability
#parent, #voluntary_application_javascripts, #voluntary_application_repository_path, #voluntary_application_stylesheets
included
Instance Method Details
#create ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'app/controllers/vacancies_controller.rb', line 26
def create
@vacancy = Vacancy.new(params[:vacancy])
if @vacancy.project.user_id == current_user.id
@vacancy.do_open
else
@vacancy.author_id = current_user.id
@vacancy.recommend
end
if @vacancy.save
redirect_to @vacancy, notice: t('general.form.successfully_created')
else
render :new
end
end
|
#destroy ⇒ Object
57
58
59
60
61
|
# File 'app/controllers/vacancies_controller.rb', line 57
def destroy
@vacancy = Vacancy.friendly.find(params[:id])
@vacancy.destroy
redirect_to vacancies_url, notice: t('general.form.destroyed')
end
|
#edit ⇒ Object
43
44
45
|
# File 'app/controllers/vacancies_controller.rb', line 43
def edit
@vacancy = Vacancy.friendly.find(params[:id])
end
|
#index ⇒ Object
12
13
14
|
# File 'app/controllers/vacancies_controller.rb', line 12
def index
@vacancies = @project ? @project.vacancies : Vacancy.all
end
|
#new ⇒ Object
20
21
22
23
24
|
# File 'app/controllers/vacancies_controller.rb', line 20
def new
@vacancy = Vacancy.new
@vacancy.project = @project if @project
end
|
#resource ⇒ Object
63
64
65
|
# File 'app/controllers/vacancies_controller.rb', line 63
def resource
@vacancy
end
|
#show ⇒ Object
16
17
18
|
# File 'app/controllers/vacancies_controller.rb', line 16
def show
@comments = @vacancy.
end
|
#update ⇒ Object
47
48
49
50
51
52
53
54
55
|
# File 'app/controllers/vacancies_controller.rb', line 47
def update
@vacancy = Vacancy.friendly.find(params[:id])
if @vacancy.update_attributes(params[:vacancy])
redirect_to @vacancy, notice: t('general.form.successfully_updated')
else
render :edit
end
end
|