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