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
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xuan Trung Le
venjob
Commits
39066c52
Commit
39066c52
authored
Oct 25, 2017
by
Xuan Trung Le
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bugs
parent
a1978ad0
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
46 additions
and
53 deletions
+46
-53
app/assets/javascripts/application.js
+0
-4
app/assets/stylesheets/application.scss
+5
-0
app/controllers/application_controller.rb
+1
-0
app/controllers/applies_controller.rb
+0
-1
app/controllers/favorites_controller.rb
+4
-4
app/models/user.rb
+16
-3
app/views/jobs/show.html.erb
+2
-8
app/views/layouts/_flash.html.erb
+0
-4
app/views/layouts/_menu.html.erb
+6
-17
config/environments/development.rb
+12
-12
No files found.
app/assets/javascripts/application.js
View file @
39066c52
...
...
@@ -16,9 +16,5 @@
//= require javascripts/bootstrap.min.js
$
(
document
).
ready
(
function
(){
<<<<<<<
051
d54168d06f6979124eb192481eeefe159fbf7
$
(
'.message'
).
delay
(
5000
).
fadeOut
(
'slow'
);
=======
$
(
'#message'
).
delay
(
5000
).
fadeOut
(
'slow'
);
>>>>>>>
create
favorite_job
page
});
app/assets/stylesheets/application.scss
View file @
39066c52
...
...
@@ -82,6 +82,11 @@ body{
max-height
:
89px
;
}
// Message
.message
{
position
:
fixed
;
right
:
0
}
// Table
.position-relative
{
position
:
relative
!
important
;
...
...
app/controllers/application_controller.rb
View file @
39066c52
class
ApplicationController
<
ActionController
::
Base
protect_from_forgery
with: :exception
before_action
:authenticate_user!
helper_method
:clear_session_candidate
def
clear_session_candidate
...
...
app/controllers/applies_controller.rb
View file @
39066c52
class
AppliesController
<
ApplicationController
before_action
:authenticate_user!
def
apply
session
[
:job_id
]
=
params
[
:job_id
]
if
params
[
:job_id
]
if
session
[
:candidate
].
present?
...
...
app/controllers/favorites_controller.rb
View file @
39066c52
...
...
@@ -5,11 +5,11 @@ class FavoritesController < ApplicationController
def
user_like_job
job
=
Job
.
find
(
params
[
:job_id
])
flash
[
:notice
]
=
"You have favorited this job already"
flash
[
:notice
]
=
'You have favorited this job already'
unless
current_user
.
liked
_jobs
.
pluck
(
:id
).
include?
(
job
.
id
)
unless
current_user
.
liked
?
(
job
)
current_user
.
like_job
(
job
)
flash
[
:notice
]
=
"Successfully favorited..."
flash
[
:notice
]
=
'Successfully favorited...'
end
redirect_back
(
fallback_location:
root_path
)
end
...
...
@@ -18,7 +18,7 @@ class FavoritesController < ApplicationController
job
=
Job
.
find
(
params
[
:job_id
])
current_user
.
unlike_job
(
job
)
flash
[
:notice
]
=
"Successfully unfavorited..."
flash
[
:notice
]
=
'Successfully unfavorited...'
redirect_back
(
fallback_location:
root_path
)
end
end
app/models/user.rb
View file @
39066c52
...
...
@@ -15,11 +15,24 @@ class User < ApplicationRecord
mount_uploader
:cv
,
CvUploader
# Validate
validates
:email
,
presence:
true
,
length:
{
maximum:
200
}
validates
:name
,
presence:
true
,
length:
{
maximum:
200
},
unless: :skip_validation
validates_size_of
:cv
,
maximum:
5
.
megabytes
,
message:
"size should be less than 5MB"
validates
:email
,
presence:
true
,
length:
{
maximum:
200
}
validates
:name
,
presence:
true
,
length:
{
maximum:
200
},
unless: :skip_validation
validates_size_of
:cv
,
maximum:
5
.
megabytes
,
message:
'size should be less than 5MB'
def
like_job
(
job
)
liked_jobs
<<
job
end
def
unlike_job
(
job
)
liked_jobs
.
delete
(
job
.
id
)
end
def
liked?
(
job
)
liked_jobs
.
include?
(
job
)
end
private
def
password_required?
return
false
if
skip_validation
super
...
...
app/views/jobs/show.html.erb
View file @
39066c52
<div
class=
"row"
>
<div
class=
"container"
>
<ol
class=
"breadcrumb"
>
<li><
a
href=
"/"
>
TOP
</a
></li>
<li>
<
%=
link_to
"TOP"
,
root_path
,
class:
"btn btn-primary"
%
>
</li>
<li>
<%-
@job
.
cities
.
each_with_index
do
|
city
,
index
|
-%>
<%=
"
#{
index
>
0
?
','
:
''
}
"
%>
...
...
@@ -37,16 +37,10 @@
</div>
<div
class=
"action"
>
<div
class=
"col-md-6"
>
<%=
link_to
"Apply"
,
apply_applies_path
(
job_id:
@job
.
id
),
class:
"btn btn-default btn-lg"
%>
</div>
<div
class=
"col-md-3"
>
<%=
link_to
"Apply"
,
"#"
,
class:
"btn btn-primary btn-lg"
%>
<%=
link_to
"Apply"
,
apply_applies_path
(
job_id:
@job
.
id
),
class:
"btn btn-primary btn-lg"
%>
</div>
<div
class=
"action"
>
<div
class=
"col-md-6"
>
<%=
link_to
"Apply"
,
"#"
,
class:
"btn btn-primary btn-lg"
%>
</div>
<div
class=
"col-md-6"
>
<%=
button_to
"Favorite"
,
job_favorites_path
(
job_id:
@job
.
id
),
class:
"btn btn-primary btn-lg"
%>
...
...
app/views/layouts/_flash.html.erb
View file @
39066c52
<%
flash
.
each
do
|
name
,
msg
|
%>
<
<<<<<<
051d54168d06f6979124eb192481eeefe159fbf7
<div
class=
"alert alert-info alert-dismissable fade in message"
>
=======
<div
class=
"alert alert-info alert-dismissable fade in"
style=
"position: fixed; right: 0"
id=
"message"
>
>>>>>>> create favorite_job page
<a
href=
"#"
class=
"close"
data-dismiss=
"alert"
aria-label=
"close"
>
×
</a>
<strong>
<%=
"
#{
name
}
!"
%>
</strong>
<%=
msg
%>
</div>
...
...
app/views/layouts/_menu.html.erb
View file @
39066c52
...
...
@@ -9,40 +9,29 @@
<!-- check an user is logged in or not -->
<ul
class=
"nav navbar-nav navbar-right"
>
<%-
if
current_user
-%>
<li><a
href=
"#"
><i
class=
"fa fa-
sign-in
"
aria-hidden=
"true"
></i>
My Page
</a></li>
<li><a
href=
"#"
><i
class=
"fa fa-
user
"
aria-hidden=
"true"
></i>
My Page
</a></li>
<li>
<
<<<<<<
051d54168d06f6979124eb192481eeefe159fbf7
<%=
link_to
destroy_user_session_path
,
method: :delete
do
%>
<i
class=
"fa fa-sign-out"
aria-hidden=
"true"
></i>
Logout
=======
<%=
link_to
destroy_user_session_path
,
method: :delete
do
%>
Logout
<i
class=
"fa fa-sign-in"
aria-hidden=
"true"
></i>
>>>>>>> create favorite_job page
<%
end
%>
</li>
<%-
else
-%>
<li>
<
<<<<<<
051d54168d06f6979124eb192481eeefe159fbf7
<%=
link_to
register_path
(
step:
1
)
do
%>
<i
class=
"fa fa-plus-circle"
aria-hidden=
"true"
></i>
Register
=======
<%=
link_to
new_user_session_path
do
%>
Login
<i
class=
"fa fa-sign-in"
aria-hidden=
"true"
></i>
>>>>>>> create favorite_job page
<%
end
%>
</li>
<li><a
href=
"#"
><i
class=
"fa fa-plus"
aria-hidden=
"true"
></i>
Register
</a></li>
<li>
<%=
link_to
new_user_session_path
do
%>
<i
class=
"fa fa-sign-in"
aria-hidden=
"true"
></i>
Login
<%
end
%>
</li>
<%-
end
-%>
<
<<<<<<
051d54168d06f6979124eb192481eeefe159fbf7
<
li
><a
href=
"#"
><i
class=
"fa fa-star"
aria-hidden=
"true"
></i></span>
Favorite
</a></li>
=======
<li>
<%=
link_to
favorites_path
do
%>
Favorite
<i
class=
"fa fa-star"
aria-hidden=
"true"
></i>
<%
end
%>
</li>
>>>>>>> create favorite_job page
<li><a
href=
"#"
><i
class=
"fa fa-history"
aria-hidden=
"true"
></i></span>
History
</a></li>
</ul>
</div>
...
...
config/environments/development.rb
View file @
39066c52
...
...
@@ -48,16 +48,16 @@ Rails.application.configure do
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
#
config.action_mailer.delivery_method = :smtp
#
config.action_mailer.smtp_settings = { address: 'localhost',
#
port: 1025 }
config
.
action_mailer
.
smtp_settings
=
{
address:
"smtp.gmail.com"
,
port:
587
,
domain:
"example.com"
,
authentication:
"plain"
,
enable_starttls_auto:
true
,
user_name:
ENV
[
"GMAIL_USER"
],
password:
ENV
[
"GMAIL_PASSWORD"
]
}
config
.
action_mailer
.
delivery_method
=
:smtp
config
.
action_mailer
.
smtp_settings
=
{
address:
'localhost'
,
port:
1025
}
#
config.action_mailer.smtp_settings = {
#
address: "smtp.gmail.com",
#
port: 587,
#
domain: "example.com",
#
authentication: "plain",
#
enable_starttls_auto: true,
#
user_name: ENV["GMAIL_USER"],
#
password: ENV["GMAIL_PASSWORD"]
#
}
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