Commit e17efe61 by Ngô Trung Hưng

apply job in list favorited

parent d0f4baff
Pipeline #980 canceled with stages
in 0 seconds
$(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');
}); });
......
...@@ -103,12 +103,9 @@ ...@@ -103,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;
...@@ -117,8 +114,10 @@ ...@@ -117,8 +114,10 @@
font-weight: 600; font-weight: 600;
font-family: 'Raleway', sans-serif; font-family: 'Raleway', sans-serif;
} }
@media only screen and (max-width: 992px) { @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) {
...@@ -160,6 +159,7 @@ ...@@ -160,6 +159,7 @@
} }
.btn-info-custom { .btn-info-custom {
margin-bottom: 10px;
width: 100% !important; width: 100% !important;
} }
.btn-custom-padding { .btn-custom-padding {
......
...@@ -13,14 +13,13 @@ ...@@ -13,14 +13,13 @@
margin: auto; margin: auto;
position: relative; position: relative;
top: 50%; top: 50%;
left: 80%; left: 50%;
transform: translateY(-50%); transform: translateY(-50%);
} }
.radio_id { .radio_id {
position: relative; position: relative;
z-index: 999999999999; z-index: 999999999999;
top: 50px; // top: 50px;
} }
[type="radio"] { [type="radio"] {
cursor: pointer; cursor: pointer;
...@@ -33,9 +32,17 @@ ...@@ -33,9 +32,17 @@
transition: ease-in 0.3s; 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) { @media only screen and (max-width: 992px) {
.container { .container {
.btn_apply_job { .btn_apply_job.in_favorite {
display: none; display: none;
} }
} }
......
...@@ -6,7 +6,6 @@ class ApplicationController < ActionController::Base ...@@ -6,7 +6,6 @@ class ApplicationController < ActionController::Base
before_action :configure_permitted_parameters, if: :devise_controller? before_action :configure_permitted_parameters, if: :devise_controller?
before_action :set_locale before_action :set_locale
before_action :store_user_location!, if: :storable_location?
def set_locale def set_locale
locale = (user_signed_in? ? current_user.language : params[:locale].to_s.strip).to_sym locale = (user_signed_in? ? current_user.language : params[:locale].to_s.strip).to_sym
...@@ -17,31 +16,10 @@ class ApplicationController < ActionController::Base ...@@ -17,31 +16,10 @@ class ApplicationController < ActionController::Base
{ locale: I18n.locale } { locale: I18n.locale }
end end
def authenticate_user!
return redirect_to new_user_session_path unless user_signed_in?
super
end
protected protected
def configure_permitted_parameters def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up) { |u| u.permit(:name, :email, :cv, :password) } devise_parameter_sanitizer.permit(:sign_up) { |u| u.permit(:name, :email, :cv, :password) }
devise_parameter_sanitizer.permit(:account_update) { |u| u.permit(:name, :email, :cv, :password, :current_password) } devise_parameter_sanitizer.permit(:account_update) { |u| u.permit(:name, :email, :cv, :password, :current_password) }
end end
private
# Its important that the location is NOT stored if:
# - The request method is not GET (non idempotent)
# - The request is handled by a Devise controller such as Devise::SessionsController as that could cause an
# infinite redirect loop.
# - The request is an Ajax request as this can lead to very unexpected behaviour.
def storable_location?
request.get? && is_navigational_format? && !devise_controller? && !request.xhr?
end
def store_user_location!
# :user is the scope we are authenticating
store_location_for(:user, request.fullpath)
end
end end
...@@ -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])
......
...@@ -13,14 +13,14 @@ class FavoriteController < ApplicationController ...@@ -13,14 +13,14 @@ class FavoriteController < ApplicationController
@favorite = current_user.favorites.new(job_id: params[:job_id]) @favorite = current_user.favorites.new(job_id: params[:job_id])
if @favorite.invalid? if @favorite.invalid?
helpers.render_errors(@favorite) helpers.render_errors(@favorite)
redirect_to root_path redirect_to favorite_index_path
end end
respond_to :js if @favorite.save respond_to :js if @favorite.save
end end
def destroy def destroy
@favorite = current_user.favorites.find_by(id: params[:favorite_id]) @favorite = current_user.favorites.find_by(id: params[:favorite_id])
return redirect_to root_path if @favorite.blank? return redirect_to favorite_index_path if @favorite.blank?
respond_to :js if @favorite.destroy respond_to :js if @favorite.destroy
end end
......
# frozen_string_literal: true
class SessionsController < Devise::SessionsController
# before_action :configure_sign_in_params, only: [:create]
# GET /resource/sign_in
# def new
# super
# end
# POST /resource/sign_in
def create
self.resource = warden.authenticate!(auth_options)
set_flash_message!(:notice, :signed_in)
sign_in(resource_name, resource)
yield resource if block_given?
respond_with resource, location: stored_location_for(resource) || root_path
end
# DELETE /resource/sign_out
# def destroy
# super
# end
# protected
# If you have extra params to permit, append them to the sanitizer.
# def configure_sign_in_params
# devise_parameter_sanitizer.permit(:sign_in, keys: [:attribute])
# end
end
...@@ -20,20 +20,19 @@ ...@@ -20,20 +20,19 @@
</div> </div>
<div style="width: 100%; height: 55vh"></div> <div style="width: 100%; height: 55vh"></div>
<% else %> <% else %>
<div class="container"> <%= form_with url: apply_path, method: :get, local: true, skip_enforcing_utf8: true do |f| %>
<%= form_with url: apply_path, method: :get, local: true do |f| %> <div class="container">
<div class="box_scroll"> <div class="box_scroll">
<%= f.collection_radio_buttons :job_id, @favorites, :id, :id do |radio| %> <% @favorites.each do |item| %>
<%= radio.radio_button(class: 'radio_id') %> <%= render 'job/block_job_mini', data: item, form: f %>
<%= render 'job/block_job_mini', data: radio.object %>
<% end %> <% end %>
</div> </div>
</div> </div>
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<div class="btn_apply_job"> <div class="btn_apply_job in_favorite">
<%= f.submit t('pages.detail.btr_text_submit_cv'), class: 'btn btn-apply_job' %> <%= f.submit t('pages.detail.btr_text_submit_cv'), name: nil, class: 'btn btn-apply_job in_favorite' %>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<div class="box_text_five_jobs"> <div class="box_text_five_jobs">
<span><%= t('pages.index.lasted_job') %></span> <span><%= t('pages.index.lasted_job') %></span>
</div> </div>
<%= render 'job/modal_login' %>
<%= render partial: 'job/block_info_job', collection: @lasted_jobs, as: :data %> <%= render partial: 'job/block_info_job', collection: @lasted_jobs, as: :data %>
<%= render 'box_nine_city' %> <%= render 'box_nine_city' %>
<%= render 'box_nine_industries' %> <%= render 'box_nine_industries' %>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<%= render 'job/link_create', job_id: data.id %> <%= render 'job/link_create', job_id: data.id %>
<% end %> <% end %>
<% else %> <% else %>
<%= render 'job/link_create', job_id: data.id %> <span class="link_favorite span_click_favorite"><i class="far fa-heart"></i></span>
<% end %> <% end %>
</div> </div>
</div> </div>
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
<%= render 'job/link_create', job_id: data.id %> <%= render 'job/link_create', job_id: data.id %>
<% end %> <% end %>
<% else %> <% else %>
<%= render 'job/link_create', job_id: data.id %> <span class="link_favorite span_click_favorite"><i class="far fa-heart"></i></span>
<% end %> <% end %>
</div> </div>
</div> </div>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<div class="row"> <div class="row">
<div class="d-none d-lg-block col-lg-1"> <div class="d-none d-lg-block col-lg-1">
<div class="box_radio"> <div class="box_radio">
<%= form.radio_button(:job_id, data.id) %>
</div> </div>
</div> </div>
<div class="col-lg-10 col-md-11 col-sm-11"> <div class="col-lg-10 col-md-11 col-sm-11">
...@@ -34,5 +35,5 @@ ...@@ -34,5 +35,5 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
...@@ -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>
......
...@@ -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: 48%; 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,18 +40,9 @@ ...@@ -39,18 +40,9 @@
0% { transform: rotate(0deg); } 0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); } 100% { transform: rotate(360deg); }
} }
@media only screen and (max-width: 768px) {
.content {
left: 47% !important;
}
}
@media only screen and (max-width: 576px) {
.content {
left: 44% !important;
}
}
</style> </style>
<div class="box_loading"> <div class="box_loading">
<div class="content"></div> <div class="small_content content"></div>
</div> </div>
...@@ -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'
...@@ -243,7 +243,7 @@ Devise.setup do |config| ...@@ -243,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).
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
Rails.application.routes.draw do Rails.application.routes.draw do
get 'setting', to: 'users#set_lang', as: :set_lang get 'setting', to: 'users#set_lang', as: :set_lang
scope '(:locale)', locale: /en|vi/ do scope '(:locale)', locale: /en|vi/ do
devise_for :users, controllers: { sessions: 'sessions', registrations: 'registrations' } devise_for :users, controllers: { registrations: 'registrations' }
root 'home#index' root 'home#index'
get 'register/:code', to: 'users#confirm_sign_up', as: :confirm_sign_up get 'register/:code', to: 'users#confirm_sign_up', as: :confirm_sign_up
......
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