summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/timelog_controller.rb2
-rw-r--r--app/models/time_entry_query.rb5
-rw-r--r--app/views/settings/_timelog.html.erb2
-rw-r--r--config/settings.yml2
-rw-r--r--test/functional/timelog_controller_test.rb12
5 files changed, 13 insertions, 10 deletions
diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb
index 50fcab2f7..47dc7c4f5 100644
--- a/app/controllers/timelog_controller.rb
+++ b/app/controllers/timelog_controller.rb
@@ -283,6 +283,6 @@ private
end
def retrieve_time_entry_query
- retrieve_query(TimeEntryQuery, false, :defaults => Setting.time_entry_list_defaults.symbolize_keys)
+ retrieve_query(TimeEntryQuery, false, :defaults => @default_columns_names)
end
end
diff --git a/app/models/time_entry_query.rb b/app/models/time_entry_query.rb
index 1a938c5bf..260800078 100644
--- a/app/models/time_entry_query.rb
+++ b/app/models/time_entry_query.rb
@@ -103,14 +103,13 @@ class TimeEntryQuery < Query
def default_columns_names
@default_columns_names ||= begin
- default_columns = [:spent_on, :user, :activity, :issue, :comments, :hours]
-
+ default_columns = Setting.time_entry_list_defaults.symbolize_keys[:column_names].map(&:to_sym)
project.present? ? default_columns : [:project] | default_columns
end
end
def default_totalable_names
- [:hours]
+ Setting.time_entry_list_defaults.symbolize_keys[:totalable_names].map(&:to_sym)
end
def default_sort_criteria
diff --git a/app/views/settings/_timelog.html.erb b/app/views/settings/_timelog.html.erb
index e3c0a5657..bc5f054c2 100644
--- a/app/views/settings/_timelog.html.erb
+++ b/app/views/settings/_timelog.html.erb
@@ -13,9 +13,9 @@
<legend><%= l(:setting_time_entry_list_defaults) %></legend>
<% query = TimeEntryQuery.new(Setting.time_entry_list_defaults) %>
+ <%= hidden_field_tag('settings[time_entry_list_defaults][column_names][]', '') %>
<%= render_query_columns_selection(query,
:name => 'settings[time_entry_list_defaults][column_names]') %>
-
<p>
<label><%= l(:label_total_plural) %></label>
<%= available_totalable_columns_tags(query,
diff --git a/config/settings.yml b/config/settings.yml
index 10f8c4b7b..80946ec42 100644
--- a/config/settings.yml
+++ b/config/settings.yml
@@ -219,6 +219,8 @@ time_entry_list_defaults:
- issue
- comments
- hours
+ totalable_names:
+ - hours
issue_done_ratio:
default: 'issue_field'
default_projects_public:
diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb
index 273446fd8..47da3e3b7 100644
--- a/test/functional/timelog_controller_test.rb
+++ b/test/functional/timelog_controller_test.rb
@@ -24,7 +24,7 @@ class TimelogControllerTest < Redmine::ControllerTest
:trackers, :enumerations, :issue_statuses,
:custom_fields, :custom_values,
:projects_trackers, :custom_fields_trackers,
- :custom_fields_projects
+ :custom_fields_projects, :issue_categories
include Redmine::I18n
@@ -744,29 +744,31 @@ class TimelogControllerTest < Redmine::ControllerTest
assert_select '.total-for-hours', :text => 'Hours: 162.90'
assert_select 'form#query_form[action=?]', '/time_entries'
- assert_equal ['Date', 'User', 'Activity', 'Issue', 'Comment', 'Hours'], columns_in_list
+ assert_equal ['Project', 'Date', 'User', 'Activity', 'Issue', 'Comment', 'Hours'], columns_in_list
assert_select '.query-totals>span', 1
end
def test_index_with_default_query_setting
- with_settings :time_entry_list_defaults => {'column_names' => %w(spent_on issue user hours)} do
+ with_settings :time_entry_list_defaults => {'column_names' => %w(spent_on issue user hours), 'totalable_names' => []} do
get :index
assert_response :success
end
assert_select 'table.time-entries thead' do
+ assert_select 'th.project'
assert_select 'th.spent_on'
assert_select 'th.issue'
assert_select 'th.user'
assert_select 'th.hours'
end
assert_select 'table.time-entries tbody' do
+ assert_select 'td.project'
assert_select 'td.spent_on'
assert_select 'td.issue'
assert_select 'td.user'
assert_select 'td.hours'
end
- assert_equal ['Date', 'Issue', 'User', 'Hours'], columns_in_list
+ assert_equal ['Project', 'Date', 'Issue', 'User', 'Hours'], columns_in_list
end
def test_index_with_default_query_setting_using_custom_field
@@ -780,7 +782,7 @@ class TimelogControllerTest < Redmine::ControllerTest
assert_response :success
end
- assert_equal ['Date', 'User', 'Hours', 'Foo'], columns_in_list
+ assert_equal ['Project', 'Date', 'User', 'Hours', 'Foo'], columns_in_list
assert_select '.total-for-hours'
assert_select ".total-for-cf-#{field.id}"