Commit 024f3889 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '1157-weight-dropdown-does-not-stay-selected' into 'master'

Weight dropdown not stay selected issue

Closes #1157

See merge request !826
parents f19caa89 dc5107dd
...@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date. ...@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
## 8.14.0 (2016-11-22) ## 8.14.0 (2016-11-22)
- Weight dropdown in issue filter form does not stay selected !826
- gitlab:check rake task checks ES version according to requirements - gitlab:check rake task checks ES version according to requirements
- Convert ASCII-8BIT LDAP DNs to UTF-8 to avoid unnecessary user deletions - Convert ASCII-8BIT LDAP DNs to UTF-8 to avoid unnecessary user deletions
- [Fix] Only owner can see "Projects" button in group edit menu - [Fix] Only owner can see "Projects" button in group edit menu
......
module EeIssuablesHelper
def weight_dropdown_label(weight)
if Issue.weight_options.include?(weight)
weight
else
h(weight.presence || 'Weight')
end
end
end
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
.filter-item.inline.weight-filter .filter-item.inline.weight-filter
- if params[:weight] - if params[:weight]
= hidden_field_tag(:weight, params[:weight]) = hidden_field_tag(:weight, params[:weight])
= dropdown_tag("Weight", options: { title: "Filter by weight", toggle_class: 'js-weight-select js-filter-submit', dropdown_class: "dropdown-menu-selectable", = dropdown_tag(weight_dropdown_label(params[:weight]), options: { title: "Filter by weight", toggle_class: 'js-weight-select js-filter-submit', dropdown_class: "dropdown-menu-selectable",
placeholder: "Search weight", data: { field_name: "weight" , default_label: "Weight" } }) do placeholder: "Search weight", data: { field_name: "weight" , default_label: "Weight" } }) do
%ul %ul
- Issue.weight_options.each do |weight| - Issue.weight_options.each do |weight|
......
...@@ -14,6 +14,7 @@ feature 'Issue filtering by Weight', feature: true do ...@@ -14,6 +14,7 @@ feature 'Issue filtering by Weight', feature: true do
visit_issues(project) visit_issues(project)
filter_by_weight(Issue::WEIGHT_NONE) filter_by_weight(Issue::WEIGHT_NONE)
expect(page).to have_css('.weight-filter .dropdown-toggle-text', text: Issue::WEIGHT_NONE)
expect(page).to have_css('.issue', count: 1) expect(page).to have_css('.issue', count: 1)
end end
...@@ -21,6 +22,7 @@ feature 'Issue filtering by Weight', feature: true do ...@@ -21,6 +22,7 @@ feature 'Issue filtering by Weight', feature: true do
visit_issues(project) visit_issues(project)
filter_by_weight(Issue::WEIGHT_ANY) filter_by_weight(Issue::WEIGHT_ANY)
expect(page).to have_css('.weight-filter .dropdown-toggle-text', text: Issue::WEIGHT_ANY)
expect(page).to have_css('.issue', count: 2) expect(page).to have_css('.issue', count: 2)
end end
...@@ -28,6 +30,7 @@ feature 'Issue filtering by Weight', feature: true do ...@@ -28,6 +30,7 @@ feature 'Issue filtering by Weight', feature: true do
visit_issues(project) visit_issues(project)
filter_by_weight(weight_num) filter_by_weight(weight_num)
expect(page).to have_css('.weight-filter .dropdown-toggle-text', text: weight_num)
expect(page).to have_css('.issue', count: 2) expect(page).to have_css('.issue', count: 2)
end end
...@@ -35,6 +38,7 @@ feature 'Issue filtering by Weight', feature: true do ...@@ -35,6 +38,7 @@ feature 'Issue filtering by Weight', feature: true do
visit_issues(project) visit_issues(project)
filter_by_weight(Issue::WEIGHT_ALL) filter_by_weight(Issue::WEIGHT_ALL)
expect(page).to have_css('.weight-filter .dropdown-toggle-text', text: Issue::WEIGHT_ALL)
expect(page).to have_css('.issue', count: 3) expect(page).to have_css('.issue', count: 3)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment