Feature #29482 » 0006-Set-default-columns-for-the-projects-list.patch
app/controllers/projects_controller.rb | ||
---|---|---|
274 | 274 |
end |
275 | 275 | |
276 | 276 |
def retrieve_project_query |
277 |
retrieve_query(ProjectQuery, false) |
|
277 |
retrieve_query(ProjectQuery, false, :defaults => @default_columns_names)
|
|
278 | 278 |
end |
279 | 279 |
end |
app/models/project_query.rb | ||
---|---|---|
69 | 69 |
end |
70 | 70 | |
71 | 71 |
def default_columns_names |
72 |
@default_columns_names ||= [:name, :identifier, :short_description]
|
|
72 |
@default_columns_names = Setting.project_list_defaults.symbolize_keys[:column_names].map(&:to_sym)
|
|
73 | 73 |
end |
74 | 74 | |
75 | 75 |
def default_sort_criteria |
app/views/settings/_projects.html.erb | ||
---|---|---|
16 | 16 |
:blank => "--- #{l(:actionview_instancetag_blank_option)} ---" %></p> |
17 | 17 |
</div> |
18 | 18 | |
19 |
<fieldset class="box"> |
|
20 |
<legend><%= l(:setting_project_list_defaults) %></legend> |
|
21 |
<% query = ProjectQuery.new(Setting.project_list_defaults) %> |
|
22 |
<%= render_query_columns_selection(query, |
|
23 |
:name => 'settings[project_list_defaults][column_names]') %> |
|
24 |
</fieldset> |
|
25 | ||
26 | ||
19 | 27 |
<%= submit_tag l(:button_save) %> |
20 | 28 |
<% end %> |
config/locales/en.yml | ||
---|---|---|
484 | 484 |
setting_timelog_max_hours_per_day: Maximum hours that can be logged per day and user |
485 | 485 |
setting_timelog_accept_future_dates: Accept time logs on future dates |
486 | 486 |
setting_show_status_changes_in_mail_subject: Show status changes in issue mail notifications subject |
487 |
setting_project_list_defaults: Projects list defaults |
|
487 | 488 | |
488 | 489 |
permission_add_project: Create project |
489 | 490 |
permission_add_subprojects: Create subprojects |
config/settings.yml | ||
---|---|---|
230 | 230 |
- hours |
231 | 231 |
totalable_names: |
232 | 232 |
- hours |
233 |
project_list_defaults: |
|
234 |
serialized: true |
|
235 |
default: |
|
236 |
column_names: |
|
237 |
- name |
|
238 |
- identifier |
|
239 |
- short_description |
|
233 | 240 |
issue_done_ratio: |
234 | 241 |
default: 'issue_field' |
235 | 242 |
default_projects_public: |
test/functional/projects_controller_test.rb | ||
---|---|---|
147 | 147 |
assert_include 'idnt-2', child_level2 |
148 | 148 |
end |
149 | 149 | |
150 |
def test_index_with_default_query_setting |
|
151 |
with_settings :project_list_defaults => {'column_names' => %w(name short_description status)} do |
|
152 |
get :index, :params => { |
|
153 |
:display_type => 'list' |
|
154 |
} |
|
155 |
assert_response :success |
|
156 |
end |
|
157 |
assert_equal ['Name', 'Description', 'Status'], columns_in_list |
|
158 |
end |
|
159 | ||
150 | 160 |
def test_autocomplete_js |
151 | 161 |
get :autocomplete, :params => { |
152 | 162 |
:format => 'js', |