Commit 226908b8 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix issue weight selection

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent b4efe44d
...@@ -121,13 +121,13 @@ module IssuesHelper ...@@ -121,13 +121,13 @@ module IssuesHelper
end end
end end
def projects_weight_options def projects_weight_options(selected = nil)
options = (Issue::WEIGHT_RANGE).map do |i| options = (Issue::WEIGHT_RANGE).map do |i|
[i, i] [i, i]
end end
options.unshift(['Any', nil]) options.unshift(['Any', nil])
options_for_select(options, params[:weight]) options_for_select(options, selected || params[:weight])
end end
# Required for Banzai::Filter::IssueReferenceFilter # Required for Banzai::Filter::IssueReferenceFilter
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
= icon('magnet') = icon('magnet')
Weight Weight
.col-sm-10 .col-sm-10
= f.select :weight, projects_weight_options, { include_blank: true }, = f.select :weight, projects_weight_options(issuable.weight), { include_blank: true },
{ class: 'select2 js-select2', data: { placeholder: "Select weight" }} { class: 'select2 js-select2', data: { placeholder: "Select weight" }}
.form-group .form-group
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
- else - else
.light None .light None
.selectbox .selectbox
= f.select :weight, projects_weight_options, { include_blank: true }, = f.select :weight, projects_weight_options(issuable.weight), { include_blank: true },
{ class: 'select2 js-select2', data: { placeholder: "Select weight" }} { class: 'select2 js-select2', data: { placeholder: "Select weight" }}
.block .block
......
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