Skip to content

Commit

Permalink
Fix sorting in group-by options and complete Readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
nanego committed Nov 22, 2023
1 parent d2c83ee commit 2bceae9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Here is a complete list of the features:
* Add customizable **issue colorization** based on status or priority
* Add a user parameter to also **display pagination links at the top of issues results**
* Include the 'notes' field in workflows, providing the capability to **require notes** when updating an issue
* Issues filter: **sort group-by options alphabetically**

## Test status

Expand Down
2 changes: 1 addition & 1 deletion lib/redmine_tiny_features/queries_helper_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def query_available_inline_columns_options(query)
## Get group by coolumns sort by displayed names
def group_by_column_select_tag(query)
options = [[]] + query.groupable_columns
.sort_by { |column| column.name.parameterize } # Patch: sort by displayed names
.sort_by { |column| column.caption.to_sym } # Patch: sort by displayed names
.collect { |c| [c.caption, c.name.to_s] }

select_tag('group_by', options_for_select(options, @query.group_by))
Expand Down
11 changes: 6 additions & 5 deletions spec/system/issues_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,16 @@ def log_user(login, password)
end
end

describe "Group by filter of issues" do
it "Show options in alphabetic order" do
describe "Group-by filter" do
it "shows options in alphabetic order" do
visit 'issues'

# Click on option button
page.all('legend')[1].click

expect(page).to have_selector('select', id: 'group_by')
options = page.all('#group_by option').map(&:value)
expect(page).to have_selector('select', id: 'group_by')

options = page.all('#group_by option').map(&:text)
expect(options).to eq (options.sort)
end
end
Expand Down

0 comments on commit 2bceae9

Please sign in to comment.