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
Huỳnh Thiên Phước
venjob
Commits
241ac29b
Commit
241ac29b
authored
Aug 13, 2020
by
Huỳnh Thiên Phước
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix logic truncate desc
parent
d994d77f
Pipeline
#900
canceled with stages
in 0 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
11 deletions
+11
-11
app/helpers/jobs_helper.rb
+0
-5
app/models/application_record.rb
+2
-1
app/models/job.rb
+4
-0
app/views/jobs/_job.html.erb
+2
-2
app/views/layouts/_show_job.html.erb
+3
-3
No files found.
app/helpers/jobs_helper.rb
deleted
100644 → 0
View file @
d994d77f
module
JobsHelper
def
job_description
(
description
)
strip_tags
(
description
).
truncate_words
(
250
)
end
end
app/models/application_record.rb
View file @
241ac29b
...
...
@@ -3,6 +3,7 @@ class ApplicationRecord < ActiveRecord::Base
def
convert_attribute
(
val
)
return
''
if
val
.
blank?
[
val
,
rand
(
10000
)]
=
normalize_attribute
.
mb_chars
.
normalize
(
:kd
).
gsub
(
/[Đđ]/
,
'd'
).
gsub
(
/[^\x00-\x7F]/
,
''
).
gsub
(
/[\W+]/
,
' '
).
downcase
.
to_s
.
split
(
' '
).
join
(
'-'
)
[
val
,
rand
(
10000
)].
mb_chars
.
normalize
(
:kd
).
gsub
(
/[Đđ]/
,
'd'
).
gsub
(
/[^\x00-\x7F]/
,
''
).
gsub
(
/[\W+]/
,
' '
).
downcase
.
to_s
.
split
(
' '
).
join
(
'-'
)
end
end
app/models/job.rb
View file @
241ac29b
...
...
@@ -25,6 +25,10 @@ class Job < ApplicationRecord
company
&
.
name
end
def
format_desc
description
.
truncate_words
(
250
)
end
private
def
set_converted_name
...
...
app/views/jobs/_job.html.erb
View file @
241ac29b
...
...
@@ -12,8 +12,8 @@
</div>
<div
class=
"col-5 salary"
>
Salary:
<%=
job
.
salary
%>
</div>
<div
class=
"col-10 introduction"
>
<%=
job_description
(
job
.
description
)
%>
<br>
<%=
link_to
'Read more..'
,
'#'
%>
<%=
strip_tags
(
job
.
format_desc
)
%>
<br>
<%=
link_to
'Read more..'
,
job_detail_path
(
job
.
id
)
%>
</div>
</div>
<button
type=
"button"
class=
"btn btn-success"
id=
"button-follow"
>
♥ Favorite
</button>
...
...
app/views/layouts/_show_job.html.erb
View file @
241ac29b
...
...
@@ -7,14 +7,14 @@
<%
end
%>
</div>
<div>
<%=
job
.
company_name
%>
</div>
<div
class=
"salary"
>
💲
Salary:
<%=
job
.
salary
%>
</div>
<div
class=
"salary"
>
Salary:
<%=
job
.
salary
%>
</div>
<div>
▼
<%=
job
.
cities
.
map
(
&
:name
).
join
(
' | '
)
%>
</div>
<div
class=
"row"
>
<div
class=
"col-10 introduction"
>
<%=
job_description
(
job
.
description
)
%>
<br>
<%=
link_to
'Read more..'
,
'#'
%>
<%=
strip_tags
(
job
.
format_desc
)
%>
<br>
<%=
link_to
'Read more..'
,
job_detail_path
(
job
.
id
)
%>
</div>
</div>
<button
type=
"button"
class=
"btn btn-primary"
id=
"button-follow"
>
♥ Follow
</button>
...
...
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