@@ -154,6 +154,14 class TimelogController < ApplicationController | |||||
154 |
|
154 | |||
155 | render :layout => !request.xhr? |
|
155 | render :layout => !request.xhr? | |
156 | } |
|
156 | } | |
|
157 | format.atom { | |||
|
158 | entries = TimeEntry.find(:all, | |||
|
159 | :include => [:project, :activity, :user, {:issue => :tracker}], | |||
|
160 | :conditions => cond.conditions, | |||
|
161 | :order => "#{TimeEntry.table_name}.created_on DESC", | |||
|
162 | :limit => Setting.feeds_limit.to_i) | |||
|
163 | render_feed(entries, :title => l(:label_spent_time)) | |||
|
164 | } | |||
157 | format.csv { |
|
165 | format.csv { | |
158 | # Export all entries |
|
166 | # Export all entries | |
159 | @entries = TimeEntry.find(:all, |
|
167 | @entries = TimeEntry.find(:all, |
@@ -24,6 +24,11 class TimeEntry < ActiveRecord::Base | |||||
24 | belongs_to :activity, :class_name => 'Enumeration', :foreign_key => :activity_id |
|
24 | belongs_to :activity, :class_name => 'Enumeration', :foreign_key => :activity_id | |
25 |
|
25 | |||
26 | attr_protected :project_id, :user_id, :tyear, :tmonth, :tweek |
|
26 | attr_protected :project_id, :user_id, :tyear, :tmonth, :tweek | |
|
27 | ||||
|
28 | acts_as_event :title => Proc.new {|o| "#{o.user}: #{lwr(:label_f_hour, o.hours)} (#{(o.issue || o.project).event_title})"}, | |||
|
29 | :url => Proc.new {|o| {:controller => 'timelog', :action => 'details', :project_id => o.project}}, | |||
|
30 | :author => :user, | |||
|
31 | :description => :comments | |||
27 |
|
32 | |||
28 | validates_presence_of :user_id, :activity_id, :project_id, :hours, :spent_on |
|
33 | validates_presence_of :user_id, :activity_id, :project_id, :hours, :spent_on | |
29 | validates_numericality_of :hours, :allow_nil => true |
|
34 | validates_numericality_of :hours, :allow_nil => true |
@@ -24,8 +24,13 | |||||
24 |
|
24 | |||
25 | <p class="other-formats"> |
|
25 | <p class="other-formats"> | |
26 | <%= l(:label_export_to) %> |
|
26 | <%= l(:label_export_to) %> | |
|
27 | <span><%= link_to 'Atom', {:issue_id => @issue, :format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span> | |||
27 | <span><%= link_to 'CSV', params.merge(:format => 'csv'), :class => 'csv' %></span> |
|
28 | <span><%= link_to 'CSV', params.merge(:format => 'csv'), :class => 'csv' %></span> | |
28 | </p> |
|
29 | </p> | |
29 | <% end %> |
|
30 | <% end %> | |
30 |
|
31 | |||
31 | <% html_title l(:label_spent_time), l(:label_details) %> |
|
32 | <% html_title l(:label_spent_time), l(:label_details) %> | |
|
33 | ||||
|
34 | <% content_for :header_tags do %> | |||
|
35 | <%= auto_discovery_link_tag(:atom, {:issue_id => @issue, :format => 'atom', :key => User.current.rss_key}, :title => l(:label_spent_time)) %> | |||
|
36 | <% end %> |
@@ -210,6 +210,14 class TimelogControllerTest < Test::Unit::TestCase | |||||
210 | assert_equal '2007-04-22'.to_date, assigns(:to) |
|
210 | assert_equal '2007-04-22'.to_date, assigns(:to) | |
211 | end |
|
211 | end | |
212 |
|
212 | |||
|
213 | def test_details_atom_feed | |||
|
214 | get :details, :project_id => 1, :format => 'atom' | |||
|
215 | assert_response :success | |||
|
216 | assert_equal 'application/atom+xml', @response.content_type | |||
|
217 | assert_not_nil assigns(:items) | |||
|
218 | assert assigns(:items).first.is_a?(TimeEntry) | |||
|
219 | end | |||
|
220 | ||||
213 | def test_details_csv_export |
|
221 | def test_details_csv_export | |
214 | get :details, :project_id => 1, :format => 'csv' |
|
222 | get :details, :project_id => 1, :format => 'csv' | |
215 | assert_response :success |
|
223 | assert_response :success |
General Comments 0
You need to be logged in to leave comments.
Login now