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
55f7c946
Commit
55f7c946
authored
Mar 04, 2020
by
nnnghia98
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring code
parent
7b646fb6
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
133 additions
and
134 deletions
+133
-134
Gemfile
+0
-1
Gemfile.lock
+113
-106
app/controllers/users/admins_controller.rb
+9
-20
app/helpers/job_helper.rb
+6
-2
app/views/users/admins/_applied_job.html.erb
+3
-3
app/views/users/admins/index.html.erb
+2
-2
yarn.lock
+0
-0
No files found.
Gemfile
View file @
55f7c946
...
...
@@ -27,7 +27,6 @@ gem 'config'
gem
'
draper
'
gem
'
rsolr
'
gem
'
rsolr-ext
'
gem
'
pry
'
gem
'
nokogiri
'
# Use Redis adapter to run Action Cable in production
# gem '
redis
', '~> 4.0'
...
...
Gemfile.lock
View file @
55f7c946
GEM
remote: https://rubygems.org/
specs:
actioncable (6.0.1)
actionpack (= 6.0.1)
actioncable (6.0.
2.
1)
actionpack (= 6.0.
2.
1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.0.1)
actionpack (= 6.0.1)
activejob (= 6.0.1)
activerecord (= 6.0.1)
activestorage (= 6.0.1)
activesupport (= 6.0.1)
actionmailbox (6.0.
2.
1)
actionpack (= 6.0.
2.
1)
activejob (= 6.0.
2.
1)
activerecord (= 6.0.
2.
1)
activestorage (= 6.0.
2.
1)
activesupport (= 6.0.
2.
1)
mail (>= 2.7.1)
actionmailer (6.0.1)
actionpack (= 6.0.1)
actionview (= 6.0.1)
activejob (= 6.0.1)
actionmailer (6.0.
2.
1)
actionpack (= 6.0.
2.
1)
actionview (= 6.0.
2.
1)
activejob (= 6.0.
2.
1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.0.1)
actionview (= 6.0.1)
activesupport (= 6.0.1)
rack (~> 2.0)
actionpack (6.0.
2.
1)
actionview (= 6.0.
2.
1)
activesupport (= 6.0.
2.
1)
rack (~> 2.0
, >= 2.0.8
)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.1)
actionpack (= 6.0.1)
activerecord (= 6.0.1)
activestorage (= 6.0.1)
activesupport (= 6.0.1)
actiontext (6.0.
2.
1)
actionpack (= 6.0.
2.
1)
activerecord (= 6.0.
2.
1)
activestorage (= 6.0.
2.
1)
activesupport (= 6.0.
2.
1)
nokogiri (>= 1.8.5)
actionview (6.0.1)
activesupport (= 6.0.1)
actionview (6.0.
2.
1)
activesupport (= 6.0.
2.
1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.0.1)
activesupport (= 6.0.1)
activejob (6.0.
2.
1)
activesupport (= 6.0.
2.
1)
globalid (>= 0.3.6)
activemodel (6.0.1)
activesupport (= 6.0.1)
activemodel (6.0.
2.
1)
activesupport (= 6.0.
2.
1)
activemodel-serializers-xml (1.0.2)
activemodel (> 5.x)
activesupport (> 5.x)
builder (~> 3.1)
activerecord (6.0.1)
activemodel (= 6.0.1)
activesupport (= 6.0.1)
activerecord-import (1.0.
3
)
activerecord (6.0.
2.
1)
activemodel (= 6.0.
2.
1)
activesupport (= 6.0.
2.
1)
activerecord-import (1.0.
4
)
activerecord (>= 3.2)
activestorage (6.0.1)
actionpack (= 6.0.1)
activejob (= 6.0.1)
activerecord (= 6.0.1)
activestorage (6.0.
2.
1)
actionpack (= 6.0.
2.
1)
activejob (= 6.0.
2.
1)
activerecord (= 6.0.
2.
1)
marcel (~> 0.3.1)
activesupport (6.0.1)
activesupport (6.0.
2.
1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
...
...
@@ -64,16 +64,16 @@ GEM
zeitwerk (~> 2.2)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
annotate (3.
0.3
)
annotate (3.
1.0
)
activerecord (>= 3.2, < 7.0)
rake (>= 10.4, < 14.0)
bcrypt (3.1.13)
bindex (0.8.1)
bootsnap (1.4.
5
)
bootsnap (1.4.
6
)
msgpack (~> 1.0)
builder (3.2.
3
)
byebug (11.
0
.1)
capybara (3.
29
.0)
builder (3.2.
4
)
byebug (11.
1
.1)
capybara (3.
31
.0)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
...
...
@@ -81,7 +81,7 @@ GEM
rack-test (>= 0.6.3)
regexp_parser (~> 1.5)
xpath (~> 3.2)
carrierwave (2.
0.2
)
carrierwave (2.
1.0
)
activemodel (>= 5.0.0)
activesupport (>= 5.0.0)
addressable (~> 2.6)
...
...
@@ -90,12 +90,11 @@ GEM
mini_mime (>= 0.1.3)
childprocess (3.0.0)
coderay (1.1.2)
concurrent-ruby (1.1.5)
config (2.0.0)
activesupport (>= 4.2)
concurrent-ruby (1.1.6)
config (2.2.1)
deep_merge (~> 1.2, >= 1.2.1)
dry-
schema (~> 1
.0)
crass (1.0.
5
)
dry-
validation (~> 1.0, >= 1.0
.0)
crass (1.0.
6
)
deep_merge (1.2.1)
devise (4.7.1)
bcrypt (~> 3.0)
...
...
@@ -103,15 +102,16 @@ GEM
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
draper (
3.1
.0)
draper (
4.0
.0)
actionpack (>= 5.0)
activemodel (>= 5.0)
activemodel-serializers-xml (>= 1.0)
activesupport (>= 5.0)
request_store (>= 1.0)
dry-configurable (0.
9.0
)
dry-configurable (0.
11.3
)
concurrent-ruby (~> 1.0)
dry-core (~> 0.4, >= 0.4.7)
dry-equalizer (~> 0.2)
dry-container (0.7.2)
concurrent-ruby (~> 1.0)
dry-configurable (~> 0.1, >= 0.1.3)
...
...
@@ -119,12 +119,12 @@ GEM
concurrent-ruby (~> 1.0)
dry-equalizer (0.3.0)
dry-inflector (0.2.0)
dry-initializer (3.0.
2
)
dry-logic (1.0.
5
)
dry-initializer (3.0.
3
)
dry-logic (1.0.
6
)
concurrent-ruby (~> 1.0)
dry-core (~> 0.2)
dry-equalizer (~> 0.2)
dry-schema (1.4.
1
)
dry-schema (1.4.
3
)
concurrent-ruby (~> 1.0)
dry-configurable (~> 0.8, >= 0.8.3)
dry-core (~> 0.4)
...
...
@@ -132,42 +132,49 @@ GEM
dry-initializer (~> 3.0)
dry-logic (~> 1.0)
dry-types (~> 1.2)
dry-types (1.
2
.1)
dry-types (1.
3
.1)
concurrent-ruby (~> 1.0)
dry-container (~> 0.3)
dry-core (~> 0.4, >= 0.4.4)
dry-equalizer (~> 0.
2, >= 0.2.2
)
dry-equalizer (~> 0.
3
)
dry-inflector (~> 0.1, >= 0.1.2)
dry-logic (~> 1.0, >= 1.0.2)
dry-validation (1.4.2)
concurrent-ruby (~> 1.0)
dry-container (~> 0.7, >= 0.7.1)
dry-core (~> 0.4)
dry-equalizer (~> 0.2)
dry-initializer (~> 3.0)
dry-schema (~> 1.4, >= 1.4.3)
erubi (1.9.0)
faraday (
0.17.1
)
faraday (
1.0.0
)
multipart-post (>= 1.2, < 3)
ffi (1.1
1.3
)
ffi (1.1
2.2
)
globalid (0.4.2)
activesupport (>= 4.2.0)
i18n (1.
7.0
)
i18n (1.
8.2
)
concurrent-ruby (~> 1.0)
image_processing (1.
9
.3)
image_processing (1.
10
.3)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.1
3
, < 3)
jbuilder (2.
9.1
)
activesupport (>=
4.2
.0)
ruby-vips (>= 2.0.1
7
, < 3)
jbuilder (2.
10.0
)
activesupport (>=
5.0
.0)
jquery-rails (4.3.1)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
kaminari (1.
1.1
)
kaminari (1.
2.0
)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.
1.1
)
kaminari-activerecord (= 1.
1.1
)
kaminari-core (= 1.
1.1
)
kaminari-actionview (1.
1.1
)
kaminari-actionview (= 1.
2.0
)
kaminari-activerecord (= 1.
2.0
)
kaminari-core (= 1.
2.0
)
kaminari-actionview (1.
2.0
)
actionview
kaminari-core (= 1.
1.1
)
kaminari-activerecord (1.
1.1
)
kaminari-core (= 1.
2.0
)
kaminari-activerecord (1.
2.0
)
activerecord
kaminari-core (= 1.
1.1
)
kaminari-core (1.
1.1
)
kaminari-core (= 1.
2.0
)
kaminari-core (1.
2.0
)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
...
...
@@ -180,73 +187,73 @@ GEM
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (0.9.2)
mimemagic (0.3.
3
)
mini_magick (4.
9.5
)
mimemagic (0.3.
4
)
mini_magick (4.
10.1
)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.1
3
.0)
msgpack (1.3.
1
)
minitest (5.1
4
.0)
msgpack (1.3.
3
)
multipart-post (2.1.1)
mysql2 (0.5.3)
nio4r (2.5.2)
nokogiri (1.10.
5
)
nokogiri (1.10.
9
)
mini_portile2 (~> 2.4.0)
orm_adapter (0.5.0)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
public_suffix (4.0.
1
)
puma (3.12.
1
)
rack (2.
0.7
)
public_suffix (4.0.
3
)
puma (3.12.
4
)
rack (2.
2.2
)
rack-proxy (0.6.5)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (6.0.1)
actioncable (= 6.0.1)
actionmailbox (= 6.0.1)
actionmailer (= 6.0.1)
actionpack (= 6.0.1)
actiontext (= 6.0.1)
actionview (= 6.0.1)
activejob (= 6.0.1)
activemodel (= 6.0.1)
activerecord (= 6.0.1)
activestorage (= 6.0.1)
activesupport (= 6.0.1)
rails (6.0.
2.
1)
actioncable (= 6.0.
2.
1)
actionmailbox (= 6.0.
2.
1)
actionmailer (= 6.0.
2.
1)
actionpack (= 6.0.
2.
1)
actiontext (= 6.0.
2.
1)
actionview (= 6.0.
2.
1)
activejob (= 6.0.
2.
1)
activemodel (= 6.0.
2.
1)
activerecord (= 6.0.
2.
1)
activestorage (= 6.0.
2.
1)
activesupport (= 6.0.
2.
1)
bundler (>= 1.3.0)
railties (= 6.0.1)
railties (= 6.0.
2.
1)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
railties (6.0.1)
actionpack (= 6.0.1)
activesupport (= 6.0.1)
railties (6.0.
2.
1)
actionpack (= 6.0.
2.
1)
activesupport (= 6.0.
2.
1)
method_source
rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0)
rake (13.0.1)
rb-fsevent (0.10.3)
rb-inotify (0.10.
0
)
rb-inotify (0.10.
1
)
ffi (~> 1.0)
regexp_parser (1.
6
.0)
request_store (1.
4.1
)
regexp_parser (1.
7
.0)
request_store (1.
5.0
)
rack (>= 1.4)
responders (3.0.0)
actionpack (>= 5.0)
railties (>= 5.0)
rsolr (2.
2.1
)
rsolr (2.
3.0
)
builder (>= 2.1.2)
faraday (>= 0.9.0)
rsolr-ext (1.0.3)
rsolr (>= 1.0.2)
ruby-vips (2.0.1
6
)
ruby-vips (2.0.1
7
)
ffi (~> 1.9)
ruby_dep (1.5.0)
rubyzip (2.
0
.0)
rubyzip (2.
2
.0)
sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
...
...
@@ -258,7 +265,7 @@ GEM
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
selenium-webdriver (3.142.
6
)
selenium-webdriver (3.142.
7
)
childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2)
spring (2.1.0)
...
...
@@ -272,13 +279,13 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
thor (
0.20.3
)
thor (
1.0.1
)
thread_safe (0.3.6)
tilt (2.0.10)
turbolinks (5.2.1)
turbolinks-source (~> 5.2)
turbolinks-source (5.2.0)
tzinfo (1.2.
5
)
tzinfo (1.2.
6
)
thread_safe (~> 0.1)
warden (1.2.8)
rack (>= 2.0.6)
...
...
@@ -287,11 +294,11 @@ GEM
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webdrivers (4.
1.3
)
webdrivers (4.
2.0
)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (>= 3.0, < 4.0)
webpacker (4.2.
0
)
webpacker (4.2.
2
)
activesupport (>= 4.2)
rack-proxy (>= 0.6.1)
railties (>= 4.2)
...
...
@@ -300,7 +307,7 @@ GEM
websocket-extensions (0.1.4)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.
2.1
)
zeitwerk (2.
3.0
)
PLATFORMS
ruby
...
...
app/controllers/users/admins_controller.rb
View file @
55f7c946
...
...
@@ -3,33 +3,22 @@ class Users::AdminsController < ApplicationController
def
index
redirect_to
root_path
unless
current_user
.
role?
params
[
:search_user
]
||=
""
@applied_jobs
=
get_applied_jobs
(
params
[
:search_user
])
params
[
:search_user
]
@applied_jobs
=
get_applied_jobs
@user
=
User
.
find_by
(
email:
params
[
:search_user
])
@users
=
User
.
all
end
private
def
user_params
params
.
require
(
:user
).
permit
(
:id
,
:email
,
:first_name
,
:last_name
,
:role
)
end
def
get_applied_jobs
(
email
)
applied_jobs
=
[]
if
email
!=
""
user
=
User
.
find_by
(
email:
email
)
def
get_applied_jobs
if
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?
applied_jobs
=
user
.
jobs
elsif
email
=
""
||
nil
all_applied_jobs
=
UserJob
.
where
.
not
(
applied_at:
nil
).
to_a
(
0
..
all_applied_jobs
.
count
-
1
).
each
do
|
each_job
|
applied_jobs
<<
(
all_applied_jobs
[
each_job
].
job
)
end
applied_jobs
user
.
jobs
else
UserJob
.
where
.
not
(
applied_at:
nil
).
collect
{
|
uj
|
uj
.
job
}
end
end
end
app/helpers/job_helper.rb
View file @
55f7c946
...
...
@@ -4,7 +4,11 @@ module JobHelper
(
params
[
:industry_id
]
?
"Industry:
#{
@jobs
[
0
][
"industry"
]
}
"
:
params
[
:search
])
end
def
job_applied_at
(
job_id
)
UserJob
.
where
.
not
(
applied_at:
nil
).
find_by
(
job_id:
job_id
).
applied_at
def
job_applied_at
(
job
)
job
.
user_jobs
[
0
].
applied_at
end
def
get_all_user
User
.
all
end
end
app/views/users/admins/_applied_job
s
.html.erb
→
app/views/users/admins/_applied_job.html.erb
View file @
55f7c946
...
...
@@ -2,11 +2,11 @@
<div
class=
"job_data"
>
<dl
class=
"job_data_row"
>
<dt>
Title
</dt>
<dd>
<%=
link_to
applied_job
s
.
title
,
job_path
(
applied_jobs
.
id
)
%>
</dd>
<dd>
<%=
link_to
applied_job
.
title
,
job_path
(
applied_job
.
id
)
%>
</dd>
</dl>
<dl
class=
"job_data_row"
>
<dt>
Salary
</dt>
<dd>
<%=
applied_job
s
.
salary
%>
</dd>
<dd>
<%=
applied_job
.
salary
%>
</dd>
</dl>
<%
if
@user
.
present?
%>
<dl
class=
"job_data_row"
>
...
...
@@ -15,7 +15,7 @@
</dl>
<dl
class=
"job_data_row"
>
<dt>
Applied at:
</dt>
<dd>
<%=
job_applied_at
(
applied_job
s
.
id
)
%>
</dd>
<dd>
<%=
job_applied_at
(
applied_job
)
%>
</dd>
</dl>
<%
end
%>
</div>
...
...
app/views/users/admins/index.html.erb
View file @
55f7c946
<h4>
Search user's applied jobs:
</h4>
<%=
form_tag
(
users_admin_path
,
method: :get
)
do
|
f
|
%>
<%=
select_tag
:search_user
,
options_from_collection_for_select
(
@users
,
"email"
,
"email"
,
params
[
:search_user
]),
include_blank:
"Choose user's email"
%>
<%=
select_tag
:search_user
,
options_from_collection_for_select
(
get_all_user
,
"email"
,
"email"
,
params
[
:search_user
]),
include_blank:
"Choose user's email"
%>
<%=
submit_tag
"Search"
%>
<%
end
%>
<%=
render
partial:
"applied_job
s
"
,
collection:
@applied_jobs
%>
<%=
render
partial:
"applied_job"
,
collection:
@applied_jobs
%>
yarn.lock
deleted
100644 → 0
View file @
7b646fb6
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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