@@ -20,8 +20,8 class TimelogController < ApplicationController | |||||
20 | before_filter :find_project, :only => [:new, :create] |
|
20 | before_filter :find_project, :only => [:new, :create] | |
21 | before_filter :find_time_entry, :only => [:show, :edit, :update] |
|
21 | before_filter :find_time_entry, :only => [:show, :edit, :update] | |
22 | before_filter :find_time_entries, :only => [:bulk_edit, :bulk_update, :destroy] |
|
22 | before_filter :find_time_entries, :only => [:bulk_edit, :bulk_update, :destroy] | |
23 | before_filter :authorize, :except => [:index] |
|
23 | before_filter :authorize, :except => [:index, :report] | |
24 | before_filter :find_optional_project, :only => [:index] |
|
24 | before_filter :find_optional_project, :only => [:index, :report] | |
25 | accept_rss_auth :index |
|
25 | accept_rss_auth :index | |
26 | accept_api_auth :index, :show, :create, :update, :destroy |
|
26 | accept_api_auth :index, :show, :create, :update, :destroy | |
27 |
|
27 | |||
@@ -95,6 +95,16 class TimelogController < ApplicationController | |||||
95 | end |
|
95 | end | |
96 | end |
|
96 | end | |
97 |
|
97 | |||
|
98 | def report | |||
|
99 | retrieve_date_range | |||
|
100 | @report = Redmine::Helpers::TimeReport.new(@project, @issue, params[:criteria], params[:columns], @from, @to) | |||
|
101 | ||||
|
102 | respond_to do |format| | |||
|
103 | format.html { render :layout => !request.xhr? } | |||
|
104 | format.csv { send_data(report_to_csv(@report), :type => 'text/csv; header=present', :filename => 'timelog.csv') } | |||
|
105 | end | |||
|
106 | end | |||
|
107 | ||||
98 | def show |
|
108 | def show | |
99 | respond_to do |format| |
|
109 | respond_to do |format| | |
100 | # TODO: Implement html response |
|
110 | # TODO: Implement html response |
@@ -68,7 +68,7 | |||||
68 | <h3><%= l(:label_spent_time) %></h3> |
|
68 | <h3><%= l(:label_spent_time) %></h3> | |
69 | <p><span class="icon icon-time"><%= l_hours(@total_hours) %></span></p> |
|
69 | <p><span class="icon icon-time"><%= l_hours(@total_hours) %></span></p> | |
70 | <p><%= link_to(l(:label_details), {:controller => 'timelog', :action => 'index', :project_id => @project}) %> | |
|
70 | <p><%= link_to(l(:label_details), {:controller => 'timelog', :action => 'index', :project_id => @project}) %> | | |
71 |
<%= link_to(l(:label_report), {:controller => 'time |
|
71 | <%= link_to(l(:label_report), {:controller => 'timelog', :action => 'report', :project_id => @project}) %></p> | |
72 | <% end %> |
|
72 | <% end %> | |
73 | <%= call_hook(:view_projects_show_sidebar_bottom, :project => @project) %> |
|
73 | <%= call_hook(:view_projects_show_sidebar_bottom, :project => @project) %> | |
74 | <% end %> |
|
74 | <% end %> |
@@ -32,7 +32,7 | |||||
32 | <ul> |
|
32 | <ul> | |
33 | <li><%= link_to(l(:label_details), url_params.merge({:controller => 'timelog', :action => 'index', :project_id => @project, :issue_id => @issue }), |
|
33 | <li><%= link_to(l(:label_details), url_params.merge({:controller => 'timelog', :action => 'index', :project_id => @project, :issue_id => @issue }), | |
34 | :class => (@controller.action_name == 'index' ? 'selected' : nil)) %></li> |
|
34 | :class => (@controller.action_name == 'index' ? 'selected' : nil)) %></li> | |
35 |
<li><%= link_to(l(:label_report), url_params.merge({:controller => 'time |
|
35 | <li><%= link_to(l(:label_report), url_params.merge({:controller => 'timelog', :action => 'report', :project_id => @project, :issue_id => @issue}), | |
36 | :class => (@controller.action_name == 'report' ? 'selected' : nil)) %></li> |
|
36 | :class => (@controller.action_name == 'report' ? 'selected' : nil)) %></li> | |
37 | </ul> |
|
37 | </ul> | |
38 | </div> |
|
38 | </div> |
1 | NO CONTENT: file renamed from app/views/time_entry_reports/_report_criteria.html.erb to app/views/timelog/_report_criteria.html.erb |
|
NO CONTENT: file renamed from app/views/time_entry_reports/_report_criteria.html.erb to app/views/timelog/_report_criteria.html.erb |
@@ -6,7 +6,7 | |||||
6 |
|
6 | |||
7 | <h2><%= l(:label_spent_time) %></h2> |
|
7 | <h2><%= l(:label_spent_time) %></h2> | |
8 |
|
8 | |||
9 |
<% form_tag({:controller => 'time |
|
9 | <% form_tag({:controller => 'timelog', :action => 'report', :project_id => @project, :issue_id => @issue}, :method => :get, :id => 'query_form') do %> | |
10 | <% @report.criteria.each do |criterion| %> |
|
10 | <% @report.criteria.each do |criterion| %> | |
11 | <%= hidden_field_tag 'criteria[]', criterion, :id => nil %> |
|
11 | <%= hidden_field_tag 'criteria[]', criterion, :id => nil %> | |
12 | <% end %> |
|
12 | <% end %> |
@@ -14,15 +14,6 ActionController::Routing::Routes.draw do |map| | |||||
14 | map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow' |
|
14 | map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow' | |
15 | map.connect 'help/:ctrl/:page', :controller => 'help' |
|
15 | map.connect 'help/:ctrl/:page', :controller => 'help' | |
16 |
|
16 | |||
17 | map.with_options :controller => 'time_entry_reports', :action => 'report',:conditions => {:method => :get} do |time_report| |
|
|||
18 | time_report.connect 'projects/:project_id/issues/:issue_id/time_entries/report' |
|
|||
19 | time_report.connect 'projects/:project_id/issues/:issue_id/time_entries/report.:format' |
|
|||
20 | time_report.connect 'projects/:project_id/time_entries/report' |
|
|||
21 | time_report.connect 'projects/:project_id/time_entries/report.:format' |
|
|||
22 | time_report.connect 'time_entries/report' |
|
|||
23 | time_report.connect 'time_entries/report.:format' |
|
|||
24 | end |
|
|||
25 |
|
||||
26 | map.bulk_edit_time_entry 'time_entries/bulk_edit', |
|
17 | map.bulk_edit_time_entry 'time_entries/bulk_edit', | |
27 | :controller => 'timelog', :action => 'bulk_edit', :conditions => { :method => :get } |
|
18 | :controller => 'timelog', :action => 'bulk_edit', :conditions => { :method => :get } | |
28 | map.bulk_update_time_entry 'time_entries/bulk_edit', |
|
19 | map.bulk_update_time_entry 'time_entries/bulk_edit', | |
@@ -30,7 +21,7 ActionController::Routing::Routes.draw do |map| | |||||
30 | map.time_entries_context_menu '/time_entries/context_menu', |
|
21 | map.time_entries_context_menu '/time_entries/context_menu', | |
31 | :controller => 'context_menus', :action => 'time_entries' |
|
22 | :controller => 'context_menus', :action => 'time_entries' | |
32 |
|
23 | |||
33 | map.resources :time_entries, :controller => 'timelog' |
|
24 | map.resources :time_entries, :controller => 'timelog', :collection => {:report => :get} | |
34 |
|
25 | |||
35 | map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post} |
|
26 | map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post} | |
36 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get} |
|
27 | map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get} | |
@@ -79,7 +70,7 ActionController::Routing::Routes.draw do |map| | |||||
79 | end |
|
70 | end | |
80 |
|
71 | |||
81 | map.resources :issues do |issues| |
|
72 | map.resources :issues do |issues| | |
82 | issues.resources :time_entries, :controller => 'timelog' |
|
73 | issues.resources :time_entries, :controller => 'timelog', :collection => {:report => :get} | |
83 | issues.resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy] |
|
74 | issues.resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy] | |
84 | end |
|
75 | end | |
85 |
|
76 | |||
@@ -118,12 +109,12 ActionController::Routing::Routes.draw do |map| | |||||
118 | } do |project| |
|
109 | } do |project| | |
119 | project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy] |
|
110 | project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy] | |
120 | project.resources :issues, :only => [:index, :new, :create] do |issues| |
|
111 | project.resources :issues, :only => [:index, :new, :create] do |issues| | |
121 | issues.resources :time_entries, :controller => 'timelog' |
|
112 | issues.resources :time_entries, :controller => 'timelog', :collection => {:report => :get} | |
122 | end |
|
113 | end | |
123 | project.resources :files, :only => [:index, :new, :create] |
|
114 | project.resources :files, :only => [:index, :new, :create] | |
124 | project.resources :versions, :shallow => true, :collection => {:close_completed => :put}, :member => {:status_by => :post} |
|
115 | project.resources :versions, :shallow => true, :collection => {:close_completed => :put}, :member => {:status_by => :post} | |
125 | project.resources :news, :shallow => true |
|
116 | project.resources :news, :shallow => true | |
126 | project.resources :time_entries, :controller => 'timelog', :path_prefix => 'projects/:project_id' |
|
117 | project.resources :time_entries, :controller => 'timelog', :path_prefix => 'projects/:project_id', :collection => {:report => :get} | |
127 | project.resources :queries, :only => [:new, :create] |
|
118 | project.resources :queries, :only => [:new, :create] | |
128 | project.resources :issue_categories, :shallow => true |
|
119 | project.resources :issue_categories, :shallow => true | |
129 | project.resources :documents, :shallow => true, :member => {:add_attachment => :post} |
|
120 | project.resources :documents, :shallow => true, :member => {:add_attachment => :post} |
@@ -89,7 +89,7 Redmine::AccessControl.map do |map| | |||||
89 |
|
89 | |||
90 | map.project_module :time_tracking do |map| |
|
90 | map.project_module :time_tracking do |map| | |
91 | map.permission :log_time, {:timelog => [:new, :create]}, :require => :loggedin |
|
91 | map.permission :log_time, {:timelog => [:new, :create]}, :require => :loggedin | |
92 |
map.permission :view_time_entries, :timelog => [:index, :show] |
|
92 | map.permission :view_time_entries, :timelog => [:index, :report, :show] | |
93 | map.permission :edit_time_entries, {:timelog => [:edit, :update, :destroy, :bulk_edit, :bulk_update]}, :require => :member |
|
93 | map.permission :edit_time_entries, {:timelog => [:edit, :update, :destroy, :bulk_edit, :bulk_update]}, :require => :member | |
94 | map.permission :edit_own_time_entries, {:timelog => [:edit, :update, :destroy,:bulk_edit, :bulk_update]}, :require => :loggedin |
|
94 | map.permission :edit_own_time_entries, {:timelog => [:edit, :update, :destroy,:bulk_edit, :bulk_update]}, :require => :loggedin | |
95 | map.permission :manage_project_activities, {:project_enumerations => [:update, :destroy]}, :require => :member |
|
95 | map.permission :manage_project_activities, {:project_enumerations => [:update, :destroy]}, :require => :member |
@@ -2,6 +2,8 | |||||
2 | require File.expand_path('../../test_helper', __FILE__) |
|
2 | require File.expand_path('../../test_helper', __FILE__) | |
3 |
|
3 | |||
4 | class TimeEntryReportsControllerTest < ActionController::TestCase |
|
4 | class TimeEntryReportsControllerTest < ActionController::TestCase | |
|
5 | tests TimelogController | |||
|
6 | ||||
5 | fixtures :projects, :enabled_modules, :roles, :members, :member_roles, |
|
7 | fixtures :projects, :enabled_modules, :roles, :members, :member_roles, | |
6 | :issues, :time_entries, :users, :trackers, :enumerations, |
|
8 | :issues, :time_entries, :users, :trackers, :enumerations, | |
7 | :issue_statuses, :custom_fields, :custom_values |
|
9 | :issue_statuses, :custom_fields, :custom_values |
@@ -329,12 +329,10 class RoutingTest < ActionController::IntegrationTest | |||||
329 | should_route :put, "/projects/ecookbook/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234', :project_id => 'ecookbook' |
|
329 | should_route :put, "/projects/ecookbook/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234', :project_id => 'ecookbook' | |
330 |
|
330 | |||
331 | should_route :delete, "/projects/ecookbook/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234', :project_id => 'ecookbook' |
|
331 | should_route :delete, "/projects/ecookbook/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234', :project_id => 'ecookbook' | |
332 | end |
|
|||
333 |
|
332 | |||
334 | context "time_entry_reports" do |
|
333 | should_route :get, "/time_entries/report", :controller => 'timelog', :action => 'report' | |
335 |
should_route :get, "/time_entries/report", :controller => 'time |
|
334 | should_route :get, "/projects/567/time_entries/report", :controller => 'timelog', :action => 'report', :project_id => '567' | |
336 |
should_route :get, "/projects/567/time_entries/report", :controller => 'time |
|
335 | should_route :get, "/projects/567/time_entries/report.csv", :controller => 'timelog', :action => 'report', :project_id => '567', :format => 'csv' | |
337 | should_route :get, "/projects/567/time_entries/report.csv", :controller => 'time_entry_reports', :action => 'report', :project_id => '567', :format => 'csv' |
|
|||
338 | end |
|
336 | end | |
339 |
|
337 | |||
340 | context "users" do |
|
338 | context "users" do |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now