diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2019-10-19 11:42:20 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2019-10-19 11:42:20 +0000 |
commit | 45f039187df03e8925cb0d08ccc1838c9ea2d5c2 (patch) | |
tree | 3bbb8958c71b24e65123c0e8f29d6f15726424d5 /app/models/project_query.rb | |
parent | ecd9d9ba2f43f2f5a88c1d34d34d07dae40dfe4e (diff) | |
download | redmine-45f039187df03e8925cb0d08ccc1838c9ea2d5c2.tar.gz redmine-45f039187df03e8925cb0d08ccc1838c9ea2d5c2.zip |
Option to switch between table list and board list (#29482).
Patch by Marius BALTEANU.
git-svn-id: http://svn.redmine.org/redmine/trunk@18765 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/project_query.rb')
-rw-r--r-- | app/models/project_query.rb | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/app/models/project_query.rb b/app/models/project_query.rb index 2bc6b40e1..ecf3e687b 100644 --- a/app/models/project_query.rb +++ b/app/models/project_query.rb @@ -22,7 +22,16 @@ class ProjectQuery < Query self.queried_class = Project self.view_permission = :search_project - self.available_columns = [] + self.available_columns = [ + QueryColumn.new(:name, :sortable => "#{Project.table_name}.name"), + QueryColumn.new(:status, :sortable => "#{Project.table_name}.status"), + QueryColumn.new(:short_description, :sortable => "#{Project.table_name}.description", :caption => :field_description), + QueryColumn.new(:homepage, :sortable => "#{Project.table_name}.homepage"), + QueryColumn.new(:identifier, :sortable => "#{Project.table_name}.identifier"), + QueryColumn.new(:parent_id, :sortable => "#{Project.table_name}.lft ASC", :default_order => 'desc', :caption => :field_parent), + QueryColumn.new(:is_public, :sortable => "#{Project.table_name}.is_public", :groupable => true), + QueryColumn.new(:created_on, :sortable => "#{Project.table_name}.created_on", :default_order => 'desc') + ] def initialize(attributes=nil, *args) super attributes @@ -48,7 +57,23 @@ class ProjectQuery < Query end def available_columns - [] + return @available_columns if @available_columns + @available_columns = self.class.available_columns.dup + @available_columns += ProjectCustomField.visible. + map {|cf| QueryAssociationCustomFieldColumn.new(:project, cf) } + @available_columns + end + + def available_display_types + ['board', 'list'] + end + + def default_columns_names + @default_columns_names ||= [:name, :identifier, :short_description] + end + + def default_sort_criteria + [[]] end def base_scope |