Class: FuturinoHr::JobApplicantsController

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

Instance Method Summary collapse

Instance Method Details

#create ⇒ Object

POST /job_applicants POST /job_applicants.json



29
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
# File 'app/controllers/futurino_hr/job_applicants_controller.rb', line 29

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

#destroy ⇒ Object

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



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

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

#edit ⇒ Object

GET /job_applicants/1/edit



24
25
# File 'app/controllers/futurino_hr/job_applicants_controller.rb', line 24

def edit
end

#index ⇒ Object

GET /job_applicants GET /job_applicants.json



9
10
11
# File 'app/controllers/futurino_hr/job_applicants_controller.rb', line 9

def index
  @job_applicants = JobApplicant.all
end

#new ⇒ Object

GET /job_applicants/new



19
20
21
# File 'app/controllers/futurino_hr/job_applicants_controller.rb', line 19

def new
  @job_applicant = JobApplicant.new
end

#show ⇒ Object

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



15
16
# File 'app/controllers/futurino_hr/job_applicants_controller.rb', line 15

def show
end

#update ⇒ Object

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



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

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