Skip to content

Commit

Permalink
#1418 Disable grouping
Browse files Browse the repository at this point in the history
  • Loading branch information
picman committed Jan 19, 2023
1 parent 61c0aab commit e6ce95c
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 deletions.
16 changes: 9 additions & 7 deletions app/models/dmsf_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ class DmsfQuery < Query
# Standard columns
self.available_columns = [
QueryColumn.new(:id, sortable: 'id', caption: +'#'),
DmsfTitleQueryColumn.new(:title, sortable: 'title', frozen: true, caption: :label_column_title),
DmsfQueryTitleColumn.new(:title, sortable: 'title', frozen: true, caption: :label_column_title),
QueryColumn.new(:size, sortable: 'size', caption: :label_column_size),
DmsfModifiedQueryColumn.new(:modified, sortable: 'updated', caption: :label_column_modified),
DmsfVersionQueryColumn.new(:version, sortable: %(major_version minor_version patch_version),
DmsfQueryModifiedColumn.new(:modified, sortable: 'updated', caption: :label_column_modified),
DmsfQueryVersionColumn.new(:version, sortable: %(major_version minor_version patch_version),
caption: :label_column_version),
QueryColumn.new(:workflow, sortable: 'workflow', caption: :label_column_workflow),
QueryColumn.new(:author, sortable: %(firstname lastname), caption: :label_column_author),
Expand All @@ -58,15 +58,17 @@ def available_columns
unless @available_columns
@available_columns = self.class.available_columns.dup
@available_columns += DmsfFileRevisionCustomField.visible.collect do |cf|
c = QueryCustomFieldColumn.new(cf)
# We would like to prevent grouping in the Option form
c.groupable = false
c
QueryCustomFieldColumn.new(cf)
end
end
@available_columns
end

def groupable_columns
# TODO: Implement grouping, then remove this method.
[]
end

def default_columns_names
unless @default_column_names
@default_column_names = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

require 'query'

class DmsfModifiedQueryColumn < QueryColumn
class DmsfQueryModifiedColumn < QueryColumn

def value_object(object)
object.updated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

require 'query'

class DmsfTitleQueryColumn < QueryColumn
class DmsfQueryTitleColumn < QueryColumn

def css_classes
'dmsf-title'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

require 'query'

class DmsfVersionQueryColumn < QueryColumn
class DmsfQueryVersionColumn < QueryColumn

def value_object(object)
DmsfFileRevision.version object.major_version, object.minor_version, object.patch_version
Expand Down
2 changes: 2 additions & 0 deletions test/functional/dmsf_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ def test_show
assert_select 'fieldset#filters'
# Options
assert_select 'fieldset#options'
# Options - no "Group by"
assert_select 'select#group_by', count: 0
# The main table
assert_select 'table.dmsf'
# CSV export
Expand Down
4 changes: 4 additions & 0 deletions test/unit/dmsf_query_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,8 @@ def test_default
end
end

def test_groupable_columns
assert_not @query401.groupable_columns.any?
end

end

0 comments on commit e6ce95c

Please sign in to comment.