File tree Expand file tree Collapse file tree 4 files changed +37
-8
lines changed Expand file tree Collapse file tree 4 files changed +37
-8
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,21 @@ def link_to_csv_export(timesheet)
39
39
:class => 'icon icon-timesheet' )
40
40
end
41
41
42
+ def form_for_to_timesheet ( timesheet )
43
+ params_like_decode_url = CGI . unescape ( { :timesheet => timesheet . to_param } . to_query )
44
+ inputs = ""
45
+ form = form_tag :controller => 'timesheet' , :action => 'report' do
46
+ params_like_decode_url . split ( "&" ) . each do |param |
47
+ param_arr = param . split ( "=" )
48
+ inputs << hidden_field_tag ( param_arr . first , param_arr . last , :id => "" )
49
+ end
50
+ inputs << submit_tag ( l ( :timesheet_permalink ) )
51
+ inputs . html_safe
52
+ end
53
+ form . html_safe
54
+ end
55
+
56
+
42
57
def toggle_arrows ( element , js_function )
43
58
js = "#{ js_function } ('#{ element } ');"
44
59
Original file line number Diff line number Diff line change @@ -162,6 +162,20 @@ def to_param
162
162
163
163
def to_csv
164
164
out = "" ;
165
+
166
+
167
+ handle_time_entries = { }
168
+ time_entries . each do |k , v |
169
+ if k . is_a? String
170
+ handle_time_entries [ k ] = v
171
+ next ;
172
+ end
173
+ handle_time_entries [ k . name ] = v
174
+ end
175
+
176
+ time_entries = handle_time_entries
177
+
178
+
165
179
FCSV . generate ( out , :encoding => 'utf-8' , :force_quotes => true ) do |csv |
166
180
csv << csv_header
167
181
Original file line number Diff line number Diff line change 1
1
< div class ="contextual ">
2
2
<%= link_to_csv_export ( @timesheet ) %>
3
- <%= permalink_to_timesheet ( @timesheet ) %>
3
+ <%= form_for_to_timesheet ( @timesheet ) %>
4
4
</ div >
5
5
6
6
< h2 > <%= l ( :timesheet_title ) %> </ h2 >
Original file line number Diff line number Diff line change 1
1
require 'redmine'
2
2
3
- ## Taken from lib/redmine.rb
4
- # if RUBY_VERSION < '1.9'
5
- # require 'faster_csv'
6
- # else
7
- # require 'csv'
8
- # FCSV = CSV
9
- # end
3
+ # Taken from lib/redmine.rb
4
+ if RUBY_VERSION < '1.9'
5
+ require 'faster_csv'
6
+ else
7
+ require 'csv'
8
+ FCSV = CSV
9
+ end
10
10
11
11
if Rails ::VERSION ::MAJOR < 3
12
12
require 'dispatcher'
You can’t perform that action at this time.
0 commit comments