Commit 95aa91b3 by Tô Ngọc Ánh

edit confirm, finsh action applied_job controller

parent 38b8dbb0
Pipeline #917 failed with stages
in 0 seconds
...@@ -58,6 +58,18 @@ background-color: $main-color; ...@@ -58,6 +58,18 @@ background-color: $main-color;
} }
} }
.card-img-rounded {
border-radius: 50%;
background-color: mediumseagreen;
height: 220px; width: 220px;
margin-top: 50px;
padding: 10px;
.card-img {
margin-top: 40px;
}
}
.ribbon::before, .ribbon::after { .ribbon::before, .ribbon::after {
content: ""; content: "";
position: absolute; position: absolute;
......
...@@ -3,10 +3,7 @@ class AppliedJobsController < ApplicationController ...@@ -3,10 +3,7 @@ class AppliedJobsController < ApplicationController
def new def new
job = Job.find_by(id: params[:job_id]) job = Job.find_by(id: params[:job_id])
if job.nil? return redirect_to root_path if job.nil?
redirect_to root_path
return
end
@applied_job = job.applied_jobs.new(full_name: current_user.full_name, @applied_job = job.applied_jobs.new(full_name: current_user.full_name,
email: current_user.email, email: current_user.email,
curriculum_vitae: current_user.curriculum_vitae) curriculum_vitae: current_user.curriculum_vitae)
...@@ -14,11 +11,14 @@ class AppliedJobsController < ApplicationController ...@@ -14,11 +11,14 @@ class AppliedJobsController < ApplicationController
def confirm def confirm
@applied_job = current_user.applied_jobs.new(applied_job_params) @applied_job = current_user.applied_jobs.new(applied_job_params)
@applied_job.curriculum_vitae = current_user.curriculum_vitae if params[:curriculum_vitae].nil? @applied_job.curriculum_vitae = current_user.curriculum_vitae if params[:applied_job][:curriculum_vitae].nil?
redirect_to root_path if @applied_job.invalid? redirect_to new_applied_job_path(job_id: @applied_job.job_id) if @applied_job.invalid?
end end
def finish def finish
@applied_job = current_user.applied_jobs.new(applied_job_params)
@applied_job.valid?
@applied_job.errors
end end
private private
......
...@@ -17,41 +17,47 @@ ...@@ -17,41 +17,47 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-5 col-sm-12 mx-auto"> <div class="col-md-6 col-sm-12 mx-auto">
<div class="row"> <%= form_for @applied_job, url: finish_applied_job_path do |f| %>
<div class="col-5"> <%= f.hidden_field :job_id %>
<h5 class="font-weight-bold">Full Name</h5> <div class="row">
</div> <div class="col-5">
<div class="col-7"> <%= f.label :full_name, class: 'h5 font-weight-bold' %>
<h5><%= @applied_job.user.full_name %></h5> </div>
</div> <div class="col-7">
</div> <h5><%= @applied_job.user.full_name %></h5>
<div class="row"> <%= f.hidden_field :full_name %>
<div class="col-5"> </div>
<h5 class="font-weight-bold">Email</h5> </div>
</div> <div class="row">
<div class="col-7"> <div class="col-5">
<h5><%= @applied_job.user.email %></h5> <%= f.label :email, class: 'h5 font-weight-bold' %>
</div> </div>
</div> <div class="col-7">
<div class="row"> <h5><%= @applied_job.user.email %></h5>
<div class="col-5"> <%= f.hidden_field :email %>
<h5 class="font-weight-bold">Curriculum Vitae</h5> </div>
</div> </div>
<div class="col-7"> <div class="row">
<%= link_to @applied_job.curriculum_vitae.identifier, @applied_job.curriculum_vitae.url, download: @applied_job.curriculum_vitae.identifier %> <div class="col-5">
<%= link_to @applied_job.curriculum_vitae.url, target: '_blank', class: 'text-dark' do %> <h5 class="font-weight-bold">Curriculum Vitae</h5>
<i class="fas fa-eye"></i> </div>
<div class="col-7">
<%= link_to @applied_job.curriculum_vitae.identifier, @applied_job.curriculum_vitae.url, download: @applied_job.curriculum_vitae.identifier %>
<%= link_to @applied_job.curriculum_vitae.url, target: '_blank', class: 'text-dark' do %>
<i class="fas fa-eye"></i>
<% end %>
<%= f.hidden_field :curriculum_vitae, class: 'd-none' %>
</div>
</div>
<div class="row my-3">
<div class="col text-right">
<%= link_to 'Edit', new_applied_job_path(job_id: @applied_job.job_id), class: 'btn btn-outline-secondary btn-lg' %>
</div>
<div class="col text-left">
<%= f.submit "Done", class: 'btn btn-outline-success btn-lg' %>
</div>
<% end %> <% end %>
</div>
</div>
<div class="row my-3">
<div class="col text-right">
<%= link_to 'Edit', new_applied_job_path, class: 'btn btn-outline-secondary btn-lg' %>
</div>
<div class="col text-left">
<%= link_to 'Done', '#', class: 'btn btn-outline-success btn-lg' %>
</div>
</div> </div>
</div> </div>
</div> </div>
<% if resource.errors.any? %> <% if resource.errors.any? %>
<div id="error_explanation"> <div id="error_explanation">
<h2>
<%= I18n.t("errors.messages.not_saved",
count: resource.errors.count,
resource: resource.class.model_name.human.downcase)
%>
</h2>
<ul> <ul>
<% resource.errors.full_messages.each do |message| %> <% resource.errors.full_messages.each do |message| %>
<li><%= message %></li> <li><%= message %></li>
......
...@@ -171,7 +171,7 @@ Devise.setup do |config| ...@@ -171,7 +171,7 @@ Devise.setup do |config|
# Email regex used to validate email formats. It simply asserts that # Email regex used to validate email formats. It simply asserts that
# one (and only one) @ exists in the given string. This is mainly # one (and only one) @ exists in the given string. This is mainly
# to give user feedback and not to assert the e-mail validity. # to give user feedback and not to assert the e-mail validity.
config.email_regexp = /\A[^@\s]+@[^@\s]+\z/ config.email_regexp = /\A[a-zA-Z][\w\.]+@[a-zA-Z]+\.[a-zA-Z]+\z/
# ==> Configuration for :timeoutable # ==> Configuration for :timeoutable
# The time you want to timeout the user session without activity. After this # The time you want to timeout the user session without activity. After this
......
...@@ -9,5 +9,6 @@ Rails.application.routes.draw do ...@@ -9,5 +9,6 @@ Rails.application.routes.draw do
resources :users, only: :show resources :users, only: :show
get 'apply', to: 'applied_jobs#new', as: :new_applied_job get 'apply', to: 'applied_jobs#new', as: :new_applied_job
post 'confirm', to: 'applied_jobs#confirm', as: :confirm_applied_job post 'confirm', to: 'applied_jobs#confirm', as: :confirm_applied_job
post 'finish', to: 'applied_jobs#finish', as: :finish_applied_job
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end end
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