Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
venjob_nth
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
3
Merge Requests
3
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
Ngô Trung Hưng
venjob_nth
Commits
e0740f33
Commit
e0740f33
authored
Aug 24, 2020
by
Ngô Trung Hưng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use render collection & fix method add_job_to_history
parent
57a0d779
Pipeline
#992
failed with stages
in 0 seconds
Changes
7
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
18 deletions
+23
-18
app/assets/stylesheets/custom.scss
+4
-0
app/controllers/job_controller.rb
+8
-6
app/models/history.rb
+1
-0
app/views/favorite/index.html.erb
+1
-1
app/views/histories/index.html.erb
+3
-5
config/locales/en.yml
+3
-3
config/locales/vn.yml
+3
-3
No files found.
app/assets/stylesheets/custom.scss
View file @
e0740f33
...
@@ -1622,3 +1622,6 @@ $main-color: #23303D;
...
@@ -1622,3 +1622,6 @@ $main-color: #23303D;
height
:
100%
;
height
:
100%
;
z-index
:
99999
;
z-index
:
99999
;
}
}
#label_name_file
{
cursor
:
pointer
;
}
\ No newline at end of file
app/controllers/job_controller.rb
View file @
e0740f33
...
@@ -3,12 +3,12 @@
...
@@ -3,12 +3,12 @@
# Job controller
# Job controller
class
JobController
<
ApplicationController
class
JobController
<
ApplicationController
before_action
:load_data_dropdown
,
only: :index
before_action
:load_data_dropdown
,
only: :index
after_action
:add_job_to_history
,
only: :detail
def
add_job_to_history
(
job_id
)
def
add_job_to_history
return
unless
user_signed_in?
current_user
.
histories
.
find_or_create_by
(
job_id:
session
[
:params_job_id
])
if
user_signed_in?
current_user
.
histories
.
find_or_create_by
(
job_id:
job_id
)
counter_history
=
current_user
.
histories
.
count
counter_history
=
current_user
.
histories
.
count
current_user
.
histories
.
destroy
(
current_user
.
histories
.
first
)
if
counter_history
>
20
current_user
.
histories
.
destroy
(
current_user
.
histories
.
first
)
if
counter_history
>
History
::
NUMBER_JOB_LIMIT
session
.
delete
(
:params_job_id
)
end
end
def
index
def
index
...
@@ -19,7 +19,9 @@ class JobController < ApplicationController
...
@@ -19,7 +19,9 @@ class JobController < ApplicationController
def
detail
def
detail
@job
=
Job
.
find
(
params
[
:id
]).
decorate
@job
=
Job
.
find
(
params
[
:id
]).
decorate
session
[
:params_job_id
]
=
@job
.
id
return
render
'error/fage_not_found'
if
@job
.
blank?
add_job_to_history
(
@job
.
id
)
cities
=
@job
.
cities
.
first
cities
=
@job
.
cities
.
first
industries
=
@job
.
industries
.
first
industries
=
@job
.
industries
.
first
add_breadcrumb
t
(
'controller.job.detail.home'
),
root_path
add_breadcrumb
t
(
'controller.job.detail.home'
),
root_path
...
...
app/models/history.rb
View file @
e0740f33
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
# Description/Explanation of Person class
# Description/Explanation of Person class
class
History
<
ApplicationRecord
class
History
<
ApplicationRecord
NUMBER_JOB_LIMIT
=
20
belongs_to
:user
belongs_to
:user
belongs_to
:job
belongs_to
:job
end
end
app/views/favorite/index.html.erb
View file @
e0740f33
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
<div
class=
"col-lg-12"
>
<div
class=
"col-lg-12"
>
<div
class=
"breadcrumb_total_search"
>
<div
class=
"breadcrumb_total_search"
>
<span
class=
"breadcrumb-item active"
>
<span
class=
"breadcrumb-item active"
>
<%=
t
(
'favorite.
list_blank
'
)
%>
<%=
t
(
'favorite.
empty
'
)
%>
</span>
</span>
</div>
</div>
</div>
</div>
...
...
app/views/histories/index.html.erb
View file @
e0740f33
...
@@ -14,18 +14,16 @@
...
@@ -14,18 +14,16 @@
<div
class=
"col-lg-12"
>
<div
class=
"col-lg-12"
>
<div
class=
"breadcrumb_total_search"
>
<div
class=
"breadcrumb_total_search"
>
<span
class=
"breadcrumb-item active"
>
<span
class=
"breadcrumb-item active"
>
<%=
t
(
'history.
list_blank
'
)
%>
<%=
t
(
'history.
empty
'
)
%>
</span>
</span>
</div>
</div>
</div>
</div>
<div
style=
"width: 100%; height: 55vh"
></div>
<div
style=
"width: 100%; height: 55vh"
></div>
<%
else
%>
<%
else
%>
<%=
form_with
url:
apply_path
,
method: :get
,
local:
true
,
skip_enforcing_utf8:
true
do
|
f
|
%>
<%=
form_with
url:
apply_path
,
method: :get
,
local:
true
,
skip_enforcing_utf8:
true
do
|
f
|
%>
<div
class=
"container"
>
<div
class=
"container"
>
<div
class=
"box_scroll"
>
<div
class=
"box_scroll"
>
<%
@jobs
.
each
do
|
item
|
%>
<%=
render
partial:
'histories/block_job_mini'
,
collection:
@jobs
,
as: :data
,
locals:
{
form:
f
}
%>
<%=
render
'histories/block_job_mini'
,
data:
item
,
form:
f
%>
<%
end
%>
</div>
</div>
</div>
</div>
<div
class=
"container"
>
<div
class=
"container"
>
...
...
config/locales/en.yml
View file @
e0740f33
...
@@ -136,11 +136,11 @@ en:
...
@@ -136,11 +136,11 @@ en:
favorite
:
favorite
:
liked
:
'
You
have
added
job
to
favorites'
liked
:
'
You
have
added
job
to
favorites'
list
:
'
List
of
jobs
you
liked'
list
:
'
List
of
jobs
you
liked'
list_blank
:
'
You
do
not
have
a
favorite
job!'
empty
:
'
You
do
not
have
a
favorite
job!'
history
:
history
:
list
:
'
Histories'
list
:
'
Histories'
list_blank
:
'
You
do
not
have
a
histories'
empty
:
'
You
do
not
have
a
histories'
see
:
'
See
:
'
see
n_at
:
'
Seen_at
:
'
activerecord
:
activerecord
:
attributes
:
attributes
:
applied_job
:
applied_job
:
...
...
config/locales/vn.yml
View file @
e0740f33
...
@@ -136,11 +136,11 @@ vi:
...
@@ -136,11 +136,11 @@ vi:
favorite
:
favorite
:
liked
:
'
Bạn
đã
thêm
công
việc
vào
yêu
thích.'
liked
:
'
Bạn
đã
thêm
công
việc
vào
yêu
thích.'
list
:
'
Danh
sách
công
việc
bạn
đã
thích'
list
:
'
Danh
sách
công
việc
bạn
đã
thích'
list_blank
:
'
Bạn
chưa
có
công
việc
yêu
thích!'
empty
:
'
Bạn
chưa
có
công
việc
yêu
thích!'
history
:
history
:
list
:
'
Lịch
sử'
list
:
'
Lịch
sử'
list_blank
:
'
Bạn
chưa
có
xem
công
việc
nào
luôn
á!'
empty
:
'
Bạn
chưa
có
xem
công
việc
nào
luôn
á!'
see
:
'
Đã
xem
lúc:
'
see
n_at
:
'
Đã
xem
lúc:
'
activerecord
:
activerecord
:
attributes
:
attributes
:
applied_job
:
applied_job
:
...
...
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