Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VeNJOB
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nguyen Ngoc Nghia
VeNJOB
Commits
71dc2fcf
Commit
71dc2fcf
authored
Mar 05, 2020
by
nnnghia98
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change route
parent
d927cd18
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
5 additions
and
5 deletions
+5
-5
app/controllers/admins_controller.rb
+2
-2
app/models/user.rb
+1
-1
app/views/admins/_applied_job.html.erb
+0
-0
app/views/admins/index.html.erb
+1
-1
config/routes.rb
+1
-1
No files found.
app/controllers/
users/
admins_controller.rb
→
app/controllers/admins_controller.rb
View file @
71dc2fcf
class
Users
::
AdminsController
<
ApplicationController
class
AdminsController
<
ApplicationController
before_action
:authenticate_user!
,
only: :index
before_action
:authenticate_user!
,
only: :index
def
index
def
index
...
@@ -14,7 +14,7 @@ class Users::AdminsController < ApplicationController
...
@@ -14,7 +14,7 @@ class Users::AdminsController < ApplicationController
def
get_applied_jobs
def
get_applied_jobs
if
params
[
:search_user
]
if
params
[
:search_user
]
user
=
User
.
find_by
(
email:
params
[
:search_user
])
user
=
User
.
find_by
(
email:
params
[
:search_user
])
return
redirect_to
users_
admin_path
,
notice:
"User/job not found!"
if
user
.
blank?
return
redirect_to
admin_path
,
notice:
"User/job not found!"
if
user
.
blank?
applied_jobs
=
user
.
jobs
applied_jobs
=
user
.
jobs
applied_jobs
.
page
(
params
[
:page
]).
per
(
Settings
.
job
.
per_page
)
applied_jobs
.
page
(
params
[
:page
]).
per
(
Settings
.
job
.
per_page
)
...
...
app/models/user.rb
View file @
71dc2fcf
...
@@ -37,6 +37,6 @@ class User < ApplicationRecord
...
@@ -37,6 +37,6 @@ class User < ApplicationRecord
:recoverable
,
:rememberable
,
:validatable
:recoverable
,
:rememberable
,
:validatable
def
self
.
list_emails
def
self
.
list_emails
@emails
||=
self
.
all
.
pluck
(
:email
)
@emails
||=
all
.
pluck
(
:email
)
end
end
end
end
app/views/
users/
admins/_applied_job.html.erb
→
app/views/admins/_applied_job.html.erb
View file @
71dc2fcf
File moved
app/views/
users/
admins/index.html.erb
→
app/views/admins/index.html.erb
View file @
71dc2fcf
<h4>
Search user's applied jobs:
</h4>
<h4>
Search user's applied jobs:
</h4>
<%=
form_tag
(
users_
admin_path
,
method: :get
)
do
|
f
|
%>
<%=
form_tag
(
admin_path
,
method: :get
)
do
|
f
|
%>
<%=
select_tag
:search_user
,
options_for_select
(
User
.
list_emails
,
params
[
:search_user
]),
include_blank:
"Choose user's email"
%>
<%=
select_tag
:search_user
,
options_for_select
(
User
.
list_emails
,
params
[
:search_user
]),
include_blank:
"Choose user's email"
%>
<%=
submit_tag
"Search"
%>
<%=
submit_tag
"Search"
%>
<%
end
%>
<%
end
%>
...
...
config/routes.rb
View file @
71dc2fcf
...
@@ -14,11 +14,11 @@ Rails.application.routes.draw do
...
@@ -14,11 +14,11 @@ Rails.application.routes.draw do
devise_for
:users
devise_for
:users
root
"tops#index"
root
"tops#index"
namespace
:users
do
namespace
:users
do
get
"admin"
,
to:
"admins#index"
,
as: :admin
resource
:my_page
,
only: :show
do
resource
:my_page
,
only: :show
do
collection
do
collection
do
get
"jobs"
,
action: :applied_jobs
,
as: :applied_jobs
get
"jobs"
,
action: :applied_jobs
,
as: :applied_jobs
end
end
end
end
end
end
get
"admin"
,
to:
"admins#index"
,
as: :admin
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment