Create ID12 My Job

parent 2e0f39f4
Pipeline #1018 failed with stages
in 0 seconds
...@@ -63,3 +63,7 @@ ...@@ -63,3 +63,7 @@
.industry:last-child::after, .location:last-child::after { .industry:last-child::after, .location:last-child::after {
content: ""; content: "";
} }
.my-job-label {
padding: 30px;
margin: 30px;
}
...@@ -5,16 +5,19 @@ class JobAppliedsController < ApplicationController ...@@ -5,16 +5,19 @@ class JobAppliedsController < ApplicationController
def new def new
end end
def show
arr_job_id = current_user.job_applieds.pluck(:job_id)
@jobs = Job.where(id: arr_job_id).order(updated_at: :asc)
end
def confirmation def confirmation
@user = current_user.job_applieds.new(apply_params) @user = current_user.job_applieds.new(apply_params)
@user.cv_user = current_user.cv_user if apply_params[:cv_user].blank? @user.cv_user = current_user.cv_user if apply_params[:cv_user].blank?
if @user.invalid? if @user.invalid?
@user.errors.full_messages.each do |message| flash[:danger] = @user.errors.full_messages.join('<br>')
flash[:danger] = message
redirect_to apply_job_path(job_id: apply_params[:job_id]) redirect_to apply_job_path(job_id: apply_params[:job_id])
end end
end end
end
def create def create
@job = Job.find_by(id: apply_params[:job_id]) @job = Job.find_by(id: apply_params[:job_id])
......
<div class="border border-dark rounded">
<div class="job-details">
<div class="title">
<%= link_to job_detail_path(job.id) do %><strong>
<%= job.title %></strong>
<% end %>
</div>
<div class="introduction">
<%= strip_tags(job.format_desc) %><br>
<%= link_to 'Read more..', job_detail_path(job.id) %>
</div>
<div class="row">
<div class="col-4">
<%= job.cities.map(&:name).join(' | ') %>
</div>
<div class="salary col-4">
Salary: <%= job.salary %>
</div>
<div class="applied-at col-4">
<strong>Applied at:</strong>
<% job.job_applieds.each do |info| %>
<%= info.updated_at.strftime('%d/%m/%Y') %>
<% end %>
</div>
</div>
</div>
</div>
<br>
<div class="container">
<h1 class="text-center my-job-label">My Job</h1>
<%= render partial: "job_applieds/my_jobs", collection: @jobs, as: :job %>
</div>
<div class="flash rounded"> <div class="flash rounded">
<% flash.each do |key, value| %> <% flash.each do |key, value| %>
<div class="alert alert-<%= key %>"><%= value %></div> <div class="text-center alert alert-<%= key %>"><strong><%= value.html_safe %></strong></div>
<% end %> <% end %>
</div> </div>
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
</div> </div>
<%= link_to 'Update', my_page_info_path, class: 'btn btn-outline-primary btn-lg update-btn' %> <%= link_to 'Update', my_page_info_path, class: 'btn btn-outline-primary btn-lg update-btn' %>
<%= link_to 'My Jobs', '#', class: 'btn btn-outline-info btn-lg my-jobs-btn' %> <%= link_to 'My Jobs', my_jobs_path, class: 'btn btn-outline-info btn-lg my-jobs-btn' %>
<% end %> <% end %>
</div> </div>
</div> </div>
......
...@@ -24,6 +24,8 @@ Rails.application.routes.draw do ...@@ -24,6 +24,8 @@ Rails.application.routes.draw do
post 'confirm', to: 'job_applieds#confirmation', as: :confirm_job post 'confirm', to: 'job_applieds#confirmation', as: :confirm_job
post 'done', to: 'job_applieds#create', as: :finished_apply post 'done', to: 'job_applieds#create', as: :finished_apply
get '/my/jobs', to: 'job_applieds#show', as: :my_jobs
resources :jobs resources :jobs
get 'detail/:id', to: 'jobs#show', as: :job_detail get 'detail/:id', to: 'jobs#show', as: :job_detail
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment