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
79e309a7
Commit
79e309a7
authored
Nov 16, 2017
by
Xuan Trung Le
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bugs
parent
f08ceac1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
46 deletions
+9
-46
app/assets/javascripts/application.js
+3
-23
app/controllers/admins/applies_controller.rb
+5
-18
app/controllers/application_controller.rb
+0
-1
app/models/apply_job.rb
+0
-3
app/views/admins/applies/_application.html.erb
+1
-1
No files found.
app/assets/javascripts/application.js
View file @
79e309a7
...
@@ -12,35 +12,15 @@
...
@@ -12,35 +12,15 @@
//
//
//= require rails-ujs
//= require rails-ujs
//= require_tree .
//= require_tree .
//= require jquery-3.2.1.min.js
//= require javascripts/jquery-3.2.1.min.js
//= require bootstrap.min.js
//= require javascripts/bootstrap.min.js
//= require javascripts/bootstrap.min.js
//= require bootstrap-datetimepicker.min.js
//= require bootstrap-datetimepicker.min.js
$
(
document
).
ready
(
function
(){
$
(
document
).
ready
(
function
(){
// this function to hide message after 5s
$
(
'.message'
).
delay
(
5000
).
fadeOut
(
'slow'
);
$
(
'.message'
).
delay
(
5000
).
fadeOut
(
'slow'
);
<<<<<<<
a6a6bfc98ed7e35fb9415714f7cf725ec5a0b69a
$
(
document
).
on
(
'change'
,
'input[name=job_id]'
,
function
(
event
)
{
$
(
document
).
on
(
'change'
,
'input[name=job_id]'
,
function
(
event
)
{
event
.
preventDefault
();
event
.
preventDefault
();
$
(
'#apply'
).
removeAttr
(
'disabled'
)
$
(
'#apply'
).
removeAttr
(
'disabled'
)
=======
// this function to select date
$
(
'.form_date'
).
datetimepicker
({
language
:
'en'
,
weekStart
:
1
,
todayBtn
:
1
,
autoclose
:
1
,
todayHighlight
:
1
,
startView
:
2
,
minView
:
2
,
forceParse
:
0
>>>>>>>
fix
bugs
});
});
// set min-height css for content
windowHeight
=
$
(
document
).
height
();
menuHeight
=
$
(
'.navbar'
).
height
();
footHeight
=
$
(
'.footer'
).
height
();
$
(
'.content'
).
css
(
"min-height"
,
windowHeight
-
(
menuHeight
+
footHeight
))
});
});
app/controllers/admins/applies_controller.rb
View file @
79e309a7
require
'rsolr'
require
'rsolr'
require
"csv"
require
"csv"
require
'uri'
class
Admins
::
AppliesController
<
ApplicationController
class
Admins
::
AppliesController
<
ApplicationController
def
index
def
index
@cities
=
City
.
pluck
(
:id
,
:name
)
if
params
[
:commit
]
if
params
[
:commit
]
# get condition here
# get condition here
condition
=
get_condition
condition
=
get_condition
...
@@ -13,18 +13,16 @@ class Admins::AppliesController < ApplicationController
...
@@ -13,18 +13,16 @@ class Admins::AppliesController < ApplicationController
@applications
=
ApplyJob
.
where
(
job_id:
job_id
).
includes
(
:job
,
:user
)
@applications
=
ApplyJob
.
where
(
job_id:
job_id
).
includes
(
:job
,
:user
)
if
params
[
:commit
].
eql?
'Down csv'
if
params
[
:commit
].
eql?
'Down csv'
flash
[
:notice
]
=
'Down csv'
down_csv
(
@applications
)
down_csv
(
@applications
)
return
end
end
else
else
# get applications
# get applications
@applications
=
ApplyJob
.
includes
(
:job
,
:user
)
@applications
=
ApplyJob
.
includes
(
:job
,
:user
)
end
end
puts
params
[
:commit
]
end
end
def
down_csv
(
applications
)
def
down_csv
(
applications
)
# handle data
# handle data
data_csv
=
[]
data_csv
=
[]
applications
.
each
do
|
application
|
applications
.
each
do
|
application
|
...
@@ -36,19 +34,8 @@ class Admins::AppliesController < ApplicationController
...
@@ -36,19 +34,8 @@ class Admins::AppliesController < ApplicationController
candidate
[
:applied_at
]
=
application
.
created_at
candidate
[
:applied_at
]
=
application
.
created_at
data_csv
<<
candidate
data_csv
<<
candidate
end
end
column_names
=
data_csv
.
first
.
keys
# create new csv file
send_data
ApplyJob
.
to_csv
(
column_names
,
data_csv
),
filename:
"applications-
#{
Date
.
today
}
.csv"
CSV
.
open
(
"file.csv"
,
"wb"
)
do
|
csv
|
# write header
csv
<<
data_csv
.
first
.
keys
# write values
data_csv
.
each_with_index
do
|
data
,
i
|
csv
<<
data
.
values
end
end
# down file.csv into local
send_file
"
#{
Rails
.
root
}
/file.csv"
,
type:
'application/csv'
end
end
private
private
...
@@ -61,7 +48,7 @@ class Admins::AppliesController < ApplicationController
...
@@ -61,7 +48,7 @@ class Admins::AppliesController < ApplicationController
# Direct connection
# Direct connection
connect
connect
# use get method to query
# use get method to query
response
=
@solr
.
get
'select'
,
:params
=>
condition
response
=
@solr
.
get
'select'
,
params:
condition
response
response
end
end
...
...
app/controllers/application_controller.rb
View file @
79e309a7
class
ApplicationController
<
ActionController
::
Base
class
ApplicationController
<
ActionController
::
Base
protect_from_forgery
with: :exception
protect_from_forgery
with: :exception
helper_method
:clear_session_candidate
,
:admin_can_not_do_this
def
clear_session_candidate
def
clear_session_candidate
session
[
:candidate
]
=
{}
session
[
:candidate
]
=
{}
...
...
app/models/apply_job.rb
View file @
79e309a7
...
@@ -4,10 +4,7 @@ class ApplyJob < ApplicationRecord
...
@@ -4,10 +4,7 @@ class ApplyJob < ApplicationRecord
validates_size_of
:cv
,
maximum:
5
.
megabytes
,
message:
'size should be less than 5MB'
validates_size_of
:cv
,
maximum:
5
.
megabytes
,
message:
'size should be less than 5MB'
validates
:email
,
presence:
true
validates
:email
,
presence:
true
validates
:name
,
presence:
true
validates
:name
,
presence:
true
<<<<<<<
132
d97c26c67214fbdb21f17fdf70e66ae6c833b
# CarrierWave
# CarrierWave
mount_uploader
:cv
,
CvUploader
mount_uploader
:cv
,
CvUploader
=======
>>>>>>>
fig
bugs
end
end
app/views/admins/applies/_application.html.erb
View file @
79e309a7
<%
@
applications
.
each
do
|
application
|
%>
<%
applications
.
each
do
|
application
|
%>
<div
class=
"job-intro well mr0 mrBot20"
>
<div
class=
"job-intro well mr0 mrBot20"
>
<h4
class=
"mr0"
>
<%=
link_to
application
.
job
.
name
,
job_path
(
application
.
job
)
%>
</h4>
<h4
class=
"mr0"
>
<%=
link_to
application
.
job
.
name
,
job_path
(
application
.
job
)
%>
</h4>
<p>
<%=
"Candidate Name:
#{
application
.
user
.
name
}
"
%>
</p>
<p>
<%=
"Candidate Name:
#{
application
.
user
.
name
}
"
%>
</p>
...
...
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