Class: HrEngine6::JobApplicantsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/hr_engine6/job_applicants_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /job_applicants POST /job_applicants.json



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'app/controllers/hr_engine6/job_applicants_controller.rb', line 30

def create
  @job_applicant = JobApplicant.new(job_applicant_params)

  respond_to do |format|
    if @job_applicant.save
      s3 = Aws::S3::Resource.new

      #dosyanın kabul edilen fotoğraf formatlarından biriyle bitmesi önemli
      if(params['job_applicant'][:image].present?) #image seçilmişse yükle
        if params['job_applicant'][:image].original_filename.include?('png')
          upload_file('png', s3)
        elsif params['job_applicant'][:image].original_filename.include?('jpeg')
          upload_file('jpeg', s3)
        elsif params['job_applicant'][:image].original_filename.include?('jpg')
          upload_file('jpeg', s3)
        end
      end

      #dosyanın kabul edilen döküman formatlarından biriyle bitmesi önemli
      if(params['job_applicant'][:cv].present?) #cv seçilmişse yükle
        if params['job_applicant'][:cv].original_filename.include?('doc')
          upload_file('doc', s3)
        elsif params['job_applicant'][:cv].original_filename.include?('docx')
          upload_file('docx', s3)
        elsif params['job_applicant'][:cv].original_filename.include?('pdf')
          upload_file('pdf', s3)
        end
      end


      format.html { redirect_to @job_applicant, notice: 'Aday profili başarıyla oluşturuldu.' }
      format.json { render :show, status: :created, location: @job_applicant }
    else
      format.html { render :new }
      format.json { render json: @job_applicant.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /job_applicants/1 DELETE /job_applicants/1.json



85
86
87
88
89
90
91
# File 'app/controllers/hr_engine6/job_applicants_controller.rb', line 85

def destroy
  @job_applicant.destroy
  respond_to do |format|
    format.html { redirect_to job_applicants_url, notice: 'Aday profili başarıyla silindi.' }
    format.json { head :no_content }
  end
end

#editObject

GET /job_applicants/1/edit



25
26
# File 'app/controllers/hr_engine6/job_applicants_controller.rb', line 25

def edit
end

#indexObject

GET /job_applicants GET /job_applicants.json



10
11
12
# File 'app/controllers/hr_engine6/job_applicants_controller.rb', line 10

def index
  @job_applicants = JobApplicant.all
end

#newObject

GET /job_applicants/new



20
21
22
# File 'app/controllers/hr_engine6/job_applicants_controller.rb', line 20

def new
  @job_applicant = JobApplicant.new
end

#showObject

GET /job_applicants/1 GET /job_applicants/1.json



16
17
# File 'app/controllers/hr_engine6/job_applicants_controller.rb', line 16

def show
end

#updateObject

PATCH/PUT /job_applicants/1 PATCH/PUT /job_applicants/1.json



71
72
73
74
75
76
77
78
79
80
81
# File 'app/controllers/hr_engine6/job_applicants_controller.rb', line 71

def update
  respond_to do |format|
    if @job_applicant.update(job_applicant_params)
      format.html { redirect_to @job_applicant, notice: 'Aday profili başarıyla güncellendi.' }
      format.json { render :show, status: :ok, location: @job_applicant }
    else
      format.html { render :edit }
      format.json { render json: @job_applicant.errors, status: :unprocessable_entity }
    end
  end
end