@default_columns_names = Setting.project_list_defaults.symbolize_keys[:column_names].map(&:to_sym)
end
+ def default_display_type
+ Setting.project_list_display_type
+ end
+
def default_sort_criteria
[[]]
end
[]
end
+ def default_display_type
+ self.available_display_types.first
+ end
+
def column_names=(names)
if names
names = names.select {|n| n.is_a?(Symbol) || !n.blank? }
end
def display_type
- options[:display_type] || self.available_display_types.first
+ options[:display_type] || self.default_display_type
end
def display_type=(type)
<fieldset class="box">
<legend><%= l(:setting_project_list_defaults) %></legend>
<% query = ProjectQuery.new(Setting.project_list_defaults) %>
+ <p>
+ <label><%= l(:label_display_type) %></label>
+ <% query.available_display_types.each do |t| %>
+ <%= radio_button_tag('settings[project_list_display_type]', t, Setting.project_list_display_type == t, :id => "setting_project_list_display_type_#{t}") %>
+ <%= content_tag('label', l(:"label_display_type_#{t}"), :for => "settings_project_list_display_type_#{t}", :class => "inline") %>
+ <% end %>
+ </p>
<%= render_query_columns_selection(query,
:name => 'settings[project_list_defaults][column_names]') %>
</fieldset>
- hours
totalable_names:
- hours
+project_list_display_type:
+ default: board
project_list_defaults:
serialized: true
default:
query = ProjectQuery.new
assert_include :cf_3, query.available_columns.map(&:name)
end
+
+ def test_display_type_default_should_equal_with_setting_project_list_display_type
+ ProjectQuery.new.available_display_types.each do |t|
+ with_settings :project_list_display_type => t do
+ q = ProjectQuery.new
+ assert_equal t, q.display_type
+ end
+ end
+ end
end