Commit c4606e43 by Thanh Hung Pham

Fix log in to admin page

parent b0a93a6e
$(function() {
$(".alert" ).fadeOut(3000);
$( ".favorite_add" ).on( "click", function() {
$.ajax({
url: "/jobs/favorite",
......
......@@ -11,4 +11,17 @@ class ApplicationController < ActionController::Base
def after_sign_out_path_for(resource)
request.referrer || root_path
end
def after_sign_in_path_for(resource)
if admin_signed_in?
admins_applies_path
else
stored_location_for(resource) ||
if resource.is_a?(User) && resource.can_publish?
publisher_url
else
super
end
end
end
end
......@@ -5,6 +5,7 @@ class Job < ApplicationRecord
belongs_to :contact, optional: true
has_many :job_category
has_many :applies
paginates_per 20
......
......@@ -4,7 +4,6 @@
<nav>
<ul class="nav navbar-nav navbar-right">
<%- if admin_signed_in? -%>
<li> <%= link_to 'Applied Jobs', admins_applies_path %> </li>
<li> <%= link_to 'Log out', destroy_admin_session_path, method: :delete %> </li>
<%- else -%>
<%- if user_signed_in? -%>
......
......@@ -23,6 +23,7 @@ Rails.application.routes.draw do
get 'jobs/history_jobs', to: 'jobs#history_jobs'
get 'admins/applies', to: 'admins#applies'
get 'admins/search', to: 'admins#search'
post 'admins/search', to: 'admins#search'
resource :cities
......
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