Default columns displayed on the issue list can now be selected at application level.

Saved queries can overide this selection.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@785 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-10-01 12:04:24 +00:00
parent 514cdacc87
commit c6e61a5f19
18 changed files with 44 additions and 13 deletions

View File

@ -16,12 +16,11 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class QueryColumn
attr_accessor :name, :sortable, :default
attr_accessor :name, :sortable
def initialize(name, options={})
self.name = name
self.sortable = options[:sortable]
self.default = options[:default]
end
def default?; default end
@ -73,12 +72,12 @@ class Query < ActiveRecord::Base
cattr_reader :operators_by_filter_type
@@available_columns = [
QueryColumn.new(:tracker, :sortable => "#{Tracker.table_name}.position", :default => true),
QueryColumn.new(:status, :sortable => "#{IssueStatus.table_name}.position", :default => true),
QueryColumn.new(:priority, :sortable => "#{Issue.table_name}.priority_id", :default => true),
QueryColumn.new(:subject, :default => true),
QueryColumn.new(:assigned_to, :sortable => "#{User.table_name}.lastname", :default => true),
QueryColumn.new(:updated_on, :sortable => "#{Issue.table_name}.updated_on", :default => true),
QueryColumn.new(:tracker, :sortable => "#{Tracker.table_name}.position"),
QueryColumn.new(:status, :sortable => "#{IssueStatus.table_name}.position"),
QueryColumn.new(:priority, :sortable => "#{Issue.table_name}.priority_id"),
QueryColumn.new(:subject),
QueryColumn.new(:assigned_to, :sortable => "#{User.table_name}.lastname"),
QueryColumn.new(:updated_on, :sortable => "#{Issue.table_name}.updated_on"),
QueryColumn.new(:category, :sortable => "#{IssueCategory.table_name}.name"),
QueryColumn.new(:start_date, :sortable => "#{Issue.table_name}.start_date"),
QueryColumn.new(:due_date, :sortable => "#{Issue.table_name}.due_date"),
@ -209,7 +208,7 @@ class Query < ActiveRecord::Base
def columns
if has_default_columns?
available_columns.select {|c| c.default? }
available_columns.select {|c| Setting.issue_list_default_columns.include?(c.name.to_s) }
else
# preserve the column_names order
column_names.collect {|name| available_columns.find {|col| col.name == name}}.compact

View File

@ -1,8 +1,8 @@
<h2><%= l(:label_settings) %></h2>
<div id="settings">
<% form_tag({:action => 'edit'}, :class => "tabular") do %>
<div class="box">
<% form_tag({:action => 'edit'}) do %>
<div class="box tabular">
<p><label><%= l(:setting_app_title) %></label>
<%= text_field_tag 'settings[app_title]', Setting.app_title, :size => 30 %></p>
@ -50,7 +50,15 @@
<%= check_box_tag 'settings[sys_api_enabled]', 1, Setting.sys_api_enabled? %><%= hidden_field_tag 'settings[sys_api_enabled]', 0 %></p>
</div>
<fieldset class="box"><legend><%= l(:label_authentication) %></legend>
<fieldset class="box"><legend><%= l(:setting_issue_list_default_columns) %></legend>
<%= hidden_field_tag 'settings[issue_list_default_columns][]', '' %>
<p><% Query.available_columns.each do |column| %>
<label><%= check_box_tag 'settings[issue_list_default_columns][]', column.name, Setting.issue_list_default_columns.include?(column.name.to_s) %>
<%= l("field_#{column.name}") %></label>
<% end %></p>
</fieldset>
<fieldset class="box tabular"><legend><%= l(:label_authentication) %></legend>
<p><label><%= l(:setting_login_required) %></label>
<%= check_box_tag 'settings[login_required]', 1, Setting.login_required? %><%= hidden_field_tag 'settings[login_required]', 0 %></p>
@ -64,7 +72,7 @@
<%= check_box_tag 'settings[lost_password]', 1, Setting.lost_password? %><%= hidden_field_tag 'settings[lost_password]', 0 %></p>
</fieldset>
<fieldset class="box"><legend><%= l(:text_issues_ref_in_commit_messages) %></legend>
<fieldset class="box tabular"><legend><%= l(:text_issues_ref_in_commit_messages) %></legend>
<p><label><%= l(:setting_commit_ref_keywords) %></label>
<%= text_field_tag 'settings[commit_ref_keywords]', Setting.commit_ref_keywords, :size => 30 %><br /><em><%= l(:text_comma_separated) %></em></p>

View File

@ -79,4 +79,13 @@ notified_events:
default: --
- issue_added
- issue_updated
issue_list_default_columns:
serialized: true
default: --
- tracker
- status
- priority
- subject
- assigned_to
- updated_on

View File

@ -513,3 +513,4 @@ label_file_plural: Files
label_changeset_plural: Changesets
field_column_names: Columns
label_default_columns: Default columns
setting_issue_list_default_columns: Default columns displayed on the issue list

View File

@ -513,3 +513,4 @@ field_estimated_hours: Estimated time
label_changeset_plural: Changesets
field_column_names: Columns
label_default_columns: Default columns
setting_issue_list_default_columns: Default columns displayed on the issue list

View File

@ -513,3 +513,4 @@ label_file_plural: Files
label_changeset_plural: Changesets
field_column_names: Columns
label_default_columns: Default columns
setting_issue_list_default_columns: Default columns displayed on the issue list

View File

@ -181,6 +181,7 @@ setting_commit_fix_keywords: Fixing keywords
setting_autologin: Autologin
setting_date_format: Date format
setting_cross_project_issue_relations: Allow cross-project issue relations
setting_issue_list_default_columns: Default columns displayed on the issue list
label_user: User
label_user_plural: Users

View File

@ -513,3 +513,4 @@ label_file_plural: Files
label_changeset_plural: Changesets
field_column_names: Columns
label_default_columns: Default columns
setting_issue_list_default_columns: Default columns displayed on the issue list

View File

@ -181,6 +181,7 @@ setting_commit_fix_keywords: Mot-clés de résolution
setting_autologin: Autologin
setting_date_format: Format de date
setting_cross_project_issue_relations: Autoriser les relations entre demandes de différents projets
setting_issue_list_default_columns: Colonnes affichées par défaut sur la liste des demandes
label_user: Utilisateur
label_user_plural: Utilisateurs

View File

@ -513,3 +513,4 @@ label_file_plural: Files
label_changeset_plural: Changesets
field_column_names: Columns
label_default_columns: Default columns
setting_issue_list_default_columns: Default columns displayed on the issue list

View File

@ -514,3 +514,4 @@ label_file_plural: Files
label_changeset_plural: Changesets
field_column_names: Columns
label_default_columns: Default columns
setting_issue_list_default_columns: Default columns displayed on the issue list

View File

@ -514,3 +514,4 @@ label_file_plural: Files
label_changeset_plural: Changesets
field_column_names: Columns
label_default_columns: Default columns
setting_issue_list_default_columns: Default columns displayed on the issue list

View File

@ -513,3 +513,4 @@ label_file_plural: Pliki
label_changeset_plural: Zestawienia zmian
field_column_names: Columns
label_default_columns: Default columns
setting_issue_list_default_columns: Default columns displayed on the issue list

View File

@ -513,3 +513,4 @@ label_file_plural: Files
label_changeset_plural: Changesets
field_column_names: Columns
label_default_columns: Default columns
setting_issue_list_default_columns: Default columns displayed on the issue list

View File

@ -513,3 +513,4 @@ label_file_plural: Files
label_changeset_plural: Changesets
field_column_names: Columns
label_default_columns: Default columns
setting_issue_list_default_columns: Default columns displayed on the issue list

View File

@ -513,3 +513,4 @@ label_file_plural: Files
label_changeset_plural: Changesets
field_column_names: Columns
label_default_columns: Default columns
setting_issue_list_default_columns: Default columns displayed on the issue list

View File

@ -514,3 +514,4 @@ label_file_plural: Files
label_changeset_plural: Changesets
field_column_names: Columns
label_default_columns: Default columns
setting_issue_list_default_columns: Default columns displayed on the issue list

View File

@ -516,3 +516,4 @@ label_file_plural: Files
label_changeset_plural: Changesets
field_column_names: Columns
label_default_columns: Default columns
setting_issue_list_default_columns: Default columns displayed on the issue list