Commit 58b92a21 by Ngô Trung Hưng

optimaze code

parent cd393a68
Pipeline #1121 failed with stages
in 0 seconds
...@@ -32,3 +32,4 @@ ...@@ -32,3 +32,4 @@
config/settings.local.yml config/settings.local.yml
config/settings/*.local.yml config/settings/*.local.yml
config/environments/*.local.yml config/environments/*.local.yml
dump.rdb
...@@ -116,3 +116,20 @@ ...@@ -116,3 +116,20 @@
padding-top: 60px; padding-top: 60px;
} }
} }
.box_menu_admin {
margin-top: 30px;
}
.btn-col-6 {
width: 100%;
padding: 10px 20px;
background-color: rgb(43, 131, 185);
color: #fff;
font-weight: bold;
border-radius: 6px;
&:hover {
background-color: rgb(175, 214, 238);
color: rgb(0, 0, 0);
text-decoration: none;
}
}
\ No newline at end of file
...@@ -7,20 +7,15 @@ class Admin::AdminController < ApplicationController ...@@ -7,20 +7,15 @@ class Admin::AdminController < ApplicationController
before_action :load_data_dropdown before_action :load_data_dropdown
include InitApply include InitApply
# user input in url 'localhost:3000/admin' if admin signed redirect to applies page else admin login page def index
def routing
return redirect_to new_admin_session_path unless admin_signed_in?
redirect_to applies_index_path
end end
def index def show_applied
@applied = AppliedJob.includes(:job).all_result.page(params[:page]).per(6) @applied = AppliedJob.includes(:job).all_result.page(params[:page]).per(6)
@apply = apply @apply = apply
end end
def search def search
return redirect_to applies_index_path if params[:apply].blank? return redirect_to applies_index_path if params[:apply].blank?
return export_csv(result_for(params[:apply])) if params[:export_csv].present? return export_csv(result_for(params[:apply])) if params[:export_csv].present?
...@@ -30,7 +25,7 @@ class Admin::AdminController < ApplicationController ...@@ -30,7 +25,7 @@ class Admin::AdminController < ApplicationController
@industry_id = params[:apply][:industry_id] @industry_id = params[:apply][:industry_id]
@params_date = params[:apply] @params_date = params[:apply]
@apply = apply @apply = apply
render :index render :show_applied
end end
def load_data_dropdown def load_data_dropdown
......
...@@ -17,7 +17,7 @@ class ApplicationController < ActionController::Base ...@@ -17,7 +17,7 @@ class ApplicationController < ActionController::Base
end end
def after_sign_in_path_for(resource) def after_sign_in_path_for(resource)
return applies_path if resource.model_name == Admin.name return admin_path if resource.model_name == Admin.name
stored_location_for(resource) || root_path stored_location_for(resource) || root_path
end end
......
<% provide(:title, 'Admin') %> <div class="container">
<%= render 'box_filter' %> <div class="box_menu_admin">
<%= render 'shared/scroll_top' %> <h2>Menu Admin</h2><hr>
<%= render 'box_result_applied' %> <div class="row">
<div class="col-lg-6">
<%= link_to "Danh sách ứng tuyển", applies_index_path, class: 'btn-col-6' %>
</div>
<div class="col-lg-6">
<%= link_to "Cài đặt", settings_path, class: 'btn-col-6' %>
</div>
</div>
</div>
</div>
<% provide(:title, 'Admin') %>
<%= render 'box_filter' %>
<%= render 'shared/scroll_top' %>
<%= render 'box_result_applied' %>
...@@ -9,9 +9,9 @@ Rails.application.routes.draw do ...@@ -9,9 +9,9 @@ Rails.application.routes.draw do
get 'admin/setting', to: 'admin/settings#index', as: :settings get 'admin/setting', to: 'admin/settings#index', as: :settings
post 'admin/setting/cronjob/:code_cron/:code_action', to: 'admin/settings#cron_implement', as: :settings_cron post 'admin/setting/cronjob/:code_cron/:code_action', to: 'admin/settings#cron_implement', as: :settings_cron
get 'admin', to: 'admin/admin#index', as: :admin
get 'admin/search', to: 'admin/admin#search', as: :applies get 'admin/search', to: 'admin/admin#search', as: :applies
get 'admin/applies', to: 'admin/admin#index', as: :applies_index get 'admin/applies', to: 'admin/admin#show_applied', as: :applies_index
get 'admin', to: 'admin/admin#routing', as: :admin
get 'info/user/:user_id', to: 'users#personal_page', as: :personal_page get 'info/user/:user_id', to: 'users#personal_page', as: :personal_page
......
No preview for this file type
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