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
2
Merge Requests
2
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
Thanh Hung Pham
veNJOB
Commits
03d01c20
Commit
03d01c20
authored
Jul 19, 2017
by
Thanh Hung Pham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Export CSV with condition
parent
0f3a0def
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
app/controllers/admins_controller.rb
+8
-1
app/views/admins/search.html.erb
+1
-1
No files found.
app/controllers/admins_controller.rb
View file @
03d01c20
...
...
@@ -14,7 +14,14 @@ class AdminsController < ApplicationController
end
def
export
@data
=
Apply
.
order
(
:created_at
)
@email
=
params
[
:email
]
if
params
[
:email
].
present?
@city_id
=
params
[
:city_id
]
if
params
[
:city_id
].
present?
@category_id
=
params
[
:category_id
]
if
params
[
:category_id
].
present?
@from_date_default
=
params
[
:from_date
]
if
params
[
:from_date
].
present?
@to_date_default
=
params
[
:to_date
]
if
params
[
:to_date
].
present?
@data
=
Apply
.
search_email
(
@email
).
search_city
(
@city_id
).
search_city
(
@category_id
).
applied_at_between
(
@from_date_default
,
@to_date_default
)
respond_to
do
|
format
|
format
.
html
{
redirect_to
root_url
}
format
.
csv
{
send_data
@data
.
to_csv
}
...
...
app/views/admins/search.html.erb
View file @
03d01c20
...
...
@@ -22,7 +22,7 @@
</div>
<div
class=
"form-group"
>
<%=
submit_tag
'Search'
,
class:
'btn btn-primary'
%>
<%=
link_to
'CSV Download'
,
admins_export_path
(
format:
"csv"
),
class:
'btn btn-primary'
%>
<%=
link_to
'CSV Download'
,
admins_export_path
(
format:
"csv"
,
email:
@email
,
city_id:
@city_id
,
category_id:
@category_id
,
from_date:
@from_date_default
,
to_date:
@to_date_default
),
class:
'btn btn-primary'
%>
</div>
<%-
end
-%>
</div>
...
...
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