Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
ven-job
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
Trịnh Hoàng Phúc
ven-job
Commits
07db8223
Commit
07db8223
authored
Apr 10, 2020
by
Hoang Phuc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply, Favorite job, add columns to tbl_user
parent
627b4293
Pipeline
#574
failed with stages
in 0 seconds
Changes
10
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
63 additions
and
15 deletions
+63
-15
app/assets/stylesheets/js/custom.js
+12
-7
app/controllers/application_controller.rb
+8
-0
app/controllers/jobs_controller.rb
+21
-2
app/views/devise/registrations/new.html.erb
+6
-1
app/views/jobs/apply_jobs.html.erb
+0
-0
app/views/jobs/show.html.erb
+3
-3
app/views/layouts/application.html.erb
+3
-0
config/routes.rb
+1
-1
db/migrate/20200410070154_add_columns_to_users.rb
+6
-0
db/schema.rb
+3
-1
No files found.
app/assets/stylesheets/js/custom.js
View file @
07db8223
...
@@ -10,20 +10,26 @@
...
@@ -10,20 +10,26 @@
$
(
".back2top"
).
click
(
function
(){
$
(
".back2top"
).
click
(
function
(){
$
(
"html, body"
).
animate
({
scrollTop
:
0
},
500
);
$
(
"html, body"
).
animate
({
scrollTop
:
0
},
500
);
})
})
$
(
".
job_application .application_button
"
).
click
(
function
(
e
)
{
$
(
".
apply-or-favorite-jobs
"
).
click
(
function
(
e
)
{
e
.
preventDefault
()
e
.
preventDefault
()
data
=
{
job_ids
:
[
$
(
this
).
data
(
"id"
)]
}
data
=
{
job_ids
:
[
$
(
this
).
data
(
"id"
)],
type
:
$
(
this
).
data
(
"type"
)
}
$
.
ajax
({
$
.
ajax
({
url
:
'/
job/apply
'
,
url
:
'/
apply_or_favorite
'
,
data
:
data
,
data
:
data
,
type
:
'POST'
,
type
:
'POST'
,
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
console
.
log
(
"response: "
,
res
)
alert
(
res
.
message
)
},
},
error
:
(
err
)
=>
{
error
:
(
err
)
=>
{
console
.
log
(
"error: "
,
err
)
if
(
err
.
status
===
401
){
if
(
confirm
(
err
.
responseJSON
.
message
)){
window
.
location
.
href
=
"/users/sign_in"
;
}
}
}
}
});
});
})
})
})(
jQuery
);
})(
jQuery
);
\ No newline at end of file
app/controllers/application_controller.rb
View file @
07db8223
class
ApplicationController
<
ActionController
::
Base
class
ApplicationController
<
ActionController
::
Base
before_action
:configure_permitted_parameters
,
if: :devise_controller?
protected
def
configure_permitted_parameters
devise_parameter_sanitizer
.
permit
(
:sign_up
,
keys:
[
:full_name
])
devise_parameter_sanitizer
.
permit
(
:account_update
,
keys:
[
:full_name
,
:cv
])
end
end
end
app/controllers/jobs_controller.rb
View file @
07db8223
...
@@ -35,7 +35,26 @@ class JobsController < ApplicationController
...
@@ -35,7 +35,26 @@ class JobsController < ApplicationController
@title
=
"Job was not found"
@title
=
"Job was not found"
end
end
end
end
def
apply_jobs
def
apply_or_favorite_jobs
unless
current_user
payload
=
{
message:
"You are not logged in, please login to operate the feature"
,
}
render
:json
=>
payload
,
:status
=>
:unauthorized
else
if
params
[
:job_ids
].
present?
params
[
:job_ids
].
each
do
|
id
|
if
params
[
:type
]
==
"apply"
Apply
.
find_or_create_by
({
:user_id
=>
current_user
.
id
,
:job_id
=>
id
})
else
Favorite
.
find_or_create_by
({
:user_id
=>
current_user
.
id
,
:job_id
=>
id
})
end
end
payload
=
{
message:
"Thank you for
#{
params
[
:type
]
==
"apply"
?
"applied"
:
"favourited"
}
with VenJob"
,
}
render
:json
=>
payload
,
:status
=>
:ok
end
end
end
end
end
end
app/views/devise/registrations/new.html.erb
View file @
07db8223
...
@@ -10,8 +10,13 @@
...
@@ -10,8 +10,13 @@
<%=
render
"devise/shared/error_messages"
,
resource:
resource
%>
<%=
render
"devise/shared/error_messages"
,
resource:
resource
%>
<p
class=
"field"
>
<p
class=
"field"
>
<%=
f
.
label
:full_name
%>
<br
/>
<%=
f
.
text_field
:full_name
,
autofocus:
true
,
autocomplete:
"full_name"
%>
</p>
<p
class=
"field"
>
<%=
f
.
label
:email
%>
<br
/>
<%=
f
.
label
:email
%>
<br
/>
<%=
f
.
email_field
:email
,
auto
focus:
true
,
auto
complete:
"email"
%>
<%=
f
.
email_field
:email
,
autocomplete:
"email"
%>
</p>
</p>
<p
class=
"field"
>
<p
class=
"field"
>
...
...
app/views/jobs/apply_jobs.html.erb
0 → 100644
View file @
07db8223
app/views/jobs/show.html.erb
View file @
07db8223
...
@@ -33,10 +33,10 @@
...
@@ -33,10 +33,10 @@
</aside>
</aside>
<aside
class=
"widget widget--job_listing"
>
<aside
class=
"widget widget--job_listing"
>
<div
class=
"job_application application"
>
<div
class=
"job_application application"
>
<input
type=
"button"
class=
"application_button button
"
value=
"Apply for job"
/>
<input
type=
"button"
class=
"application_button button
apply-or-favorite-jobs"
value=
"Apply for job"
data-id=
"
<%=
@job
.
id
%>
"
data-type=
"apply"
/>
</div>
</div>
<div
class=
"job
-manager-form wp-job-manager-bookmarks-form
"
>
<div
class=
"job
_application application
"
>
<
a
class=
"bookmark-notice"
href=
"https://jobify-demos.astoundify.com/classic/account/"
>
Favorite
</a
>
<
input
type=
"button"
class=
"application_button favorite-button button apply-or-favorite-jobs"
value=
"Favorite"
data-id=
"
<%=
@job
.
id
%>
"
data-type=
"favorite"
/
>
</div>
</div>
</aside>
</aside>
<aside
class=
"widget widget--job_listing"
>
<aside
class=
"widget widget--job_listing"
>
...
...
app/views/layouts/application.html.erb
View file @
07db8223
...
@@ -49,6 +49,9 @@
...
@@ -49,6 +49,9 @@
<a
href=
"/history"
>
History
</a>
<a
href=
"/history"
>
History
</a>
</li>
</li>
<%
if
current_user
%>
<%
if
current_user
%>
<li
class=
"register menu-item menu-item-type-post_type menu-item-object-page menu-item-99991219"
>
<%=
link_to
'Hi, '
+
current_user
.
full_name
,
edit_user_registration_path
%>
</li>
<li
class=
"login menu-item menu-item-type-post_type menu-item-object-page menu-item-99991213"
>
<li
class=
"login menu-item menu-item-type-post_type menu-item-object-page menu-item-99991213"
>
<%=
link_to
'Sign out'
,
destroy_user_session_path
,
method: :delete
%>
<%=
link_to
'Sign out'
,
destroy_user_session_path
,
method: :delete
%>
</li>
</li>
...
...
config/routes.rb
View file @
07db8223
...
@@ -12,5 +12,5 @@ Rails.application.routes.draw do
...
@@ -12,5 +12,5 @@ Rails.application.routes.draw do
get
'/industries/'
,
to:
'industries#index'
,
as:
'industries'
get
'/industries/'
,
to:
'industries#index'
,
as:
'industries'
get
'/history/'
,
to:
'history#index'
get
'/history/'
,
to:
'history#index'
post
'
job/apply'
,
to:
'job#apply
_jobs'
post
'
apply_or_favorite'
,
to:
'jobs#apply_or_favorite
_jobs'
end
end
db/migrate/20200410070154_add_columns_to_users.rb
0 → 100644
View file @
07db8223
class
AddColumnsToUsers
<
ActiveRecord
::
Migration
[
6.0
]
def
change
add_column
:users
,
:full_name
,
:string
add_column
:users
,
:cv
,
:string
end
end
db/schema.rb
View file @
07db8223
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
#
#
# It's strongly recommended that you check this file into your version control system.
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2020_04_
08_025325
)
do
ActiveRecord
::
Schema
.
define
(
version:
2020_04_
10_070154
)
do
create_table
"applies"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8"
,
force: :cascade
do
|
t
|
create_table
"applies"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8"
,
force: :cascade
do
|
t
|
t
.
bigint
"user_id"
,
null:
false
t
.
bigint
"user_id"
,
null:
false
...
@@ -87,6 +87,8 @@ ActiveRecord::Schema.define(version: 2020_04_08_025325) do
...
@@ -87,6 +87,8 @@ ActiveRecord::Schema.define(version: 2020_04_08_025325) do
t
.
datetime
"remember_created_at"
t
.
datetime
"remember_created_at"
t
.
datetime
"created_at"
,
precision:
6
,
null:
false
t
.
datetime
"created_at"
,
precision:
6
,
null:
false
t
.
datetime
"updated_at"
,
precision:
6
,
null:
false
t
.
datetime
"updated_at"
,
precision:
6
,
null:
false
t
.
string
"full_name"
t
.
string
"cv"
t
.
index
[
"email"
],
name:
"index_users_on_email"
,
unique:
true
t
.
index
[
"email"
],
name:
"index_users_on_email"
,
unique:
true
t
.
index
[
"reset_password_token"
],
name:
"index_users_on_reset_password_token"
,
unique:
true
t
.
index
[
"reset_password_token"
],
name:
"index_users_on_reset_password_token"
,
unique:
true
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