mirror of
https://github.com/redmine/redmine.git
synced 2025-11-16 18:26:02 +01:00
Column Project is no longer added by default to the list of default columns for time entries (#26537).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@17503 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -283,6 +283,6 @@ private
|
|||||||
end
|
end
|
||||||
|
|
||||||
def retrieve_time_entry_query
|
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
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -103,14 +103,13 @@ class TimeEntryQuery < Query
|
|||||||
|
|
||||||
def default_columns_names
|
def default_columns_names
|
||||||
@default_columns_names ||= begin
|
@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
|
project.present? ? default_columns : [:project] | default_columns
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def default_totalable_names
|
def default_totalable_names
|
||||||
[:hours]
|
Setting.time_entry_list_defaults.symbolize_keys[:totalable_names].map(&:to_sym)
|
||||||
end
|
end
|
||||||
|
|
||||||
def default_sort_criteria
|
def default_sort_criteria
|
||||||
|
|||||||
@@ -13,9 +13,9 @@
|
|||||||
<legend><%= l(:setting_time_entry_list_defaults) %></legend>
|
<legend><%= l(:setting_time_entry_list_defaults) %></legend>
|
||||||
|
|
||||||
<% query = TimeEntryQuery.new(Setting.time_entry_list_defaults) %>
|
<% query = TimeEntryQuery.new(Setting.time_entry_list_defaults) %>
|
||||||
|
<%= hidden_field_tag('settings[time_entry_list_defaults][column_names][]', '') %>
|
||||||
<%= render_query_columns_selection(query,
|
<%= render_query_columns_selection(query,
|
||||||
:name => 'settings[time_entry_list_defaults][column_names]') %>
|
:name => 'settings[time_entry_list_defaults][column_names]') %>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<label><%= l(:label_total_plural) %></label>
|
<label><%= l(:label_total_plural) %></label>
|
||||||
<%= available_totalable_columns_tags(query,
|
<%= available_totalable_columns_tags(query,
|
||||||
|
|||||||
@@ -219,6 +219,8 @@ time_entry_list_defaults:
|
|||||||
- issue
|
- issue
|
||||||
- comments
|
- comments
|
||||||
- hours
|
- hours
|
||||||
|
totalable_names:
|
||||||
|
- hours
|
||||||
issue_done_ratio:
|
issue_done_ratio:
|
||||||
default: 'issue_field'
|
default: 'issue_field'
|
||||||
default_projects_public:
|
default_projects_public:
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class TimelogControllerTest < Redmine::ControllerTest
|
|||||||
:trackers, :enumerations, :issue_statuses,
|
:trackers, :enumerations, :issue_statuses,
|
||||||
:custom_fields, :custom_values,
|
:custom_fields, :custom_values,
|
||||||
:projects_trackers, :custom_fields_trackers,
|
:projects_trackers, :custom_fields_trackers,
|
||||||
:custom_fields_projects
|
:custom_fields_projects, :issue_categories
|
||||||
|
|
||||||
include Redmine::I18n
|
include Redmine::I18n
|
||||||
|
|
||||||
@@ -744,29 +744,31 @@ class TimelogControllerTest < Redmine::ControllerTest
|
|||||||
assert_select '.total-for-hours', :text => 'Hours: 162.90'
|
assert_select '.total-for-hours', :text => 'Hours: 162.90'
|
||||||
assert_select 'form#query_form[action=?]', '/time_entries'
|
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
|
assert_select '.query-totals>span', 1
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_index_with_default_query_setting
|
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
|
get :index
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_select 'table.time-entries thead' do
|
assert_select 'table.time-entries thead' do
|
||||||
|
assert_select 'th.project'
|
||||||
assert_select 'th.spent_on'
|
assert_select 'th.spent_on'
|
||||||
assert_select 'th.issue'
|
assert_select 'th.issue'
|
||||||
assert_select 'th.user'
|
assert_select 'th.user'
|
||||||
assert_select 'th.hours'
|
assert_select 'th.hours'
|
||||||
end
|
end
|
||||||
assert_select 'table.time-entries tbody' do
|
assert_select 'table.time-entries tbody' do
|
||||||
|
assert_select 'td.project'
|
||||||
assert_select 'td.spent_on'
|
assert_select 'td.spent_on'
|
||||||
assert_select 'td.issue'
|
assert_select 'td.issue'
|
||||||
assert_select 'td.user'
|
assert_select 'td.user'
|
||||||
assert_select 'td.hours'
|
assert_select 'td.hours'
|
||||||
end
|
end
|
||||||
assert_equal ['Date', 'Issue', 'User', 'Hours'], columns_in_list
|
assert_equal ['Project', 'Date', 'Issue', 'User', 'Hours'], columns_in_list
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_index_with_default_query_setting_using_custom_field
|
def test_index_with_default_query_setting_using_custom_field
|
||||||
@@ -780,7 +782,7 @@ class TimelogControllerTest < Redmine::ControllerTest
|
|||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
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-hours'
|
||||||
assert_select ".total-for-cf-#{field.id}"
|
assert_select ".total-for-cf-#{field.id}"
|
||||||
|
|||||||
Reference in New Issue
Block a user