Commit 1872940f by Ngô Trung Hưng

Merge branch 'ID8_Favorite' into 'master'

create func favorite

See merge request !11
parents dbcda2ab e105f69b
Pipeline #982 canceled with stages
in 0 seconds
...@@ -34,6 +34,7 @@ gem 'draper' ...@@ -34,6 +34,7 @@ gem 'draper'
gem 'devise' gem 'devise'
gem 'carrierwave' gem 'carrierwave'
gem 'rails-i18n' gem 'rails-i18n'
gem 'i18n-js'
# Use ActiveStorage variant # Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8' # gem 'mini_magick', '~> 4.8'
...@@ -47,6 +48,7 @@ group :development, :test do ...@@ -47,6 +48,7 @@ group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console # Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'dotenv-rails' gem 'dotenv-rails'
gem 'pry'
end end
group :development do group :development do
......
...@@ -79,6 +79,7 @@ GEM ...@@ -79,6 +79,7 @@ GEM
archive-zip (~> 0.10) archive-zip (~> 0.10)
nokogiri (~> 1.8) nokogiri (~> 1.8)
chronic (0.10.2) chronic (0.10.2)
coderay (1.1.3)
coffee-rails (4.2.2) coffee-rails (4.2.2)
coffee-script (>= 2.2.0) coffee-script (>= 2.2.0)
railties (>= 4.0.0) railties (>= 4.0.0)
...@@ -111,6 +112,8 @@ GEM ...@@ -111,6 +112,8 @@ GEM
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
i18n (1.8.5) i18n (1.8.5)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
i18n-js (3.7.1)
i18n (>= 0.6.6)
image_processing (1.11.0) image_processing (1.11.0)
mini_magick (>= 4.9.5, < 5) mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3) ruby-vips (>= 2.0.17, < 3)
...@@ -152,6 +155,9 @@ GEM ...@@ -152,6 +155,9 @@ GEM
nokogiri (1.10.10) nokogiri (1.10.10)
mini_portile2 (~> 2.4.0) mini_portile2 (~> 2.4.0)
orm_adapter (0.5.0) orm_adapter (0.5.0)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (4.0.5) public_suffix (4.0.5)
puma (3.12.6) puma (3.12.6)
rack (2.2.3) rack (2.2.3)
...@@ -262,11 +268,13 @@ DEPENDENCIES ...@@ -262,11 +268,13 @@ DEPENDENCIES
devise devise
dotenv-rails dotenv-rails
draper draper
i18n-js
jbuilder (~> 2.5) jbuilder (~> 2.5)
kaminari kaminari
listen (>= 3.0.5, < 3.2) listen (>= 3.0.5, < 3.2)
mysql2 (>= 0.4.4, < 0.6.0) mysql2 (>= 0.4.4, < 0.6.0)
nokogiri nokogiri
pry
puma (~> 3.11) puma (~> 3.11)
rails (~> 5.2.4, >= 5.2.4.3) rails (~> 5.2.4, >= 5.2.4.3)
rails-i18n rails-i18n
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives. // about supported directives.
// //
//= require i18n
//= require rails-ujs //= require rails-ujs
//= require activestorage //= require activestorage
//= require turbolinks //= require turbolinks
...@@ -17,6 +18,5 @@ ...@@ -17,6 +18,5 @@
//= require_tree . //= require_tree .
toastr.options = { toastr.options = {
'closeButton': true, 'closeButton': true,
'progressBar': true, 'timeOut': 8000
'timeOut': 10000
} }
$(document).on("turbolinks:load", function(){ $(document).on("turbolinks:load", function(){
$('.block_click_favorite').click(function (e) { $('.span_click_favorite').click(function (e) {
$('.overlay_login').addClass('show'); $('.overlay_login').addClass('show');
}); });
......
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
...@@ -1175,6 +1175,12 @@ $main-color: #23303D; ...@@ -1175,6 +1175,12 @@ $main-color: #23303D;
font-weight: 600 !important; font-weight: 600 !important;
} }
} }
.btn-apply_job_favorite.unfavorite {
background-color: #485461;
background-image: linear-gradient(315deg, #485461 0%, #28313b 74%);
}
.box_detail_jobs { .box_detail_jobs {
width: 100%; width: 100%;
height: auto; height: auto;
...@@ -1609,4 +1615,10 @@ $main-color: #23303D; ...@@ -1609,4 +1615,10 @@ $main-color: #23303D;
} }
} }
} }
} }
\ No newline at end of file .lable_radio {
position: relative;
width: 100%;
height: 100%;
z-index: 99999;
}
...@@ -15,12 +15,28 @@ ...@@ -15,12 +15,28 @@
display: none; display: none;
} }
.link_favorite { .link_favorite {
color: #999; color:#e62958;
z-index: 100000; z-index: 100000;
margin-right: 15px;
&:hover { &:hover {
text-decoration: none; text-decoration: none;
} }
} }
.link_favorite.in_block {
position: absolute;
z-index: revert;
top: 50%;
transform: translateY(-50%);
font-size: 20px;
color: #483ea2d1;
&:hover {
color: #1135e6;
}
}
.link_favorite.active {
color: #e62958 !important;
}
.block_click_favorite { .block_click_favorite {
color: #999; color: #999;
cursor: pointer; cursor: pointer;
...@@ -87,12 +103,9 @@ ...@@ -87,12 +103,9 @@
color: #666; color: #666;
font-size: 17px; font-size: 17px;
color: rgb(60, 71, 121); color: rgb(60, 71, 121);
span {
}
} }
.modal_login_header { .modal_login_header {
background-color: #eee; background-color: #d2d2d2;
height: 30px; height: 30px;
line-height: 30px; line-height: 30px;
text-align: center; text-align: center;
...@@ -101,6 +114,12 @@ ...@@ -101,6 +114,12 @@
font-weight: 600; font-weight: 600;
font-family: 'Raleway', sans-serif; font-family: 'Raleway', sans-serif;
} }
@media only screen and (max-width: 400px) {
.modal_login_notice_text {
font-size: 15px;
}
}
@media only screen and (max-width: 768px) { @media only screen and (max-width: 768px) {
.block_link_favorite.lg { .block_link_favorite.lg {
display: none; display: none;
...@@ -140,6 +159,7 @@ ...@@ -140,6 +159,7 @@
} }
.btn-info-custom { .btn-info-custom {
margin-bottom: 10px;
width: 100% !important; width: 100% !important;
} }
.btn-custom-padding { .btn-custom-padding {
......
// Place all the styles related to the favorite controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
.box_scroll{
width: 100%;
height: 60vh;
overflow-x: hidden;
overflow-y: scroll;
}
.box_radio {
width: 20px;
height: 20px;
margin: auto;
position: relative;
top: 50%;
left: 50%;
transform: translateY(-50%);
}
.radio_id {
position: relative;
z-index: 999999999999;
// top: 50px;
}
[type="radio"] {
cursor: pointer;
width: 20px;
height: 20px;
transition: ease-in 0.3s;
}
[type="radio"]:checked {
transition: ease-in 0.3s;
}
.span_click_favorite {
&:hover {
cursor: pointer;
transform: rotateY(360deg);
transition: ease-in-out;
}
}
@media only screen and (max-width: 992px) {
.container {
.btn_apply_job.in_favorite {
display: none;
}
}
.link_favorite.in_block {
right: 30px;
}
}
@media only screen and (max-width: 768px) {
.link_favorite.in_block {
right: 15px;
}
}
@media only screen and (max-width: 576px) {
.link_favorite.in_block {
transform: translateY(-250%);
}
.box_my_page_header {
h4 {
font-size: 16px;
}
}
}
\ No newline at end of file
::-webkit-scrollbar {
width: 5px;
}
/* Track */
::-webkit-scrollbar-track {
box-shadow: inset 0 0 5px grey;
border-radius: 10px;
}
/* Handle */
::-webkit-scrollbar-thumb {
background: #483ea2d1;
border-radius: 10px;
}
/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
background: #8c80ffd1;
}
\ No newline at end of file
...@@ -10,6 +10,7 @@ class ApplyJobController < ApplicationController ...@@ -10,6 +10,7 @@ class ApplyJobController < ApplicationController
def apply def apply
return redirect_to root_path if params[:job_id].blank? return redirect_to root_path if params[:job_id].blank?
@data_apply = current_user.applied_jobs.new(name: current_user.name, email: current_user.email) @data_apply = current_user.applied_jobs.new(name: current_user.name, email: current_user.email)
session[:job_id] = params[:job_id] session[:job_id] = params[:job_id]
@job = Job.find(params[:job_id]) @job = Job.find(params[:job_id])
......
# frozen_string_literal: true
class FavoriteController < ApplicationController
before_action :authenticate_user!
def index
@favorites = current_user.favorites.order(created_at: :desc).map(&:job)
end
def create
return redirect_to root_path if Job.find(params[:job_id]).blank?
@favorite = current_user.favorites.new(job_id: params[:job_id])
if @favorite.invalid?
helpers.render_errors(@favorite)
return redirect_to favorite_index_path
end
respond_to :js if @favorite.save
end
def destroy
@favorite = current_user.favorites.find_by(id: params[:id])
return redirect_to favorite_index_path if @favorite.blank?
respond_to :js if @favorite.destroy
end
end
...@@ -3,6 +3,12 @@ ...@@ -3,6 +3,12 @@
# Job controller # Job controller
class JobController < ApplicationController class JobController < ApplicationController
before_action :load_data_dropdown, only: :index before_action :load_data_dropdown, only: :index
# after_action :add_job_to_history, only: :detail
def add_job_to_history
current_user.histories.create(session[:params_job_id]) if user_signed_in?
session.delete(:params_job_id)
end
def index def index
model = params[:model].classify.constantize model = params[:model].classify.constantize
...@@ -11,6 +17,7 @@ class JobController < ApplicationController ...@@ -11,6 +17,7 @@ class JobController < ApplicationController
end end
def detail def detail
session[:params_job_id] = params[:id]
@job = Job.find(params[:id]).decorate @job = Job.find(params[:id]).decorate
cities = @job.cities.first cities = @job.cities.first
industries = @job.industries.first industries = @job.industries.first
......
...@@ -9,4 +9,8 @@ class RegistrationsController < Devise::RegistrationsController ...@@ -9,4 +9,8 @@ class RegistrationsController < Devise::RegistrationsController
def after_update_path_for(resource) def after_update_path_for(resource)
my_page_path my_page_path
end end
def after_sign_in_path_for(resource)
stored_location_for(resource) || root_path
end
end end
...@@ -11,6 +11,7 @@ module ApplicationHelper ...@@ -11,6 +11,7 @@ module ApplicationHelper
flash_messages = [] flash_messages = []
flash.each do |type, message| flash.each do |type, message|
next if message.blank? next if message.blank?
message.delete!("'") if message.include?("'")
type = 'success' if type == 'notice' type = 'success' if type == 'notice'
type = 'error' if type == 'alert' type = 'error' if type == 'alert'
text = "<script>toastr.#{type}('#{message}');</script>" text = "<script>toastr.#{type}('#{message}');</script>"
...@@ -18,4 +19,10 @@ module ApplicationHelper ...@@ -18,4 +19,10 @@ module ApplicationHelper
end end
flash_messages.join("\n").html_safe flash_messages.join("\n").html_safe
end end
def render_errors(obj)
errors = []
obj.errors.full_messages.each { |mess| errors << "#{mess}<br>" }
flash[:error] = errors.join('<br>').html_safe
end
end end
# frozen_string_literal: true # frozen_string_literal: true
module ApplyJobHelper module ApplyJobHelper
def render_errors(obj)
errors = []
obj.errors.full_messages.each { |mess| errors << "#{mess}<br>" }
flash[:error] = errors.join('<br>').html_safe
end
end end
module FavoriteHelper
end
...@@ -4,4 +4,5 @@ ...@@ -4,4 +4,5 @@
class Favorite < ApplicationRecord class Favorite < ApplicationRecord
belongs_to :user belongs_to :user
belongs_to :job belongs_to :job
validates_uniqueness_of :user_id, scope: :job_id, message: I18n.t('favorite.liked')
end end
$('.block_link_favorite').bind('ajax:success', function() {
$(this).html("<%= j render 'job/link_destroy',favorite_id: @favorite.id %>");
change_number_of_favorite()
});
$('.btn_apply_job').bind('ajax:success', function() {
change_number_of_favorite()
$(this).html("<%= j render 'job/link_destroy_favorite_in_detail',favorite_id: @favorite.id %>")
});
function change_number_of_favorite() {
if (I18n.locale == 'vi') {
$('.number_favorite').text('('+<%=current_user.favorites.count%>+')' + ' Yêu thích' );
} else if (I18n.locale == 'en') {
$('.number_favorite').text('('+<%=current_user.favorites.count%>+')' + ' Favotite' );
}
}
$('.block_link_favorite').bind('ajax:success', function() {
$(this).html("<%= j render 'job/link_create',job_id: @favorite.job_id %>")
change_number_of_favorite()
});
$('.btn_apply_job').bind('ajax:success', function() {
$(this).html("<%= j render 'job/link_create_favorite_in_detail',job_id: @favorite.job_id %>")
change_number_of_favorite()
});
$('.con').bind('ajax:success', function() {
$(this).fadeOut('fast', 'swing');
change_number_of_favorite()
});
function change_number_of_favorite() {
if (I18n.locale == 'vi') {
$('.number_favorite').text('('+<%=current_user.favorites.count%>+')' + ' Yêu thích' );
} else if (I18n.locale == 'en') {
$('.number_favorite').text('('+<%=current_user.favorites.count%>+')' + ' Favotite' );
}
}
<div class="container">
<div class="box_my_page">
<div class="row">
<div class="col-lg-12">
<div class="box_my_page_header">
<h4><%= t('favorite.list') %></h4>
</div>
</div>
</div>
</div>
</div>
<div style="width: 100%; height: 150px"></div>
<% if @favorites.blank? %>
<div class="col-lg-12">
<div class="breadcrumb_total_search">
<span class="breadcrumb-item active">
<%= t('favorite.list_blank') %>
</span>
</div>
</div>
<div style="width: 100%; height: 55vh"></div>
<% else %>
<%= form_with url: apply_path, method: :get, local: true, skip_enforcing_utf8: true do |f| %>
<div class="container">
<div class="box_scroll">
<% @favorites.each do |item| %>
<%= render 'job/block_job_mini', data: item, form: f %>
<% end %>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="btn_apply_job in_favorite">
<%= f.submit t('pages.detail.btr_text_submit_cv'), name: nil, class: 'btn btn-apply_job in_favorite' %>
</div>
</div>
</div>
</div>
<% end %>
<% end %>
...@@ -3,16 +3,19 @@ ...@@ -3,16 +3,19 @@
<div class="col-sm-12"> <div class="col-sm-12">
<div class="box_jobs"> <div class="box_jobs">
<div class="col-sm-12 d-block d-sm-none"> <div class="col-sm-12 d-block d-sm-none">
<% if user_signed_in? %> <div class="link_favorite_top block_link_favorite md">
<div class="link_favorite_top block_link_favorite md"> <% if user_signed_in? %>
<span><%= link_to '<i class="far fa-heart"></i>'.html_safe, '#', class: 'link_favorite' %><span> <% favorite_id = current_user.favorites.find_by(job_id: data.id) %>
</div> <% if favorite_id.present? %>
<% else %> <%= render 'job/link_destroy', favorite_id: favorite_id %>
<div class="block_click_favorite link_favorite_top "> <% else %>
<span><i class="far fa-heart"></i><span> <%= render 'job/link_create', job_id: data.id %>
</div> <% end %>
<% end %> <% else %>
</div> <span class="link_favorite span_click_favorite"><i class="far fa-heart"></i></span>
<% end %>
</div>
</div>
<div class="row"> <div class="row">
<div class="col-sm-10 col-md-9 col-lg-10"> <div class="col-sm-10 col-md-9 col-lg-10">
<div class="box_info"> <div class="box_info">
...@@ -34,28 +37,21 @@ ...@@ -34,28 +37,21 @@
</div> </div>
</div> </div>
<div class="col-sm-2 col-md-3 d-none d-sm-block col-lg-2"> <div class="col-sm-2 col-md-3 d-none d-sm-block col-lg-2">
<% if user_signed_in? %> <div class="link_favorite_top block_link_favorite">
<div class="box_link_favotite"> <% if user_signed_in? %>
<div class="block_link_favorite lg"> <% favorite_id = current_user.favorites.find_by(job_id: data.id) %>
<span><i class="far fa-heart"></i> <%= link_to t('pages.index.btn_text_favorite'), '#', class: 'link_favorite' %><span> <% if favorite_id.present? %>
</div> <%= render 'job/link_destroy', favorite_id: favorite_id %>
<div class="block_link_favorite md"> <% else %>
<span><%= link_to '<i class="far fa-heart"></i>'.html_safe, '#', class: 'link_favorite' %><span> <%= render 'job/link_create', job_id: data.id %>
</div> <% end %>
</div> <% else %>
<% else %> <span class="link_favorite span_click_favorite"><i class="far fa-heart"></i></span>
<div class="box_link_favotite"> <% end %>
<div class="block_click_favorite lg"> </div>
<span><i class="far fa-heart"></i> <%= t('pages.index.btn_text_favorite') %><span>
</div>
<div class="block_click_favorite md">
<span><i class="far fa-heart"></i><span>
</div>
</div>
<% end %>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
\ No newline at end of file
<div class="con">
<div class="container">
<div class="row">
<div class="col-sm-12">
<div class="box_jobs mini">
<div class="row">
<div class="d-none d-lg-block col-lg-1">
<div class="box_radio">
<%= form.radio_button(:job_id, data.id) %>
</div>
</div>
<div class="col-lg-10 col-md-11 col-sm-11">
<div class="box_info">
<div class="lol">
<%= link_to data.name, detail_job_path(id: data.id), class: 'job_name' %>
</div>
<div class="cop">
<h5 class="box_info_copany_name"><i class="far fa-building"></i> <%= data.company.name %></h5>
</div>
<div class="loc">
<h5 class="box_info_location"><i class="fas fa-map-marker-alt"></i>
<%= data.cities.map(&:name).join(' | ') %>
</h5>
</div>
<h5 class="box_info_salary"><i class="fas fa-dollar-sign"></i>&nbsp;<%= "#{t('pages.index.salary')}: #{data.salary}" %></h5>
<div class="coc">
<h5 class="box_info_des"><%= strip_tags(data.description) %></h5>
</div>
</div>
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<%= link_to '<i class="fas fa-trash"></i>'.html_safe, favorite_path(data.favorites.ids), method: :delete, remote: true, class: 'link_favorite in_block' %>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<%= link_to '<i class="far fa-heart"></i>'.html_safe, favorite_index_path(job_id: job_id), method: :post, remote: true, class: 'link_favorite' %>
<%= link_to t('pages.index.btn_text_favorite'), favorite_index_path(job_id: job_id), method: :post, remote: true, class: 'btn btn-apply_job_favorite' %>
<%= link_to '<i class="fas fa-heart"></i>'.html_safe, favorite_path(favorite_id), method: :delete, remote: true, class: 'link_favorite' %>
<%= link_to t('pages.index.unfavorite'), favorite_path(favorite_id), method: :delete, remote: true, class: 'btn btn-apply_job_favorite unfavorite' %>
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
<div class="col-lg 12"> <div class="col-lg 12">
<div class="modal_login_notice_text"> <div class="modal_login_notice_text">
<span><%= t('pages.confirm.modal_login').downcase.capitalize %></span><br> <span><%= t('pages.confirm.modal_login').downcase.capitalize %></span><br>
<span><b><%= link_to t('devise.title_signin'), new_user_session_path, class: 'link_ct' %></b></span> <span><b><%= link_to t('devise.title_signin'), new_user_session_path, class: 'link_ct' %></b></span> |
<span><b><%= link_to t('pages.index.register'), new_user_registration_path, class: 'link_ct' %></b></span>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -97,7 +97,12 @@ ...@@ -97,7 +97,12 @@
</div> </div>
<div class="col-lg-6 col-md-6"> <div class="col-lg-6 col-md-6">
<div class="btn_apply_job"> <div class="btn_apply_job">
<%= link_to t('pages.index.btn_text_favorite'), '#', class: 'btn btn-apply_job_favorite' %> <% favorite_id = current_user.favorites.find_by(job_id: @job.id).try(:id) if user_signed_in? %>
<% if favorite_id.blank? %>
<%= render 'link_create_favorite_in_detail', job_id: @job.id %>
<% else %>
<%= render 'link_destroy_favorite_in_detail', favorite_id: favorite_id %>
<% end %>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -10,7 +10,9 @@ ...@@ -10,7 +10,9 @@
<div class="header_top_menu_right"> <div class="header_top_menu_right">
<ul class="list_menu_header_right"> <ul class="list_menu_header_right">
<li class="list_item_menu_header_right"> <li class="list_item_menu_header_right">
<%= link_to t('pages.index.favorite'), '#', class: 'link_item_menu_header_right' %> <%= link_to_if(!user_signed_in?, t('pages.index.favorite'), favorite_index_path, class: 'link_item_menu_header_right number_favorite') do
link_to "(#{current_user.favorites.count}) #{t('pages.index.favorite')}", favorite_index_path, class: 'link_item_menu_header_right'
end %>
</li> </li>
<li class="list_item_menu_header_right"> <li class="list_item_menu_header_right">
<%= link_to t('pages.index.history'), '#', class: 'link_item_menu_header_right' %> <%= link_to t('pages.index.history'), '#', class: 'link_item_menu_header_right' %>
...@@ -53,7 +55,9 @@ ...@@ -53,7 +55,9 @@
<div class = "menu_mobile_vertical"> <div class = "menu_mobile_vertical">
<ul class = "list_menu_mobile_vertical"> <ul class = "list_menu_mobile_vertical">
<li class = "item_menu_mobile_vertical"> <li class = "item_menu_mobile_vertical">
<%= link_to t('pages.index.favorite'), '#', class: 'link_item_menu_mobile' %> <%= link_to_if(!user_signed_in?, t('pages.index.favorite'), favorite_index_path, class: 'link_item_menu_mobile') do
link_to "(#{current_user.favorites.count}) #{t('pages.index.favorite')}", favorite_index_path, class: 'link_item_menu_mobile number_favorite'
end %>
</li> </li>
<li class = "item_menu_mobile_vertical"> <li class = "item_menu_mobile_vertical">
<%= link_to t('pages.index.history'), '#', class: 'link_item_menu_mobile' %> <%= link_to t('pages.index.history'), '#', class: 'link_item_menu_mobile' %>
......
...@@ -8,7 +8,11 @@ ...@@ -8,7 +8,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= render 'shared/shim' %> <%= render 'shared/shim' %>
<script type="text/javascript">
I18n.defaultLocale = "<%= I18n.default_locale %>";
I18n.locale = "<%= I18n.locale %>";
</script>
</head> </head>
<body> <body>
......
...@@ -15,21 +15,22 @@ ...@@ -15,21 +15,22 @@
linear-gradient(to bottom, rgba(112, 112, 112, 0.486), rgba(112, 112, 112, 0.486)); linear-gradient(to bottom, rgba(112, 112, 112, 0.486), rgba(112, 112, 112, 0.486));
} }
.content { .content {
position: absolute; position: relative;
top: 50%; top: 50%;
left: 50%; margin: auto;
width: 60px; width: 75px;
height: 60px; height: 75px;
border-radius: 50%; border-radius: 50%;
border: 4px solid #f3f3f3c0; border: 4px solid #d2d2d2;
border-left: 4px solid rgb(219, 37, 13); border-left: 4px solid rgb(253, 30, 0);
border-right: 4px solid rgb(219, 37, 13); border-right: 4px solid rgb(253, 30, 0);
transform: translateX(-50%) translateY(-50%); transform: translateX(-50%) translateY(-50%);
-webkit-animation: spin 2s linear infinite; -webkit-animation: spin 2s linear infinite;
animation: spin 2s linear infinite; animation: spin 2s linear infinite;
} }
@-webkit-keyframes spin { @-webkit-keyframes spin {
0% { -webkit-transform: rotate(0deg); } 0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(360deg); } 100% { -webkit-transform: rotate(360deg); }
...@@ -39,8 +40,9 @@ ...@@ -39,8 +40,9 @@
0% { transform: rotate(0deg); } 0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); } 100% { transform: rotate(360deg); }
} }
</style> </style>
<div class="box_loading"> <div class="box_loading">
<div class="content"></div> <div class="small_content content"></div>
</div> </div>
...@@ -17,6 +17,7 @@ module Venjob ...@@ -17,6 +17,7 @@ module Venjob
config.i18n.available_locales = [:en, :vi] config.i18n.available_locales = [:en, :vi]
config.i18n.default_locale = :en config.i18n.default_locale = :en
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')] config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]
# Settings in config/environments/* take precedence over those specified here. # Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers # Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading # -- all .rb files in that directory are automatically loaded after loading
......
# Split context in several files.
#
# By default only one file with all translations is exported and
# no configuration is required. Your settings for asset pipeline
# are automatically recognized.
#
# If you want to split translations into several files or specify
# locale contexts that will be exported, just use this file to do
# so.
#
# For more informations about the export options with this file, please
# refer to the README
#
#
# If you're going to use the Rails 3.1 asset pipeline, change
# the following configuration to something like this:
#
translations:
- file: 'public/javascripts/en.js'
only: 'en.*'
- file: 'public/javascripts/vn.js'
only: 'vn.*'
#
# If you're running an old version, you can use something
# like this:
#
# translations:
# - file: "app/assets/javascripts/i18n/translations.js"
# only: "*"
...@@ -25,7 +25,7 @@ Devise.setup do |config| ...@@ -25,7 +25,7 @@ Devise.setup do |config|
# note that it will be overwritten if you use your own mailer class # note that it will be overwritten if you use your own mailer class
# with default "from" parameter. # with default "from" parameter.
config.mailer_sender = 'Hung-nt' config.mailer_sender = 'Hung-nt'
config.scoped_views = true
# Configure the class responsible to send e-mails. # Configure the class responsible to send e-mails.
# config.mailer = 'Devise::Mailer' # config.mailer = 'Devise::Mailer'
...@@ -82,8 +82,7 @@ Devise.setup do |config| ...@@ -82,8 +82,7 @@ Devise.setup do |config|
# config.http_authenticatable = false # config.http_authenticatable = false
# If 401 status code should be returned for AJAX requests. True by default. # If 401 status code should be returned for AJAX requests. True by default.
# config.http_authenticatable_on_xhr = true config.http_authenticatable_on_xhr = false
# The realm used in Http Basic Authentication. 'Application' by default. # The realm used in Http Basic Authentication. 'Application' by default.
# config.http_authentication_realm = 'Application' # config.http_authentication_realm = 'Application'
...@@ -244,7 +243,7 @@ Devise.setup do |config| ...@@ -244,7 +243,7 @@ Devise.setup do |config|
# Turn scoped views on. Before rendering "sessions/new", it will first check for # Turn scoped views on. Before rendering "sessions/new", it will first check for
# "users/sessions/new". It's turned off by default because it's slower if you # "users/sessions/new". It's turned off by default because it's slower if you
# are using only default views. # are using only default views.
# config.scoped_views = false config.scoped_views = false
# Configure the default scope given to Warden. By default it's the first # Configure the default scope given to Warden. By default it's the first
# devise role declared in your routes (usually :user). # devise role declared in your routes (usually :user).
...@@ -263,7 +262,7 @@ Devise.setup do |config| ...@@ -263,7 +262,7 @@ Devise.setup do |config|
# should add them to the navigational formats lists. # should add them to the navigational formats lists.
# #
# The "*/*" below is required to match Internet Explorer requests. # The "*/*" below is required to match Internet Explorer requests.
# config.navigational_formats = ['*/*', :html] config.navigational_formats = ["*/*", :html, :js]
# The default HTTP method used to sign out a resource. Default is :delete. # The default HTTP method used to sign out a resource. Default is :delete.
config.sign_out_via = :delete config.sign_out_via = :delete
......
...@@ -11,6 +11,7 @@ en: ...@@ -11,6 +11,7 @@ en:
pages: pages:
index: index:
favorite: 'Favorite' favorite: 'Favorite'
unfavorite: 'Unfavorite'
history: 'History' history: 'History'
signin: 'Sign in' signin: 'Sign in'
register: 'Register' register: 'Register'
...@@ -132,7 +133,13 @@ en: ...@@ -132,7 +133,13 @@ en:
title: 'List Applied Jobs' title: 'List Applied Jobs'
no_record: "You haven't applied yet." no_record: "You haven't applied yet."
already_taken: 'We have received your resume, the employer will contact you as soon as possible.' already_taken: 'We have received your resume, the employer will contact you as soon as possible.'
favorite:
liked: 'You have added job to favorites'
list: 'List of jobs you liked'
list_blank: 'You do not have a favorite job!'
activerecord: activerecord:
attributes: attributes:
applied_job: applied_job:
user_id: '' user_id: ''
favorite:
user_id: ''
...@@ -11,6 +11,7 @@ vi: ...@@ -11,6 +11,7 @@ vi:
pages: pages:
index: index:
favorite: 'Yêu thích' favorite: 'Yêu thích'
unfavorite: 'Không thích nữa'
history: 'Lịch sử' history: 'Lịch sử'
signin: 'Đăng nhập' signin: 'Đăng nhập'
register: 'Đăng ký' register: 'Đăng ký'
...@@ -132,8 +133,14 @@ vi: ...@@ -132,8 +133,14 @@ vi:
title: 'Danh sách công việc đã ứng tuyển' title: 'Danh sách công việc đã ứng tuyển'
no_record: 'Bạn chưa ứng tuyển công việc nào hết.' no_record: 'Bạn chưa ứng tuyển công việc nào hết.'
already_taken: 'Chúng tôi đã tiếp nhận hồ của bạn, nhà tuyển dụng sẽ liên hệ đến bạn trong thời gian sớm nhất.' already_taken: 'Chúng tôi đã tiếp nhận hồ của bạn, nhà tuyển dụng sẽ liên hệ đến bạn trong thời gian sớm nhất.'
favorite:
liked: 'Bạn đã thêm công việc vào yêu thích.'
list: 'Danh sách công việc bạn đã thích'
list_blank: 'Bạn chưa công việc yêu thích!'
activerecord: activerecord:
attributes: attributes:
applied_job: applied_job:
user_id: '' user_id: ''
favorite:
user_id: ''
\ No newline at end of file
...@@ -14,6 +14,8 @@ Rails.application.routes.draw do ...@@ -14,6 +14,8 @@ Rails.application.routes.draw do
post 'confirm', to: 'apply_job#confirm', as: :confirm post 'confirm', to: 'apply_job#confirm', as: :confirm
post 'done', to: 'apply_job#done', as: :done post 'done', to: 'apply_job#done', as: :done
get 'my/jobs', to: 'apply_job#index', as: :list_applied_jobs get 'my/jobs', to: 'apply_job#index', as: :list_applied_jobs
# Fovorite
resources :favorite, only: %i[index create destroy]
# Details job # Details job
get 'detail/:id', to: 'job#detail', as: :detail_job get 'detail/:id', to: 'job#detail', as: :detail_job
# Search # Search
......
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