Commit 4545c46e by Hoang Nam Nguyen

'create apply_page'

parent 19d7354b
...@@ -43,7 +43,7 @@ class UsersController < ApplicationController ...@@ -43,7 +43,7 @@ class UsersController < ApplicationController
def download_cv def download_cv
@user = User.find(params[:id]) @user = User.find(params[:id])
downloadFile = @user.cv downloadFile = @user.cv
send_file downloadFile.file.file send_file downloadFile.current_path
end end
private private
......
class Apply < ApplicationRecord
validates :name, presence: true, length: {maximum: 200}
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, length: {maximum: 255},
format: {with: VALID_EMAIL_REGEX},
uniqueness: {case_sensitive: false}
end
<%= provide(:title, "Confirmation") %>
<h1 class="text-danger text-center">Confirmation</h1>
<div class="row ml-5 ct_local pl-3 pt-5 mt-5 mb-5">
<div class="col-md-10 col-md-offset-3">
<!--set field email -->
<div class="row mt-3 mb-5 ml-5">
<!--set field email -->
<div class="col-md-2">
<strong><i>Email: </i></strong>
</div>
<!--set field email -->
<div class="col-md-10">
<%= @user_apply.email %>
</div>
<!--end field password -->
</div>
<!--set field Name -->
<div class="row mt-5 mb-5 ml-5">
<!--set field Name -->
<div class= "col-md-2">
<strong><i>Full Name: </i></strong>
</div>
<!--set field name -->
<div class="col-md-10">
<%= @user_apply.name %>
</div>
<!--set field password -->
</div>
<!--set field cv -->
<div class="row mt-5 mb-5 ml-5">
<!--set field cv -->
<div class="col-md-2">
<strong><i>My CV</i></strong>
</div>
<!--set field cv -->
<div class="col-md-10 ">
<%= current_user.cv %>
</div>
<!--set field cv -->
</div>
<!--end field cv -->
<!--set button update -->
<div class="row ml-5 pb-5 pl-5">
<div class="col-md-4 text-center ">
<%= link_to edit_user_path,class: 'btn btn-danger' do %>
<i class="fa fa-wrench"></i> Edit
<% end %>
</div>
<div class="col-md-3">
<%= link_to '#',class: 'btn btn-danger' do %>
<i class="fa fa-wrench"></i> Done
<% end %>
</div>
</div>
</div>
</div>
\ No newline at end of file
<%= provide(:title, "Job Apply") %>
<h1 class="text-center text-danger">Apply Form</h1>
<div class="row ml-5 mt-5">
<div class="col-md-10 col-md-offset-3">
<!--set message errors -->
<!--end set -->
<!--set field all -->
<%= form_for(:apply, url: new_info_path) do |f| %>
<%= render 'shared/error_user_apply'%>
<div class="row mt-3">
<!--set field password -->
<div class="col-md-2 mb-5">
<strong><i><%= f.label :name, "Full Name" %></i></strong>
</div>
<!--set field password -->
<div class="col-md-10">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-user fa" aria-hidden="true"></i></span>
<%= f.text_field :name, class: 'form-control' %>
</div>
</div>
<!--end set field password -->
<!--set field email -->
<div class="col-md-2">
<strong><i><%= f.label :email %></i></strong>
</div>
<!--set field email -->
<div class="col-md-10">
<div class="input-group">
<span class="input-group-addon mb-5"><i class="fa fa-envelope" aria-hidden="true"></i></span>
<%= f.email_field :email, class: 'form-control mb-5' %>
</div>
</div>
<!--end field email -->
<% if current_user.cv? %>
<div class="col-md-4">
<strong><i>My CV</i></strong>
</div>
<div class="col-md-8 mb-5">
<%= link_to 'Download cv',downloadcv_path(id: @current_user.id) %>
</div>
</div>
<% end %>
<!--end set field all -->
<div class="row ">
<div class="col-sm-2"></div>
<div class="col-sm-10">
<%= button_tag(type: "submit", class: "btn btn-danger btn-block") do %>
<i class="fa fa-check 4px"></i> Confirm
<% end %>
</div>
</div>
<!--end set button -->
<% end %>
</div>
</div>
...@@ -6,7 +6,11 @@ ...@@ -6,7 +6,11 @@
<%= link_to 'CITY',cities_path , { class: 'btn btn-success' } %> <%= link_to 'CITY',cities_path , { class: 'btn btn-success' } %>
<%= link_to 'INDUSTRY', industries_path, { class: 'btn btn-success' } %> <%= link_to 'INDUSTRY', industries_path, { class: 'btn btn-success' } %>
<%= link_to 'SHORT TITLE', '#', { class: 'btn btn-success' } %> <%= link_to 'SHORT TITLE', '#', { class: 'btn btn-success' } %>
<%= link_to 'Apply','#', {class: 'btn btn-primary float-right'} %> <% if logged_in? %>
<%= link_to 'Apply',form_apply_path(id: @job.id), {class: 'btn btn-primary float-right'} %>
<% else %>
<%= link_to 'Apply',login_user_path, {class: 'btn btn-primary float-right'} %>
<% end %>
</div> </div>
</div> </div>
...@@ -21,7 +25,7 @@ ...@@ -21,7 +25,7 @@
<p class="card-texts">Location: <%= @job.cities.map(&:location).join(',') %></p> <p class="card-texts">Location: <%= @job.cities.map(&:location).join(',') %></p>
<p class="card-text"><a href="#">Salary: </a><%= @job.salary %></p> <p class="card-text"><a href="#">Salary: </a><%= @job.salary %></p>
<p class="card-text"><%= @job.descripton.gsub("\t"," ").gsub("\n","<br/>").gsub("\r","<br/>").html_safe %></p> <p class="card-text"><%= @job.descripton.gsub("\t"," ").gsub("\n","<br/>").gsub("\r","<br/>").html_safe %></p>
<a class="btn btn-success text-white w-25">Apply</a> <a class="btn btn-success text-white w-25" href ="<%= form_apply_path(id: @job.id)%>">Apply</a>
<a class="btn btn-success text-white w-25">Favorite</a> <a class="btn btn-success text-white w-25">Favorite</a>
</div> </div>
</div> </div>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
</div> </div>
<!--Footer Links--> <!--Footer Links-->
<div class="container mt-5 mb-4 text-center text-md-left"> <div class="container mt-5 mb-4 text-center text-md-left font_footer">
<div class="row mt-3"> <div class="row mt-3">
<!--First column--> <!--First column-->
<div class="col-md-3 col-lg-4 col-xl-3 mb-r dark-grey-text"> <div class="col-md-3 col-lg-4 col-xl-3 mb-r dark-grey-text">
......
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<a class="navbar-brand" href="http://zigexn.vn"> <a class="navbar-brand" href="<%= root_path %>">
<%= image_tag("logo.png", class: "navbar-brand", id: "logo") %> <%= image_tag("logo.png", class: "navbar-brand", id: "logo") %>
</a> </a>
</div> </div>
...@@ -43,6 +43,12 @@ ...@@ -43,6 +43,12 @@
<i class="fa fa-user-circle-o"></i> Register <i class="fa fa-user-circle-o"></i> Register
<% end %> <% end %>
</li> </li>
<% else %>
<li>
<%= link_to my_page_path(@current_user.id), class: 'btn btn-info distance mt-4 no-gutters' do %>
<i class="fa fa-home"></i> My Page
<% end %>
</li>
<% end %> <% end %>
<li> <li>
......
<% if @user_apply.errors.any? %>
<div id="error_explanation">
<div class="alert alert-danger">
The form contains <%= pluralize(@user_apply.errors.count, "error") %>.
</div>
<ul>
<% @user_apply.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<a href="#"> <a href="<%=job_detail_path(job.id)%>">
<p> <p>
<%= job.job_title %> <%= job.job_title %>
</p> </p>
......
...@@ -53,13 +53,15 @@ ...@@ -53,13 +53,15 @@
<!--set button update --> <!--set button update -->
<div class="row ml-5 pb-5 pl-5"> <div class="row ml-5 pb-5 pl-5">
<div class="col-md-4 text-center "> <div class="col-md-4 text-center ">
<%= link_to 'Update', edit_user_path, { class: 'btn btn-success' } %> <%= link_to edit_user_path,class: 'btn btn-danger' do %>
<i class="fa fa-wrench"></i> Update
<% end %>
</div> </div>
<!--end set button update -->
<!--set button download -->
<div class="col-md-3"> <div class="col-md-3">
<%= link_to 'My Jobs','#',{class: 'btn btn-success'}%> <%= link_to '#',class: 'btn btn-danger' do %>
<i class="fa fa-wrench"></i> MyJobs
<% end %>
</div> </div>
</div> </div>
<!--end set button download --> <!--end set button download -->
......
class CreateApplies < ActiveRecord::Migration[5.1]
def change
create_table :applies do |t|
t.string :name
t.string :email
t.timestamps
end
end
end
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170927013828) do ActiveRecord::Schema.define(version: 20171002022713) do
create_table "add_cv_to_users", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| create_table "add_cv_to_users", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.string "cv" t.string "cv"
...@@ -18,6 +18,13 @@ ActiveRecord::Schema.define(version: 20170927013828) do ...@@ -18,6 +18,13 @@ ActiveRecord::Schema.define(version: 20170927013828) do
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
end end
create_table "applies", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.string "name"
t.string "email"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "cities", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| create_table "cities", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.string "location" t.string "location"
t.datetime "created_at", null: false t.datetime "created_at", null: false
...@@ -85,6 +92,11 @@ ActiveRecord::Schema.define(version: 20170927013828) do ...@@ -85,6 +92,11 @@ ActiveRecord::Schema.define(version: 20170927013828) do
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.string "password_digest" t.string "password_digest"
t.string "cv" t.string "cv"
t.string "reset_digest"
t.datetime "reset_sent_at"
t.string "activation_digest"
t.boolean "activated"
t.datetime "activated_at"
end end
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