create page apply job

parent a3b32561
Pipeline #993 failed with stages
in 0 seconds
...@@ -3,18 +3,14 @@ class JobAppliedsController < ApplicationController ...@@ -3,18 +3,14 @@ class JobAppliedsController < ApplicationController
def new def new
end end
def create def confirmation
binding.pry binding.pry
@user = JobApplied.new(apply_params) @user = JobApplied.new(apply_params)
if @user.save
@user.update_attribute(:user_id, current_user.id)
cv_user = params[:job_applied][:cv_user]
@user.update_attribute(:cv_user, cv_user)
end end
end
def confirmation
def create
binding.pry
@user = JobApplied.new(apply_params)
end end
private private
...@@ -26,6 +22,6 @@ class JobAppliedsController < ApplicationController ...@@ -26,6 +22,6 @@ class JobAppliedsController < ApplicationController
end end
def apply_params def apply_params
params.require(:job_applied).permit(:name, :email, :job_id) params.require(:job_applied).permit(:name, :email, :job_id, :cv_user)
end end
end end
<div class="container"> <div class="container">
<%= render 'shared/error_messages' %>
<div class="row ribbon-mark"> <div class="row ribbon-mark">
<%= render partial: 'ribbon_step', locals: { step1: 'active', step2: 'active', step3: '' } %> <%= render partial: 'ribbon_step', locals: { step1: 'active', step2: 'active', step3: '' } %>
</div> </div>
<h1 class="text-center my-page-label">Confirmation</h1> <h1 class="text-center my-page-label">Confirmation</h1>
<div class="form-login"> <div class="form-login">
<div class="row form d-flex justify-content-center"> <div class="row form d-flex justify-content-center">
<%# binding.pry %> <%= form_for(@user, url: finished_apply_path) do |f| %>
<%= form_for(current_user) do |f| %>
<div class="email-field"> <div class="email-field">
<div class="col-4-sm"> <div class="col-4-sm">
<%= f.label :email %> <%= f.label :email %>
</div> </div>
<div class="col-8-sm"> <div class="col-8-sm">
<%= f.label "#{current_user.email}", class: 'input-email' %> <strong><%= @user.email %></strong>
<%= f.hidden_field :email, value: @user.email %>
</div> </div>
</div> </div>
<div class="name-field"> <div class="name-field">
...@@ -21,7 +20,8 @@ ...@@ -21,7 +20,8 @@
<%= f.label :name, 'Full Name' %> <%= f.label :name, 'Full Name' %>
</div> </div>
<div class="col-8-sm"> <div class="col-8-sm">
<%= f.label :name, class: 'input-name' %> <strong><%= @user.name %></strong>
<%= f.hidden_field :name, value: @user.name %>
</div> </div>
</div> </div>
<div class="cv-field"> <div class="cv-field">
...@@ -29,17 +29,16 @@ ...@@ -29,17 +29,16 @@
<%= f.label :cv_user, 'CV Upload' %> <%= f.label :cv_user, 'CV Upload' %>
</div> </div>
<div class="col-8-sm"> <div class="col-8-sm">
<% if current_user.cv_user.present? %> <%= link_to_if @user.cv_user.present? ,@user.cv_user.identifier, @user.cv_user.url, download: @user.cv_user.identifier do %>
<%= link_to current_user.cv_user.identifier, current_user.cv_user.url, download: current_user.cv_user.identifier %>
<% else %>
<div class="cv-none"> <div class="cv-none">
CV hasn't found in your Profile. Upload now! CV hasn't found in your Profile. Upload now!
</div> </div>
<% end %> <% end %>
</div> </div>
</div> </div>
<%= f.hidden_field :job_id, value: params[:job_id] %>
<%= link_to 'Edit', '#', class: 'btn btn-outline-primary btn-lg update-btn' %> <%= link_to 'Edit', apply_job_path(job_id: params[:job_applied][:job_id]), class: 'btn btn-outline-primary btn-lg update-btn' %>
<%= f.submit 'Done', class: 'btn btn-outline-primary btn-lg update-btn' %> <%= f.submit 'Done', class: 'btn btn-outline-primary btn-lg update-btn' %>
<% end %> <% end %>
</div> </div>
......
<div class="container">
<div class="row ribbon-mark">
<%= render partial: 'ribbon_step', locals: { step1: 'active', step2: 'active', step3: 'active' } %>
</div>
<div class="text-center">
<h1 class="my-page-label">Thank you for apply</h1>
<p>Back to <%= link_to 'TOP', root_path %> page</p>
</div>
</div>
<div class="container"> <div class="container">
<%= render 'shared/update_error_messages' %>
<div class="row ribbon-mark"> <div class="row ribbon-mark">
<%= render partial: 'ribbon_step', locals: { step1: 'active', step2: '', step3: '' } %> <%= render partial: 'ribbon_step', locals: { step1: 'active', step2: '', step3: '' } %>
</div> </div>
<h1 class="text-center my-page-label">Apply Form</h1> <h1 class="text-center my-page-label">Apply Form</h1>
<div class="form-login"> <div class="form-login">
<div class="row form d-flex justify-content-center"> <div class="row form d-flex justify-content-center">
<%= form_for(:job_applied, url: create_application_path) do |f| %> <%= form_for(:job_applied, url: confirm_job_path) do |f| %>
<div class="email-field"> <div class="email-field">
<div class="col-4-sm"> <div class="col-4-sm">
<%= f.label :email %> <%= f.label :email %>
...@@ -28,9 +27,7 @@ ...@@ -28,9 +27,7 @@
<%= f.label :cv_user, 'My CV' %> <%= f.label :cv_user, 'My CV' %>
</div> </div>
<div class="col-8-sm"> <div class="col-8-sm">
<% if current_user.cv_user.present? %> <%= link_to_if current_user.cv_user.present? ,current_user.cv_user.identifier, current_user.cv_user.url, download: current_user.cv_user.identifier do %>
<%= link_to current_user.cv_user.identifier, current_user.cv_user.url, download: current_user.cv_user.identifier %>
<% else %>
<div class="cv-none"> <div class="cv-none">
<%= f.file_field :cv_user, accept: '.doc, .pdf, .xls, .xlsx, .zip',class: 'input-cv' %> <%= f.file_field :cv_user, accept: '.doc, .pdf, .xls, .xlsx, .zip',class: 'input-cv' %>
</div> </div>
......
...@@ -25,9 +25,7 @@ ...@@ -25,9 +25,7 @@
<%= f.label :cv_user, 'My CV' %> <%= f.label :cv_user, 'My CV' %>
</div> </div>
<div class="col-8-sm"> <div class="col-8-sm">
<% if current_user.cv_user.present? %> <%= link_to_if current_user.cv_user.present? ,current_user.cv_user.identifier, current_user.cv_user.url, download: current_user.cv_user.identifier do %>
<%= link_to current_user.cv_user.identifier, current_user.cv_user.url, download: current_user.cv_user.identifier %>
<% else %>
<div class="cv-none"> <div class="cv-none">
CV hasn't found in your Profile. Upload now! CV hasn't found in your Profile. Upload now!
</div> </div>
......
...@@ -16,9 +16,9 @@ Rails.application.routes.draw do ...@@ -16,9 +16,9 @@ Rails.application.routes.draw do
get 'jobs/company/:converted_name', to: 'jobs#company_jobs', as: :company_jobs get 'jobs/company/:converted_name', to: 'jobs#company_jobs', as: :company_jobs
get 'apply', to: 'job_applieds#new', as: :apply_job get 'apply', to: 'job_applieds#new', as: :apply_job
post 'create', to: 'job_applieds#create', as: :create_application
get '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
resources :job_applieds resources :job_applieds
resources :top_pages resources :top_pages
......
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