From c6e61a5f1976b30d068fb70198f3cc0c10e464d3 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 1 Oct 2007 12:04:24 +0000 Subject: [PATCH] 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 --- app/models/query.rb | 17 ++++++++--------- app/views/settings/edit.rhtml | 16 ++++++++++++---- config/settings.yml | 9 +++++++++ lang/bg.yml | 1 + lang/cs.yml | 1 + lang/de.yml | 1 + lang/en.yml | 1 + lang/es.yml | 1 + lang/fr.yml | 1 + lang/it.yml | 1 + lang/ja.yml | 1 + lang/nl.yml | 1 + lang/pl.yml | 1 + lang/pt-br.yml | 1 + lang/pt.yml | 1 + lang/ro.yml | 1 + lang/sv.yml | 1 + lang/zh.yml | 1 + 18 files changed, 44 insertions(+), 13 deletions(-) diff --git a/app/models/query.rb b/app/models/query.rb index 30441d260..837b6515a 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -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 diff --git a/app/views/settings/edit.rhtml b/app/views/settings/edit.rhtml index efe8ff640..c3e430c9b 100644 --- a/app/views/settings/edit.rhtml +++ b/app/views/settings/edit.rhtml @@ -1,8 +1,8 @@

<%= l(:label_settings) %>

-<% form_tag({:action => 'edit'}, :class => "tabular") do %> -
+<% form_tag({:action => 'edit'}) do %> +

<%= text_field_tag 'settings[app_title]', Setting.app_title, :size => 30 %>

@@ -50,7 +50,15 @@ <%= check_box_tag 'settings[sys_api_enabled]', 1, Setting.sys_api_enabled? %><%= hidden_field_tag 'settings[sys_api_enabled]', 0 %>

-
<%= l(:label_authentication) %> +
<%= l(:setting_issue_list_default_columns) %> +<%= hidden_field_tag 'settings[issue_list_default_columns][]', '' %> +

<% Query.available_columns.each do |column| %> + +<% end %>

+
+ +
<%= l(:label_authentication) %>

<%= check_box_tag 'settings[login_required]', 1, Setting.login_required? %><%= hidden_field_tag 'settings[login_required]', 0 %>

@@ -64,7 +72,7 @@ <%= check_box_tag 'settings[lost_password]', 1, Setting.lost_password? %><%= hidden_field_tag 'settings[lost_password]', 0 %>

-
<%= l(:text_issues_ref_in_commit_messages) %> +
<%= l(:text_issues_ref_in_commit_messages) %>

<%= text_field_tag 'settings[commit_ref_keywords]', Setting.commit_ref_keywords, :size => 30 %>
<%= l(:text_comma_separated) %>

diff --git a/config/settings.yml b/config/settings.yml index 3bce49167..bac50e3d5 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -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 \ No newline at end of file diff --git a/lang/bg.yml b/lang/bg.yml index 231d59329..3c6671f1e 100644 --- a/lang/bg.yml +++ b/lang/bg.yml @@ -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 diff --git a/lang/cs.yml b/lang/cs.yml index 3415677ef..884530834 100644 --- a/lang/cs.yml +++ b/lang/cs.yml @@ -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 diff --git a/lang/de.yml b/lang/de.yml index c20cbf4e4..b7ae15e68 100644 --- a/lang/de.yml +++ b/lang/de.yml @@ -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 diff --git a/lang/en.yml b/lang/en.yml index 383b49150..f4f71a931 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -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 diff --git a/lang/es.yml b/lang/es.yml index e467a5678..a13136f3e 100644 --- a/lang/es.yml +++ b/lang/es.yml @@ -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 diff --git a/lang/fr.yml b/lang/fr.yml index 129e91e4a..ff0586781 100644 --- a/lang/fr.yml +++ b/lang/fr.yml @@ -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 diff --git a/lang/it.yml b/lang/it.yml index 3b16097e3..c6250837f 100644 --- a/lang/it.yml +++ b/lang/it.yml @@ -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 diff --git a/lang/ja.yml b/lang/ja.yml index 46c292b22..1c3344842 100644 --- a/lang/ja.yml +++ b/lang/ja.yml @@ -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 diff --git a/lang/nl.yml b/lang/nl.yml index cc87f3110..007e80c94 100644 --- a/lang/nl.yml +++ b/lang/nl.yml @@ -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 diff --git a/lang/pl.yml b/lang/pl.yml index a575caf21..7dd04741c 100644 --- a/lang/pl.yml +++ b/lang/pl.yml @@ -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 diff --git a/lang/pt-br.yml b/lang/pt-br.yml index f10a4e9b7..ebc8de173 100644 --- a/lang/pt-br.yml +++ b/lang/pt-br.yml @@ -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 diff --git a/lang/pt.yml b/lang/pt.yml index 0bab2d3f8..549d3cd3a 100644 --- a/lang/pt.yml +++ b/lang/pt.yml @@ -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 diff --git a/lang/ro.yml b/lang/ro.yml index bc9100ff1..cc0b85a7d 100644 --- a/lang/ro.yml +++ b/lang/ro.yml @@ -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 diff --git a/lang/sv.yml b/lang/sv.yml index 83488a4b9..b26675f79 100644 --- a/lang/sv.yml +++ b/lang/sv.yml @@ -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 diff --git a/lang/zh.yml b/lang/zh.yml index 07d57c855..08108ee42 100644 --- a/lang/zh.yml +++ b/lang/zh.yml @@ -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 -- 2.39.5