Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
redmine
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
301
Issues
301
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
coops
redmine
Commits
55f9a5a3
Commit
55f9a5a3
authored
2 years ago
by
Manon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add-column-timelog
parent
4185c2d8
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
1 deletions
+18
-1
.gitignore
.gitignore
+1
-0
timelog_controller.rb
app/controllers/timelog_controller.rb
+1
-1
queries_helper.rb
app/helpers/queries_helper.rb
+16
-0
No files found.
.gitignore
View file @
55f9a5a3
/.project
/vendor
/.idea
/.loadpath
/.powrc
...
...
This diff is collapsed.
Click to expand it.
app/controllers/timelog_controller.rb
View file @
55f9a5a3
...
...
@@ -66,7 +66,7 @@ class TimelogController < ApplicationController
format
.
csv
{
# Export all entries
@entries
=
scope
.
to_a
send_data
(
query_to_csv
(
@entries
,
@query
,
params
),
:type
=>
'text/csv; header=present'
,
:filename
=>
'timelog.csv'
)
send_data
(
query_to_csv
_timelog
(
@entries
,
@query
,
params
),
:type
=>
'text/csv; header=present'
,
:filename
=>
'timelog.csv'
)
}
end
end
...
...
This diff is collapsed.
Click to expand it.
app/helpers/queries_helper.rb
View file @
55f9a5a3
...
...
@@ -297,6 +297,22 @@ module QueriesHelper
end
end
def
query_to_csv_timelog
(
items
,
query
,
options
=
{})
time_entry
=
TimeEntry
.
includes
(
:project
).
find
(
1
)
project
=
time_entry
.
project
parent_project_name
=
project
.
parent
.
name
columns
=
query
.
columns
Redmine
::
Export
::
CSV
.
generate
(
:encoding
=>
params
[
:encoding
])
do
|
csv
|
# csv header fields
csv
<<
[
'Projet principal'
]
+
columns
.
map
{
|
c
|
c
.
caption
.
to_s
}
# csv lines
items
.
each
do
|
item
|
csv
<<
[
parent_project_name
]
+
columns
.
map
{
|
c
|
csv_content
(
c
,
item
)}
end
end
end
# Retrieve query from session or build a new query
def
retrieve_query
(
klass
=
IssueQuery
,
use_session
=
true
,
options
=
{})
session_key
=
klass
.
name
.
underscore
.
to_sym
...
...
This diff is collapsed.
Click to expand it.
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